Skip to content

Commit c4d2d77

Browse files
committed
Refactor JBangOperation to use ProcessExecutor, add timeout/IO controls, and harden validation
- Switch to `ProcessExecutor` instead of raw `ProcessBuilder` - Add timeout support with configurable limit - Add configurable I/O handling for inherited vs captured output - Harden input validation for all setters and `execute()` - Validate `jbang` executable exists and is executable before running - Update `fromProject()` to preserve explicitly set values - Improve error handling - Add distinct failure on timeout - Check `result.isSuccess()` before returning - Honor `exitOnFailure` flag consistently - Clarify `reset()` behavior to preserve `workDir`, `jBangHome`, and `timeout`
1 parent 0e58fde commit c4d2d77

8 files changed

Lines changed: 558 additions & 170 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ atlassian-ide-plugin.xml
5656
.idea/httpRequests
5757

5858
/local.properties
59+
/.claude/

example/lib/bld/bld-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ bld.downloadLocation=
44
bld.extension-jbang=com.uwyn.rife2:bld-jbang:1.0.0-SNAPSHOT
55
bld.javaOptions=
66
bld.javacOptions=
7-
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES,RIFE2_SNAPSHOTS
7+
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES,RIFE2_SNAPSHOTS,MAVEN_LOCAL
88
bld.sourceDirectories=
99
bld.version=2.3.0

lib/bld/bld-wrapper.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
bld.downloadExtensionJavadoc=false
22
bld.downloadExtensionSources=true
33
bld.downloadLocation=
4-
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.4.3
5-
bld.extension-reporter=com.uwyn.rife2:bld-junit-reporter:0.9.3-SNAPSHOT
6-
bld.extension-spotbugs=com.uwyn.rife2:bld-spotbugs:0.9.1-SNAPSHOT
7-
bld.repositories=MAVEN_LOCAL,RIFE2_RELEASES,MAVEN_CENTRAL,RIFE2_SNAPSHOTS
4+
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.6.5-SNAPSHOT
5+
bld.extension-reporter=com.uwyn.rife2:bld-junit-reporter:1.1.0
6+
bld.extension-spotbugs=com.uwyn.rife2:bld-spotbugs:1.1.5-SNAPSHOT
7+
bld.repositories=RIFE2_RELEASES,MAVEN_CENTRAL,RIFE2_SNAPSHOTS
88
bld.sourceDirectories=
99
bld.version=2.3.1-SNAPSHOT

src/bld/java/rife/bld/extension/JBangOperationBuild.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ public JBangOperationBuild() {
3535
pkg = "rife.bld.extension";
3636
name = "JBang";
3737
archiveBaseName = "bld-jbang";
38-
version = version(1, 1, 0, "SNAPSHOT");
38+
version = version(1, 0, 0, "SNAPSHOT");
3939

4040
javaRelease = 17;
4141

4242
downloadSources = true;
4343
autoDownloadPurge = true;
4444

45-
repositories = List.of(MAVEN_CENTRAL, CENTRAL_SNAPSHOTS, RIFE2_RELEASES, MAVEN_LOCAL);
45+
repositories = List.of(MAVEN_CENTRAL, CENTRAL_SNAPSHOTS, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
4646

4747
var junit = version(6, 0, 3);
4848
scope(compile)
4949
.include(dependency("com.uwyn.rife2", "bld-extensions-tools",
50-
version(1, 0, 1)))
50+
version(1, 3, 0, "SNAPSHOT")))
5151
.include(dependency("com.uwyn.rife2", "bld",
5252
version(2, 3, 1, "SNAPSHOT")));
5353
scope(provided)
5454
.include(dependency("com.github.spotbugs", "spotbugs-annotations",
5555
version(4, 9, 8)));
5656
scope(test)
5757
.include(dependency("com.uwyn.rife2", "bld-extensions-testing-helpers",
58-
version(1, 0, 0)))
58+
version(1, 0, 1)))
5959
.include(dependency("org.junit.jupiter", "junit-jupiter", junit))
6060
.include(dependency("org.junit.platform", "junit-platform-console-standalone", junit));
6161

@@ -104,10 +104,10 @@ public static void main(String[] args) {
104104
@BuildCommand(summary = "Runs PMD analysis")
105105
public void pmd() throws Exception {
106106
new PmdOperation()
107-
.fromProject(this)
108107
.failOnViolation(true)
109108
.excludesFiles(srcTestResourcesDirectory())
110109
.ruleSets("config/pmd.xml")
110+
.fromProject(this)
111111
.execute();
112112
}
113113

0 commit comments

Comments
 (0)