mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 00:21:19 +00:00
add defaulat license (apache2.0) to all generators
This commit is contained in:
@@ -608,6 +608,19 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
files.add(ignoreFile);
|
||||
}
|
||||
|
||||
// Add default LICENSE (Apache-2.0) for all generators
|
||||
final String apache2License = "LICENSE";
|
||||
String licenseFileNameTarget = config.outputFolder() + File.separator + apache2License;
|
||||
File licenseFile = new File(licenseFileNameTarget);
|
||||
String licenseFileNameSource = File.separator + config.getCommonTemplateDir() + File.separator + apache2License;
|
||||
String licenseFileContents = readResourceContents(licenseFileNameSource);
|
||||
try {
|
||||
writeToFile(licenseFileNameTarget, licenseFileContents);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Could not generate LICENSE file '" + apache2License + "'", e);
|
||||
}
|
||||
files.add(licenseFile);
|
||||
}
|
||||
config.processSwagger(swagger);
|
||||
return files;
|
||||
|
||||
Reference in New Issue
Block a user