- [Objc] Fix test after removing license property

- Moved adding License file to DefaultGenerator
This commit is contained in:
Mateusz Mackowiak
2016-05-27 12:46:09 +02:00
parent c68168fa27
commit d82c77da34
8 changed files with 27 additions and 10 deletions

View File

@@ -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

View File

@@ -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)) {

View File

@@ -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);
}
}
}

View File

@@ -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