mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 16:40:56 +00:00
This commit is contained in:
parent
a94ad37738
commit
626cd8c0cd
@ -727,15 +727,18 @@ public class DefaultGenerator implements Generator {
|
||||
outputFolder += File.separator + support.getFolder();
|
||||
}
|
||||
File of = new File(outputFolder);
|
||||
if (!of.isDirectory()) {
|
||||
if (!dryRun && !of.mkdirs()) {
|
||||
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
||||
}
|
||||
}
|
||||
String outputFilename = new File(support.getDestinationFilename()).isAbsolute() // split
|
||||
? support.getDestinationFilename()
|
||||
: outputFolder + File.separator + support.getDestinationFilename().replace('/', File.separatorChar);
|
||||
|
||||
if (!of.isDirectory()) {
|
||||
// check that its not a dryrun and the files in the directory aren't ignored before we make the directory
|
||||
if (!dryRun && ignoreProcessor.allowsFile(new File(outputFilename)) && !of.mkdirs()) {
|
||||
once(LOGGER).debug("Output directory {} not created. It {}.", outputFolder, of.exists() ? "already exists." : "may not have appropriate permissions.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean shouldGenerate = true;
|
||||
if (supportingFilesToGenerate != null && !supportingFilesToGenerate.isEmpty()) {
|
||||
shouldGenerate = supportingFilesToGenerate.contains(support.getDestinationFilename());
|
||||
|
@ -39,6 +39,8 @@ public class DefaultGeneratorTest {
|
||||
"build.sbt",
|
||||
"src/main/AndroidManifest.xml",
|
||||
"pom.xml",
|
||||
".github/**",
|
||||
"api/**.yaml",
|
||||
"src/test/**",
|
||||
"src/main/java/org/openapitools/client/api/UserApi.java"
|
||||
);
|
||||
@ -66,7 +68,7 @@ public class DefaultGeneratorTest {
|
||||
|
||||
List<File> files = generator.opts(clientOptInput).generate();
|
||||
|
||||
Assert.assertEquals(files.size(), 44);
|
||||
Assert.assertEquals(files.size(), 42);
|
||||
|
||||
// Check expected generated files
|
||||
// api sanity check
|
||||
@ -84,8 +86,11 @@ public class DefaultGeneratorTest {
|
||||
TestUtils.ensureContainsFile(files, output, "build.gradle");
|
||||
Assert.assertTrue(new File(output, "build.gradle").exists());
|
||||
|
||||
TestUtils.ensureContainsFile(files, output, "api/openapi.yaml");
|
||||
Assert.assertTrue(new File(output, "build.gradle").exists());
|
||||
TestUtils.ensureDoesNotContainsFile(files, output, "api/openapi.yaml");
|
||||
Assert.assertFalse(new File(output, "api").exists());
|
||||
|
||||
TestUtils.ensureDoesNotContainsFile(files, output, ".github/workflows/");
|
||||
Assert.assertFalse(new File(output, ".github").exists());
|
||||
|
||||
// Check excluded files
|
||||
TestUtils.ensureDoesNotContainsFile(files, output, ".travis.yml");
|
||||
|
Loading…
x
Reference in New Issue
Block a user