Skip to content

Commit

Permalink
Clean up launcher attribute
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=120567604
  • Loading branch information
cushon authored and damienmg committed Apr 22, 2016
1 parent 1c15569 commit b77ab15
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,31 @@ public Object getDefault(AttributeMap rule) {
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
// TODO(bazel-team): describe how to access this data at runtime
.add(attr("stamp", TRISTATE).value(TriState.AUTO))
/* <!-- #BLAZE_RULE($base_java_binary).ATTRIBUTE(launcher) -->
If specified, the target will be used to launch the Java Virtual Machine in
the wrapper shell script. The target must be a <code>cc_binary</code>.
Any <code>cc_binary</code> that implements the
<a href="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html">
Java Invocation API</a> can be a launcher target.
<p>The related <a href="../blaze-user-manual.html#flag--java_launcher"><code>
--java_launcher</code></a> Bazel flag affects only those
<code>java_binary</code> and <code>java_test</code> targets that have
<i>not</i> specified a <code>launcher</code> attribute. For those targets
that must always be run with the JDK's "java" launcher, set their
<code>launcher</code> attribute to the special opt-out label
<code>//third_party/java/jdk:jdk_launcher</code>.</p>
<p>If you build a deploy jar and specify a launcher target through either
this <code>launcher</code> attribute or <code>--java_launcher</code> Bazel
flag, then the deploy jar will be a single file that is both (a) a .jar
file that contains the appropriate classes, and (b) the executable
specified by the launcher target. (This does not apply to the opt-out
label.)</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("launcher", LABEL)
.allowedFileTypes(FileTypeSet.NO_FILE)
.allowedRuleClasses("cc_binary"))
.add(attr(":java_launcher", LABEL).value(JavaSemantics.JAVA_LAUNCHER)) // blaze flag
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ public Label resolve(Rule rule, AttributeMap attributes,
@Override
public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
// don't read --java_launcher if this target overrides via a launcher attribute
if (attributes != null && attributes.has("launcher", LABEL)) {
Label launcher = attributes.get("launcher", LABEL);
if (launcher != null) {
return launcher;
}
if (attributes != null && attributes.isAttributeValueExplicitlySpecified("launcher")) {
return attributes.get("launcher", LABEL);
}
return configuration.getFragment(JavaConfiguration.class).getJavaLauncherLabel();
}
Expand Down

0 comments on commit b77ab15

Please sign in to comment.