Skip to content

Commit

Permalink
Fix --build_target= handling after fb056bc
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 511591549
Change-Id: I7ad764da4d246b87925d0c07b9b85c95589f13ba
  • Loading branch information
cushon authored and copybara-github committed Feb 22, 2023
1 parent 43dadb2 commit ce71760
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:test/test_configuration",
"//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_collection",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/rules/cpp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.google.devtools.build.lib.analysis.actions.Template;
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction;
import com.google.devtools.build.lib.analysis.test.TestConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
Expand Down Expand Up @@ -573,6 +574,7 @@ public String addCoverageSupport(JavaCompilationHelper helper, Artifact executab
public CustomCommandLine buildSingleJarCommandLine(
String toolchainIdentifier,
Artifact output,
Label label,
String mainClass,
ImmutableList<String> manifestLines,
Iterable<Artifact> buildInfoFiles,
Expand All @@ -593,6 +595,7 @@ public CustomCommandLine buildSingleJarCommandLine(
NestedSet<String> addOpens) {
return DeployArchiveBuilder.defaultSingleJarCommandLineWithoutOneVersion(
output,
label,
mainClass,
manifestLines,
buildInfoFiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
Expand Down Expand Up @@ -239,6 +240,7 @@ public DeployArchiveBuilder setAddOpens(NestedSet<String> addOpens) {

public static CustomCommandLine.Builder defaultSingleJarCommandLineWithoutOneVersion(
Artifact outputJar,
Label label,
String javaMainClass,
ImmutableList<String> deployManifestLines,
Iterable<Artifact> buildInfoFiles,
Expand All @@ -255,6 +257,7 @@ public static CustomCommandLine.Builder defaultSingleJarCommandLineWithoutOneVer
NestedSet<String> addOpens) {
return defaultSingleJarCommandLine(
outputJar,
label,
javaMainClass,
deployManifestLines,
buildInfoFiles,
Expand All @@ -275,6 +278,7 @@ public static CustomCommandLine.Builder defaultSingleJarCommandLineWithoutOneVer

public static CustomCommandLine.Builder defaultSingleJarCommandLine(
Artifact outputJar,
Label label,
String javaMainClass,
ImmutableList<String> deployManifestLines,
Iterable<Artifact> buildInfoFiles,
Expand All @@ -294,6 +298,7 @@ public static CustomCommandLine.Builder defaultSingleJarCommandLine(

CustomCommandLine.Builder args = CustomCommandLine.builder();
args.addExecPath("--output", outputJar);
args.add("--build_target", label.getCanonicalForm());
if (compress == Compression.COMPRESSED) {
args.add("--compression");
}
Expand Down Expand Up @@ -449,6 +454,7 @@ public void build() throws InterruptedException {
semantics.buildSingleJarCommandLine(
toolchainIdentifier,
outputJar,
ruleContext.getLabel(),
javaStartClass,
deployManifestLines,
buildInfoArtifacts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ void checkForProtoLibraryAndJavaProtoLibraryOnSameProto(
CustomCommandLine buildSingleJarCommandLine(
String toolchainIdentifier,
Artifact output,
Label label,
String mainClass,
ImmutableList<String> manifestLines,
Iterable<Artifact> buildInfoFiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _bazel_deploy_jars_impl(ctx):
info.coverage_main_class,
info.strip_as_default,
info.build_info_files,
ctx.attr.binary.label.name,
str(ctx.attr.binary.label),
manifest_lines = info.manifest_lines,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ java_test(
deps = [
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:artifacts",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/rules/java:java-compilation",
"//src/main/java/com/google/devtools/build/lib/vfs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.CommandLine;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.rules.java.JavaConfiguration.OneVersionEnforcementLevel;
Expand All @@ -47,6 +48,7 @@ public void testIncludeBuildData() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down Expand Up @@ -76,6 +78,7 @@ public void testExcludeBuildData() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down Expand Up @@ -105,6 +108,7 @@ public void testIncludeJavaLauncher() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down Expand Up @@ -133,6 +137,7 @@ public void testIncludeCompression() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down Expand Up @@ -161,6 +166,7 @@ public void testExcludeCompression() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down Expand Up @@ -193,6 +199,7 @@ public void testOneVersionArgs() throws Exception {
CommandLine command =
defaultSingleJarCommandLine(
dummy,
Label.parseCanonicalUnchecked("//dummy"),
null,
ImmutableList.<String>of(),
ImmutableList.<Artifact>of(),
Expand Down

0 comments on commit ce71760

Please sign in to comment.