Skip to content

Commit

Permalink
Automated rollback of commit 68b9a7e.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

The depot is fixed

RELNOTES: None.
PiperOrigin-RevId: 160115070
  • Loading branch information
cushon authored and hlopko committed Jun 26, 2017
1 parent 8e2bd70 commit 887746f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration.StrictDepsMode;
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;
import com.google.devtools.build.lib.rules.java.JavaConfiguration.JavaClasspathMode;
import com.google.devtools.build.lib.util.Preconditions;
import java.util.ArrayList;
Expand Down Expand Up @@ -140,10 +142,8 @@ public JavaLibraryHelper setCompilationStrictDepsMode(StrictDepsMode strictDepsM
return this;
}

/**
* Creates the compile actions.
*/
public JavaCompilationArgs build(
/** Creates the compile actions. */
public JavaCompilationArtifacts build(
JavaSemantics semantics,
JavaToolchainProvider javaToolchainProvider,
NestedSet<Artifact> hostJavabase,
Expand Down Expand Up @@ -184,7 +184,7 @@ public JavaCompilationArgs build(
helper.createCompileTimeJarAction(output, artifactsBuilder);
artifactsBuilder.addRuntimeJar(output);

return JavaCompilationArgs.builder().merge(artifactsBuilder.build()).build();
return artifactsBuilder.build();
}

/**
Expand All @@ -199,15 +199,19 @@ public JavaCompilationArgs build(
* compilation. Contrast this with {@link #setCompilationStrictDepsMode}.
*/
public JavaCompilationArgsProvider buildCompilationArgsProvider(
JavaCompilationArgs directArgs, boolean isReportedAsStrict) {
JavaCompilationArtifacts artifacts, boolean isReportedAsStrict) {
JavaCompilationArgs directArgs = JavaCompilationArgs.builder().merge(artifacts).build();
JavaCompilationArgs transitiveArgs =
JavaCompilationArgs.builder()
.addTransitiveArgs(directArgs, BOTH)
.addTransitiveDependencies(deps, true /* recursive */)
.build();

return JavaCompilationArgsProvider.create(
isReportedAsStrict ? directArgs : transitiveArgs, transitiveArgs);
isReportedAsStrict ? directArgs : transitiveArgs,
transitiveArgs,
NestedSetBuilder.create(Order.STABLE_ORDER, artifacts.getCompileTimeDependencyArtifact()),
NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER));
}

private void addDepsToAttributes(JavaTargetAttributes.Builder attributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public JavaProvider createJavaCompileAction(
: hostJavabaseProvider.getMiddlemanArtifact();
JavaToolchainProvider javaToolchainProvider =
checkNotNull(javaToolchain.getProvider(JavaToolchainProvider.class));
JavaCompilationArgs artifacts =
JavaCompilationArtifacts artifacts =
helper.build(
javaSemantics,
javaToolchainProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public static ProtoJavaApiInfoProvider create(
JavaCompilationArgs transitiveJavaCompilationArgss1,
JavaCompilationArgs transitiveJavaCompilationArgssMutable,
JavaCompilationArgs transitiveJavaCompilationArgssImmutable,
JavaCompilationArgs javaCompilationArgs1,
JavaCompilationArgs javaCompilationArgsMutable,
JavaCompilationArgs javaCompilationArgsImmutable,
JavaCompilationArtifacts javaCompilationArgs1,
JavaCompilationArtifacts javaCompilationArgsMutable,
JavaCompilationArtifacts javaCompilationArgsImmutable,
Artifact sourceJar1,
Artifact sourceJarMutable,
Artifact sourceJarImmutable,
Expand Down Expand Up @@ -111,22 +111,20 @@ public static ProtoJavaApiInfoProvider create(
*/
public abstract JavaCompilationArgs getTransitiveJavaCompilationArgsImmutable();

/**
* Returns the artifacts for java compilation (API version 1) for only this target.
*/
public abstract JavaCompilationArgs getJavaCompilationArgs1();
/** Returns the artifacts for java compilation (API version 1) for only this target. */
public abstract JavaCompilationArtifacts getJavaCompilationArtifacts1();

/**
* Returns the artifacts for java compilation (API version 2, code for mutable API)
* for only this target.
* Returns the artifacts for java compilation (API version 2, code for mutable API) for only this
* target.
*/
public abstract JavaCompilationArgs getJavaCompilationArgsMutable();
public abstract JavaCompilationArtifacts getJavaCompilationArtifactsMutable();

/**
* Returns the artifacts for java compilation (API version 2, code for immutable API)
* for only this target.
* Returns the artifacts for java compilation (API version 2, code for immutable API) for only
* this target.
*/
public abstract JavaCompilationArgs getJavaCompilationArgsImmutable();
public abstract JavaCompilationArtifacts getJavaCompilationArtifactsImmutable();

// The following 3 fields are the -src.jar artifact created by proto_library. If a certain
// proto_library does not produce some artifact, it'll be null. This can happen for example when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgs;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider;
import com.google.devtools.build.lib.rules.java.JavaCompilationArtifacts;
import com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider;
import com.google.devtools.build.lib.rules.java.JavaSkylarkApiProvider;
import com.google.devtools.build.lib.rules.java.JavaSourceJarsProvider;
Expand All @@ -51,7 +52,7 @@ public static boolean reuseExistingActions(
return false;
}

JavaCompilationArgs directJars = javaApi.getJavaCompilationArgsImmutable();
JavaCompilationArtifacts directJars = javaApi.getJavaCompilationArtifactsImmutable();
if (isEmpty(directJars.getCompileTimeJars()) || javaApi.sourceJarImmutable() == null) {
return false;
}
Expand All @@ -60,7 +61,7 @@ public static boolean reuseExistingActions(
JavaCompilationArgs.builder()
.addTransitiveArgs(javaApi.getTransitiveJavaCompilationArgsImmutable(), BOTH)
.addTransitiveDependencies(javaApi.getProtoRuntimeImmutable(), true /* recursive */)
.addTransitiveArgs(directJars, BOTH)
.merge(directJars)
.build();

Artifact outputJar = getOnlyElement(directJars.getRuntimeJars());
Expand All @@ -69,9 +70,10 @@ public static boolean reuseExistingActions(

JavaCompilationArgsProvider compilationArgsProvider =
JavaCompilationArgsProvider.create(
directJars,
JavaCompilationArgs.builder().merge(directJars).build(),
transitiveJars,
NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER),
NestedSetBuilder.create(
Order.STABLE_ORDER, directJars.getCompileTimeDependencyArtifact()),
NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER));

TransitiveInfoProviderMapBuilder javaProvidersBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.NativeAspectClass;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgs;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider;
import com.google.devtools.build.lib.rules.java.JavaCompilationArtifacts;
import com.google.devtools.build.lib.rules.java.JavaCompilationHelper;
import com.google.devtools.build.lib.rules.java.JavaConfiguration;
import com.google.devtools.build.lib.rules.java.JavaHelper;
Expand Down Expand Up @@ -254,7 +254,7 @@ private JavaCompilationArgsProvider createJavaCompileAction(
helper.addDep(runtime.getProvider(JavaCompilationArgsProvider.class));
}
helper.setCompilationStrictDepsMode(StrictDepsMode.OFF);
JavaCompilationArgs artifacts =
JavaCompilationArtifacts artifacts =
helper.build(
javaSemantics,
JavaCompilationHelper.getJavaToolchainProvider(ruleContext),
Expand Down

0 comments on commit 887746f

Please sign in to comment.