use of com.google.devtools.build.lib.rules.java.JavaToolchainData.SupportsWorkers in project bazel by bazelbuild.
the class JavaToolchainDataParser method parseBuildRuleProto.
private static JavaToolchainData parseBuildRuleProto(Build.Rule rule) {
String source = "";
String target = "";
ImmutableList<String> bootclasspath = ImmutableList.of();
ImmutableList<String> extclasspath = ImmutableList.of();
String encoding = "";
ImmutableList<String> xlint = ImmutableList.of();
ImmutableList<String> misc = ImmutableList.of();
ImmutableList<String> jvmOpts = ImmutableList.of();
SupportsWorkers javacSupportsWorkers = SupportsWorkers.NO;
for (Build.Attribute attribute : rule.getAttributeList()) {
switch(attribute.getName()) {
case "source_version":
source = attribute.getStringValue();
break;
case "target_version":
target = attribute.getStringValue();
break;
case "bootclasspath":
bootclasspath = ImmutableList.copyOf(attribute.getStringListValueList());
break;
case "extclasspath":
extclasspath = ImmutableList.copyOf(attribute.getStringListValueList());
break;
case "encoding":
encoding = attribute.getStringValue();
break;
case "xlint":
xlint = ImmutableList.copyOf(attribute.getStringListValueList());
break;
case "misc":
{
List<String> options = new ArrayList<>();
for (String option : attribute.getStringListValueList()) {
try {
ShellUtils.tokenize(options, option);
} catch (ShellUtils.TokenizationException e) {
// Tokenization failed; this likely means that the user
// did not want tokenization to happen on the argument.
// (see JavaHelper.tokenizeJavaOptions)
options.add(option);
}
}
misc = ImmutableList.copyOf(options);
break;
}
case "jvm_opts":
jvmOpts = ImmutableList.copyOf(attribute.getStringListValueList());
break;
case "javac_supports_workers":
if (attribute.getBooleanValue()) {
javacSupportsWorkers = SupportsWorkers.YES;
}
break;
}
}
return new JavaToolchainData(source, target, bootclasspath, extclasspath, encoding, xlint, misc, jvmOpts, javacSupportsWorkers);
}
Aggregations