This is an automated email from the ASF dual-hosted git repository. ningjiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git
commit fbae606eb70656743af0f605f88ead4f32f8d2a9 Author: MabinGo <bin...@huawei.com> AuthorDate: Mon May 20 19:33:38 2019 +0800 Fix bug about ServiceComb code model Signed-off-by: MabinGo <bin...@huawei.com> --- .../toolkit/codegen/ServiceCombProviderCodegen.java | 16 ++++++---------- .../org/apache/servicecomb/toolkit/cli/CodeGenerate.java | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java index 25b345f..fb6fb34 100755 --- a/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java +++ b/code-generator/src/main/java/org/apache/servicecomb/toolkit/codegen/ServiceCombProviderCodegen.java @@ -35,8 +35,6 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C private String resourcesFolder = projectFolder + File.separator + "resources"; - private String apiVersion = "1.0.0"; - private String mainClassPackage; @@ -66,14 +64,12 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C embeddedTemplateDir = templateDir = "ServiceCombProvider"; - apiPackage = "servicecomb.example.controller"; - - modelPackage = "servicecomb.example.model"; - - mainClassPackage = "servicecomb.example"; - groupId = "org.apache.servicecomb"; - artifactId = "demo"; + artifactId = "example"; + + apiPackage = groupId + ".example.controller"; + modelPackage = groupId + ".example.model"; + mainClassPackage = groupId + ".example"; supportedLibraries.put(DEFAULT_LIBRARY, "ServiceComb Server application using the springboot programming model."); @@ -94,7 +90,6 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); additionalProperties.put("dateLibrary", "java8"); additionalProperties.put("jackson", "true"); - additionalProperties.put("apiVersion", apiVersion); additionalProperties.put("mainClassPackage", mainClassPackage); additionalProperties.put("camelcase", new CamelCaseLambda()); @@ -107,6 +102,7 @@ public class ServiceCombProviderCodegen extends AbstractJavaCodegen implements C "README.md") ); + supportingFiles.add(new SupportingFile("Application.mustache", mainClassFolder(), "Application.java") diff --git a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java index c9506ce..8c06581 100755 --- a/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java +++ b/toolkit-cli/src/main/java/org/apache/servicecomb/toolkit/cli/CodeGenerate.java @@ -85,9 +85,7 @@ public class CodeGenerate implements Runnable { File contractFile = new File(spec); - // has many contracts if (contractFile.isDirectory()) { - try { Files.walkFileTree(Paths.get(contractFile.toURI()), new SimpleFileVisitor<Path>() { @Override @@ -105,7 +103,6 @@ public class CodeGenerate implements Runnable { e.printStackTrace(); } } else { - // one contract configurator.setInputSpec(spec); new DefaultCodeGenerator().opts(configurator).generate(); }