forked from loafle/openapi-generator-original
[maven-generator] Do not cleanup output if spec file is unchanged and skipIfSpecIsUnchanged=true (Fixes #16490) (#16491)
* Don't delete output directory if spec is unchanged Resolves #16490 * Fix some typos
This commit is contained in:
parent
c6d355e8d4
commit
196c2b1642
@ -520,15 +520,6 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
"generated-test-sources/openapi" : "generated-sources/openapi");
|
"generated-test-sources/openapi" : "generated-sources/openapi");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleanupOutput) {
|
|
||||||
try {
|
|
||||||
FileUtils.deleteDirectory(output);
|
|
||||||
LOGGER.info("Previous run output is removed from {}", output);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.warn("Failed to clean-up output directory {}", output, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addCompileSourceRootIfConfigured();
|
addCompileSourceRootIfConfigured();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -566,10 +557,19 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cleanupOutput) {
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(output);
|
||||||
|
LOGGER.info("Previous run output is removed from {}", output);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.warn("Failed to clean up output directory {}", output, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// attempt to read from config file
|
// attempt to read from config file
|
||||||
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
|
CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
|
||||||
|
|
||||||
// if a config file wasn't specified or we were unable to read it
|
// if a config file wasn't specified, or we were unable to read it
|
||||||
if (configurator == null) {
|
if (configurator == null) {
|
||||||
configurator = new CodegenConfigurator();
|
configurator = new CodegenConfigurator();
|
||||||
}
|
}
|
||||||
@ -938,8 +938,8 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
/**
|
/**
|
||||||
* Calculate openapi specification file hash. If specification is hosted on remote resource it is downloaded first
|
* Calculate openapi specification file hash. If specification is hosted on remote resource it is downloaded first
|
||||||
*
|
*
|
||||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
* @param inputSpecFile - Openapi specification input file to calculate its hash.
|
||||||
* Does not taken into account if input spec is hosted on remote resource
|
* Does not take into account if input spec is hosted on remote resource
|
||||||
* @return openapi specification file hash
|
* @return openapi specification file hash
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@ -991,8 +991,8 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get specification hash file
|
* Get specification hash file
|
||||||
* @param inputSpecFile - Openapi specification input file to calculate it's hash.
|
* @param inputSpecFile - Openapi specification input file to calculate its hash.
|
||||||
* Does not taken into account if input spec is hosted on remote resource
|
* Does not take into account if input spec is hosted on remote resource
|
||||||
* @return a file with previously calculated hash
|
* @return a file with previously calculated hash
|
||||||
*/
|
*/
|
||||||
private File getHashFile(File inputSpecFile) {
|
private File getHashFile(File inputSpecFile) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user