Skip to content

Commit

Permalink
update: Optimize the increment setting in the plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
shalousun committed Feb 5, 2024
1 parent a4a80cc commit bd8c024
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public boolean ignoreArtifactById(CustomArtifact artifact) {
case "java-driver-core":
case "java-driver-query-builder":
case "java-driver-mapper-runtime":
case "resteasy-core":
return true;
default:
return this.ignore(filterChain, artifact);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class SmartDocPluginExtension {
/**
* Whether build documents incrementally or not
*/
private boolean increment = false;
private Boolean increment = false;

/**
* Smart doc config file, like smart-doc.json
Expand Down Expand Up @@ -96,11 +96,11 @@ public Set<String> getInclude() {
return include;
}

public boolean isIncrement() {
public Boolean getIncrement() {
return increment;
}

public void setIncrement(boolean increment) {
public void setIncrement(Boolean increment) {
this.increment = increment;
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/ly/doc/gradle/task/DocBaseTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void action() {
if (Objects.isNull(file)) {
file = new File(GlobalConstants.DEFAULT_CONFIG);
}
boolean increment = pluginExtension.isIncrement();
Boolean increment = pluginExtension.getIncrement();
ApiConfig apiConfig = GradleUtil.buildConfig(file, project, increment, logger);
if (apiConfig == null) {
logger.quiet(GlobalConstants.ERROR_MSG);
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/ly/doc/gradle/util/GradleUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean shouldSkipClass(Class<?> aClass) {
* @param log gradle plugin log
* @return com.power.doc.model.ApiConfig
*/
public static ApiConfig buildConfig(File configFile, Project project, boolean increment, Logger log) {
public static ApiConfig buildConfig(File configFile, Project project, Boolean increment, Logger log) {
try {
ClassLoader classLoader = ClassLoaderUtil.getRuntimeClassLoader(project);
String data = FileUtil.getFileContent(new FileInputStream(configFile));
Expand Down Expand Up @@ -110,8 +110,11 @@ public static ApiConfig buildConfig(File configFile, Project project, boolean in
apiConfig.setProjectName(project.getName());
}
addSourcePaths(project, apiConfig, log);
if (Objects.nonNull(increment)) {
// overwrite by plugin
apiConfig.setIncrement(increment);
}

apiConfig.setIncrement(increment);
apiConfig.setBaseDir(project.getProjectDir().getAbsolutePath());

return apiConfig;
Expand Down

0 comments on commit bd8c024

Please sign in to comment.