forked from loafle/openapi-generator-original
- [Objc] Fix test after removing license property
- Moved adding License file to DefaultGenerator
This commit is contained in:
@@ -792,6 +792,8 @@ public class DefaultCodegen {
|
||||
importMapping.put("LocalDate", "org.joda.time.*");
|
||||
importMapping.put("LocalTime", "org.joda.time.*");
|
||||
|
||||
supportingFiles.add(new SupportingFile.GlobalSupportingFile("LICENSE.mustache", "LICENSE"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
|
||||
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
|
||||
|
||||
@@ -530,9 +530,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
LOGGER.info("Skipped overwriting " + outputFilename);
|
||||
continue;
|
||||
}
|
||||
|
||||
String templateFile = getFullTemplateFile(config, support.templateFile);
|
||||
|
||||
String templateFile;
|
||||
if( support instanceof SupportingFile.GlobalSupportingFile) {
|
||||
templateFile = config.getCommonTemplateDir() + File.separator + support.templateFile;
|
||||
} else {
|
||||
templateFile = getFullTemplateFile(config, support.templateFile);
|
||||
}
|
||||
boolean shouldGenerate = true;
|
||||
if(supportingFilesToGenerate != null && supportingFilesToGenerate.size() > 0) {
|
||||
if(supportingFilesToGenerate.contains(support.destinationFilename)) {
|
||||
|
||||
@@ -5,6 +5,10 @@ public class SupportingFile {
|
||||
public String folder;
|
||||
public String destinationFilename;
|
||||
|
||||
public SupportingFile(String templateFile, String destinationFilename) {
|
||||
this(templateFile, "", destinationFilename);
|
||||
}
|
||||
|
||||
public SupportingFile(String templateFile, String folder, String destinationFilename) {
|
||||
this.templateFile = templateFile;
|
||||
this.folder = folder;
|
||||
@@ -44,4 +48,17 @@ public class SupportingFile {
|
||||
result = 31 * result + (destinationFilename != null ? destinationFilename.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static public class GlobalSupportingFile extends SupportingFile {
|
||||
|
||||
GlobalSupportingFile(String templateFile, String folder, String destinationFilename) {
|
||||
super(templateFile, folder, destinationFilename);
|
||||
}
|
||||
|
||||
GlobalSupportingFile(String templateFile, String destinationFilename) {
|
||||
super(templateFile, destinationFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -251,7 +251,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("LICENSE.mustache", "", "LICENSE"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user