Skip to content

Commit

Permalink
generateSourceCodeOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
rienafairefr authored and unknown committed Jul 14, 2018
1 parent 64fd3ab commit c4aa977
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case,
public static final String EXCLUDE_TESTS = "excludeTests";
public static final String EXCLUDE_TESTS_DESC = "Specifies that no tests are to be generated.";

public static final String ONLYPACKAGE_GENERATION = "onlyPackage";
public static final String ONLYPACKAGE_GENERATION_DESC = "Specifies that only a library client package is to be generated.";
public static final String SOURCECODEONLY_GENERATION = "generateSourceCodeOnly";
public static final String SOURCECODEONLY_GENERATION_DESC = "Specifies that only a library source code is to be generated.";

// Not user-configurable. System provided for use in templates.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public PythonClientCodegen() {
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
.defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.ONLYPACKAGE_GENERATION, CodegenConstants.ONLYPACKAGE_GENERATION_DESC)
cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC)
.defaultValue(Boolean.FALSE.toString()));

supportedLibraries.put("urllib3", "urllib3-based client");
Expand Down Expand Up @@ -200,16 +200,16 @@ public void processOpts() {
setPackageVersion("1.0.0");
}

Boolean onlyPackage = false;
if (additionalProperties.containsKey(CodegenConstants.ONLYPACKAGE_GENERATION)) {
onlyPackage = true;
Boolean generateSourceCodeOnly = false;
if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
generateSourceCodeOnly = true;
}

additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName);
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);

if (onlyPackage) {
if (generateSourceCodeOnly) {
// tests in <package>/test
testFolder = packageName + File.separatorChar + testFolder;
// api/model docs in <package>/docs
Expand All @@ -226,13 +226,13 @@ public void processOpts() {

String readmePath ="README.md";
String readmeTemplate = "README.mustache";
if (onlyPackage) {
if (generateSourceCodeOnly) {
readmePath = packageName + "_" + readmePath;
readmeTemplate = "README_onlypackage.mustache";
}
supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath));

if (!onlyPackage){
if (!generateSourceCodeOnly){
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Map<String, String> createOptions() {
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.ONLYPACKAGE_GENERATION, "false")
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3")
.build();
}
Expand Down

0 comments on commit c4aa977

Please sign in to comment.