forked from loafle/openapi-generator-original
maven plugin: log global settings, minor improvements (#16961)
This commit is contained in:
parent
e4cfd626c8
commit
39347ec37b
@ -1198,7 +1198,6 @@ public final class GeneratorSettings implements Serializable {
|
||||
*/
|
||||
public GeneratorSettings build() {
|
||||
GeneratorSettings instance = new GeneratorSettings(this);
|
||||
//noinspection PlaceholderCountMatchesArgumentCount
|
||||
LOGGER.debug("GeneratorSettings#build: {}", instance);
|
||||
return instance;
|
||||
}
|
||||
|
@ -903,6 +903,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
return;
|
||||
}
|
||||
adjustAdditionalProperties(config);
|
||||
GlobalSettings.log();
|
||||
new DefaultGenerator(dryRun).opts(input).generate();
|
||||
|
||||
if (buildContext != null) {
|
||||
|
@ -606,7 +606,7 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
Map<String, List<CodegenOperation>> paths = processPaths(this.openAPI.getPaths());
|
||||
Set<String> apisToGenerate = null;
|
||||
String apiNames = GlobalSettings.getProperty("apis");
|
||||
String apiNames = GlobalSettings.getProperty(CodegenConstants.APIS);
|
||||
if (apiNames != null && !apiNames.isEmpty()) {
|
||||
apisToGenerate = new HashSet<>(Arrays.asList(apiNames.split(",")));
|
||||
}
|
||||
|
@ -16,6 +16,11 @@
|
||||
|
||||
package org.openapitools.codegen.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@ -31,6 +36,8 @@ import java.util.Properties;
|
||||
*/
|
||||
public class GlobalSettings {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalSettings.class);
|
||||
|
||||
private static ThreadLocal<Properties> properties = new InheritableThreadLocal<Properties>() {
|
||||
@Override
|
||||
protected Properties initialValue() {
|
||||
@ -60,4 +67,10 @@ public class GlobalSettings {
|
||||
public static void reset() {
|
||||
properties.remove();
|
||||
}
|
||||
|
||||
public static void log() {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
properties.get().list(new PrintWriter(stringWriter));
|
||||
LOGGER.debug("GlobalSettings: {}", stringWriter);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user