Skip to content

Commit

Permalink
feat: worker max heap is configurable via task input property.
Browse files Browse the repository at this point in the history
  • Loading branch information
autonomousapps authored and melix committed Nov 7, 2024
1 parent 930bbfd commit 240af5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ txtOutputFile:: Path to the generated TXT report. Type: _File_. Default value: _
semverOutputFile:: Path to the generated semantic versioning report. Type: _File_. Default value: _null_
includeSynthetic:: Synthetic classes and class members (like e.g. bridge methods) are not tracked per default. This new option enables the tracking of such kind of classes and class members
ignoreMissingClasses:: Ignores all superclasses or interfaces that missing on the classpath. Default value: _false_
maxWorkerHeap:: The max heap for the Gradle worker process. Type: _String_. Default value: _null_

If you don't set _oldArchives_ and _newArchives_, the plugin will infer them from the _oldClasspath_ and _newClasspath_ properties:

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/me/champeau/gradle/japicmp/JapicmpTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import org.gradle.process.JavaForkOptions;
import org.gradle.workers.ProcessWorkerSpec;
import org.gradle.workers.WorkerExecutor;

Expand Down Expand Up @@ -75,6 +76,15 @@ private void execForNewGradle(final List<JApiCmpWorkerAction.Archive> baseline,
@Override
public void execute(ProcessWorkerSpec spec) {
spec.getClasspath().from(calculateWorkerClasspath());

String maxWorkerHeap = getMaxWorkerHeap().getOrNull();
if (maxWorkerHeap != null) {
spec.forkOptions(new Action<JavaForkOptions>() {
@Override public void execute(JavaForkOptions javaForkOptions) {
javaForkOptions.setMaxHeapSize(maxWorkerHeap);
}
});
}
}
}).submit(JApiCmpWorkAction.class, new Action<JapiCmpWorkParameters>() {
@Override
Expand Down Expand Up @@ -354,4 +364,8 @@ public void addExcludeFilter(Class<? extends Filter> excludeFilterClass) {
@Nested
public abstract Property<RichReport> getRichReport();

@Optional
@Input
public abstract Property<String> getMaxWorkerHeap();

}

0 comments on commit 240af5c

Please sign in to comment.