Issue #3738: introduce the sourceFolder property for all Scala "languages".

This commit is contained in:
Paul Ebermann 2016-09-08 17:21:30 +02:00 committed by Paŭlo Ebermann
parent 1d7d37409a
commit d3eedafe84
9 changed files with 34 additions and 0 deletions

View File

@ -46,6 +46,24 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC));
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
}
}
public void setSourceFolder(String sourceFolder) {
this.sourceFolder = sourceFolder;
}
public String getSourceFolder() {
return sourceFolder;
}
@Override

View File

@ -32,6 +32,8 @@ public class AkkaScalaClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AkkaScalaClientOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setSourceFolder(AkkaScalaClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
}};
}
}

View File

@ -32,6 +32,8 @@ public class AsyncScalaClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AsyncScalaClientOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setSourceFolder(AsyncScalaClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
}};
}
}

View File

@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class AkkaScalaClientOptionsProvider implements OptionsProvider {
public static final String SOURCE_FOLDER_VALUE = "sourceFolder";
public static final String MODEL_PACKAGE_VALUE = "package";
public static final String API_PACKAGE_VALUE = "apiPackage";
public static final String SORT_PARAMS_VALUE = "false";
@ -24,6 +25,7 @@ public class AkkaScalaClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.build();
}

View File

@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class AsyncScalaClientOptionsProvider implements OptionsProvider {
public static final String SOURCE_FOLDER_VALUE = "sourceFolder";
public static final String MODEL_PACKAGE_VALUE = "package";
public static final String API_PACKAGE_VALUE = "apiPackage";
public static final String SORT_PARAMS_VALUE = "false";
@ -24,6 +25,7 @@ public class AsyncScalaClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.build();
}

View File

@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class ScalaClientOptionsProvider implements OptionsProvider {
public static final String SOURCE_FOLDER_VALUE = "sourceFolder";
public static final String MODEL_PACKAGE_VALUE = "package";
public static final String API_PACKAGE_VALUE = "apiPackage";
public static final String SORT_PARAMS_VALUE = "false";
@ -26,6 +27,7 @@ public class ScalaClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.build();
}

View File

@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class ScalatraServerOptionsProvider implements OptionsProvider {
public static final String SOURCE_FOLDER_VALUE = "sourceFolder";
public static final String MODEL_PACKAGE_VALUE = "package";
public static final String API_PACKAGE_VALUE = "apiPackage";
public static final String SORT_PARAMS_VALUE = "false";
@ -24,6 +25,7 @@ public class ScalatraServerOptionsProvider implements OptionsProvider {
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.build();
}

View File

@ -34,6 +34,8 @@ public class ScalaClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setModelPropertyNaming(ScalaClientOptionsProvider.MODEL_PROPERTY_NAMING);
times = 1;
clientCodegen.setSourceFolder(ScalaClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
}};
}
}

View File

@ -32,6 +32,8 @@ public class ScalatraServerOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(ScalatraServerOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setSourceFolder(ScalatraServerOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
}};
}
}