Skip to content

Commit

Permalink
adding a way to add additional JVM options
Browse files Browse the repository at this point in the history
  • Loading branch information
Łukasz Wiecheć committed Nov 20, 2014
1 parent 8e4878d commit 81643bb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
23 changes: 19 additions & 4 deletions src/main/java/org/spootnik/LeiningenBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ public class LeiningenBuilder extends Builder {

private final String task;
private String subdirPath;
private String jvmOpts;


// Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@DataBoundConstructor
public LeiningenBuilder(String task, String subdirPath) {
public LeiningenBuilder(String task, String subdirPath, String jvmOpts) {
this.task = task;
this.subdirPath = subdirPath;
this.jvmOpts = jvmOpts;
}

/**
Expand All @@ -63,6 +66,11 @@ public String getSubdirPath() {
return subdirPath;
}

public String getJvmOpts() {
return jvmOpts;
}


@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
// This is where you 'build' the project.
Expand Down Expand Up @@ -138,9 +146,17 @@ private ArgumentListBuilder getLeinCommand(AbstractBuild build, Launcher launche
args.add("-client");
args.add("-XX:+TieredCompilation");
args.add("-Xbootclasspath/a:" + descriptor.getJarPath());

// TODO: handle also spaces within the options, like '-Dvalue="some string"'
for(String jo : jvmOpts.split(" ")) {
if(! "".equals(jo)) {
args.add(jo);
}
}

args.add("-Dfile.encoding=UTF-8");
args.add("-Dmaven.wagon.http.ssl.easy=false");
args.add("-Dleiningen.original.pwd=" + workDir);
args.add("-Dleiningen.original.pwd=" + workDir);
args.add("-cp");
args.add(jarPath);
args.add("clojure.main");
Expand Down Expand Up @@ -223,7 +239,7 @@ public FormValidation doCheckJarPath(@QueryParameter String value)
}

public boolean isApplicable(Class<? extends AbstractProject> aClass) {
// Indicates that this builder can be used with all kinds of project types
// Indicates that this builder can be used with all kinds of project types
return true;
}

Expand All @@ -246,4 +262,3 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
<f:entry title="Leiningen Task Name and Arguments" field="task">
<f:textbox default="jar" />
</f:entry>

<f:advanced>
<f:entry title="Sub-directory Path" field="subdirPath">
<f:textbox/>
</f:entry>
<f:entry title="JVM options" field="jvmOpts">
<f:textbox/>
</f:entry>
</f:advanced>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
Provide JVM parameters.
</div>

0 comments on commit 81643bb

Please sign in to comment.