Skip to content
Permalink
Browse files
Merge branch 'master' of https://github.com/dubbo/dubbo2.js
  • Loading branch information
hufeng committed Jun 29, 2018
2 parents 09aef60 + fcf8215 commit 27417da2b8f0d91887bdca32e1a622f21d1f386e
Showing 6 changed files with 14 additions and 4 deletions.
@@ -2,5 +2,6 @@
"output": "./packages/dubbo/src/__tests__/providers",
"entry": "com.alibaba.dubbo.demo",
"entryJarPath": "./java/dubbo-demo/dubbo-demo-api/target/dubbo-demo-api-2.5.7.jar",
"libDirPath": "./java/dubbo-demo/dubbo-demo-api/target/dependency/"
"libDirPath": "./java/dubbo-demo/dubbo-demo-api/target/dependency/",
"providerSuffix":"Service"
}
@@ -34,6 +34,7 @@ export async function extra(extraParam: IDubboExtInfo): Promise<IExtraResult> {
extraParam.entry,
extraParam.entryJarPath,
extraParam.libDirPath,
extraParam.providerSuffix || 'Provider',
]);

let err: string = '';
@@ -42,7 +43,6 @@ export async function extra(extraParam: IDubboExtInfo): Promise<IExtraResult> {
execCmd.stderr.setEncoding("utf8");
execCmd.stdout.on('data', (rowData:Buffer) => {
let output = rowData.toString("utf8");
console.log(output);
if (output.includes(startFlag)) {
let beginIndex = output.indexOf(startFlag) + startFlag.length;
jarDir = output.substring(beginIndex).trim();
@@ -51,7 +51,6 @@ export async function extra(extraParam: IDubboExtInfo): Promise<IExtraResult> {

execCmd.stderr.on('data', (rowData:Buffer) => {
err += rowData.toString("utf8");
console.log(err);
});

execCmd.on('close', code => {
@@ -60,6 +60,10 @@ export class IntepretHandle implements ITypeSearch {
return this.request.getAst(this.classPath);
}

get providerSuffix(): string {
return this.request.providerSuffix;
}

public async work() {
await this.prepare();
await this.doItRecursively();
@@ -78,6 +78,10 @@ export class Request {
return this.config.output;
}

get providerSuffix(): string{
return this.config.providerSuffix;
}

registerTypeInfo(typeInfoItem: TypeInfoI) {
let key = '';
if (typeInfoItem.classPath) {
@@ -46,7 +46,7 @@ export async function toTypescript(
isAbstract: astJava.isAbstract,
isInterface: astJava.isInterface,
isClass: !astJava.isEnum && !astJava.isInterface,
isProvider: astJava.name.endsWith('Provider'),
isProvider: astJava.name.endsWith(String(intepretHandle.providerSuffix) || 'Provider'),
};
intepretHandle.request.registerTypeInfo(typeInfo);

@@ -27,6 +27,8 @@ export interface IDubboExtInfo {
entryJarPath: string;
//指定jar包依赖的包目录
libDirPath: string;
//provider后缀名可配置
providerSuffix: string;
}

export interface IConfig extends IDubboExtInfo {

0 comments on commit 27417da

Please sign in to comment.