undo some of the debugging changes I made

This commit is contained in:
russellb337 2015-08-27 09:11:49 -07:00
parent d31013d977
commit 074ba1ea54
16 changed files with 21 additions and 45 deletions

View File

@ -98,12 +98,6 @@
<version>${jmockit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>${reflections-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -4,11 +4,7 @@ import io.airlift.airline.Command;
import io.airlift.airline.Option;
import io.swagger.codegen.CliOption;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.cmd.utils.CodegenConfigLoader;
import java.util.ServiceLoader;
import static java.util.ServiceLoader.load;
import io.swagger.codegen.CodegenConfigLoader;
@Command(name = "config-help", description = "Config help for chosen lang")
public class ConfigHelp implements Runnable {

View File

@ -8,9 +8,9 @@ import io.swagger.codegen.CliOption;
import io.swagger.codegen.ClientOptInput;
import io.swagger.codegen.ClientOpts;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConfigLoader;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.DefaultGenerator;
import io.swagger.codegen.cmd.utils.CodegenConfigLoader;
import io.swagger.codegen.cmd.utils.OptionUtils;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static java.util.ServiceLoader.load;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
/**

View File

@ -8,7 +8,7 @@ import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.DefaultGenerator;
import io.swagger.codegen.SwaggerCodegen;
import io.swagger.codegen.cmd.utils.CodegenConfigLoader;
import io.swagger.codegen.CodegenConfigLoader;
import io.swagger.codegen.languages.JavaClientCodegen;
import io.swagger.models.Swagger;
import io.swagger.models.auth.AuthorizationValue;

View File

@ -20,6 +20,7 @@ import io.swagger.codegen.CliOption;
import io.swagger.codegen.ClientOptInput;
import io.swagger.codegen.ClientOpts;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConfigLoader;
import io.swagger.codegen.DefaultGenerator;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
@ -121,7 +122,7 @@ public class CodeGenMojo extends AbstractMojo {
public void execute() throws MojoExecutionException {
Swagger swagger = new SwaggerParser().read(inputSpec);
CodegenConfig config = forName(language);
CodegenConfig config = CodegenConfigLoader.forName(language);
config.setOutputDir(output.getAbsolutePath());
if (null != templateDirectory) {
@ -167,20 +168,4 @@ public class CodeGenMojo extends AbstractMojo {
project.addCompileSourceRoot(output.toString());
}
}
private CodegenConfig forName(String name) {
ServiceLoader<CodegenConfig> loader = ServiceLoader.load(CodegenConfig.class);
for (CodegenConfig config : loader) {
if (config.getName().equals(name)) {
return config;
}
}
// else try to load directly
try {
return (CodegenConfig) Class.forName(name).newInstance();
} catch (Exception e) {
throw new RuntimeException("Can't load config class with name ".concat(name), e);
}
}
}

View File

@ -340,6 +340,12 @@
<version>${testng-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>${reflections-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>

View File

@ -1,6 +1,4 @@
package io.swagger.codegen.cmd.utils;
import io.swagger.codegen.CodegenConfig;
package io.swagger.codegen;
import java.util.ServiceLoader;

View File

@ -84,7 +84,7 @@
<properties>
<maven-plugin-version>1.0.0</maven-plugin-version>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<logback-version>1.0.1</logback-version>
<junit-version>4.8.2</junit-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -169,7 +169,7 @@
</repositories>
<properties>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.18.1</jersey-version>
<slf4j-version>1.6.3</slf4j-version>
<junit-version>4.8.1</junit-version>

View File

@ -151,7 +151,7 @@
</repositories>
<properties>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>
<scala-test-version>1.6.1</scala-test-version>

View File

@ -1,7 +1,5 @@
package io.swagger.codegen.cmd.utils;
package io.swagger.codegen;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.DefaultCodegen;
import org.reflections.Reflections;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

View File

@ -271,7 +271,7 @@
<maven-plugin-version>1.0.0</maven-plugin-version>
<servlet-api-version>2.5</servlet-api-version>
<zip-version>1.3.2</zip-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey2-version>2.4.1</jersey2-version>
</properties>
</project>

View File

@ -518,6 +518,6 @@
<testng-version>6.9.6</testng-version>
<surefire-version>2.18.1</surefire-version>
<jmockit-version>1.18</jmockit-version>
<reflections-version>0.9.9</reflections-version>
<reflections-version>0.9.10</reflections-version>
</properties>
</project>

View File

@ -84,7 +84,7 @@
<properties>
<maven-plugin-version>1.0.0</maven-plugin-version>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<logback-version>1.0.1</logback-version>
<junit-version>4.8.2</junit-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -169,7 +169,7 @@
</repositories>
<properties>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.18.1</jersey-version>
<slf4j-version>1.6.3</slf4j-version>
<junit-version>4.8.1</junit-version>

View File

@ -151,7 +151,7 @@
</repositories>
<properties>
<swagger-core-version>1.5.3</swagger-core-version>
<jetty-version>9.2.13.v20150730</jetty-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>
<scala-test-version>1.6.1</scala-test-version>