aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-09-24 13:27:35 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-09-24 14:23:24 +0000
commit58502f2103d876fa734d53f29eff69bf48c19ea6 (patch)
tree7468b34cce9a3430c95f7d899fd76a627d4657b3 /src/main/java
parente5aaacf5dfecdf8a38ee41a3d35ca1d333d959df (diff)
Remove the experimental check-deps implementation.
-- MOS_MIGRATED_REVID=103839895
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/AnalysisHooks.java36
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java18
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/DirectDependencyProvider.java64
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java6
7 files changed, 2 insertions, 146 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisHooks.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisHooks.java
deleted file mode 100644
index 82c448514c..0000000000
--- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisHooks.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.analysis;
-
-import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
-import com.google.devtools.build.lib.packages.Target;
-import com.google.devtools.build.lib.pkgcache.PackageManager;
-
-/**
- * This interface resolves target - configuration pairs to {@link ConfiguredTarget} instances.
- *
- * <p>This interface is used to provide analysis phase functionality to actions that need it in
- * the execution phase.
- */
-public interface AnalysisHooks {
- /**
- * Returns the package manager used during the analysis phase.
- */
- PackageManager getPackageManager();
-
- /**
- * Resolves an existing configured target. Returns null if it is not in the cache.
- */
- ConfiguredTarget getExistingConfiguredTarget(Target target, BuildConfiguration configuration);
-}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java
index ea8908a974..2b36476e2a 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java
@@ -29,13 +29,10 @@ import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Co
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Substitution;
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Template;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
-import com.google.devtools.build.lib.analysis.config.BuildConfiguration.StrictDepsMode;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.rules.java.DeployArchiveBuilder;
import com.google.devtools.build.lib.rules.java.DeployArchiveBuilder.Compression;
-import com.google.devtools.build.lib.rules.java.DirectDependencyProvider;
-import com.google.devtools.build.lib.rules.java.DirectDependencyProvider.Dependency;
import com.google.devtools.build.lib.rules.java.JavaCommon;
import com.google.devtools.build.lib.rules.java.JavaCompilationArtifacts;
import com.google.devtools.build.lib.rules.java.JavaCompilationHelper;
@@ -232,15 +229,7 @@ public class BazelJavaSemantics implements JavaSemantics {
JavaCompilationHelper helper,
NestedSetBuilder<Artifact> filesBuilder,
RuleConfiguredTargetBuilder ruleBuilder) {
- if (!isJavaBinaryOrJavaTest(ruleContext)) {
- Artifact outputDepsProto = helper.getOutputDepsProtoArtifact();
- if (outputDepsProto != null && helper.getStrictJavaDeps() != StrictDepsMode.OFF) {
- ImmutableList<Dependency> strictDependencies =
- javaCommon.computeStrictDepsFromJavaAttributes(helper.getAttributes());
- ruleBuilder.add(DirectDependencyProvider.class,
- new DirectDependencyProvider(strictDependencies));
- }
- } else {
+ if (isJavaBinaryOrJavaTest(ruleContext)) {
boolean createExec = ruleContext.attributes().get("create_executable", Type.BOOLEAN);
ruleBuilder.add(JavaPrimaryClassProvider.class,
new JavaPrimaryClassProvider(createExec ? getMainClassInternal(ruleContext) : null));
@@ -263,11 +252,6 @@ public class BazelJavaSemantics implements JavaSemantics {
}
@Override
- public boolean useStrictJavaDeps(BuildConfiguration configuration) {
- return true;
- }
-
- @Override
public CustomCommandLine buildSingleJarCommandLine(BuildConfiguration configuration,
Artifact output, String mainClass, ImmutableList<String> manifestLines,
Iterable<Artifact> buildInfoFiles, ImmutableList<Artifact> resources,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/DirectDependencyProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/DirectDependencyProvider.java
deleted file mode 100644
index 9712fdff9a..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/java/DirectDependencyProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.rules.java;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
-
-/**
- * A provider that returns the direct dependencies of a target. Used for strict dependency
- * checking.
- */
-@Immutable
-public final class DirectDependencyProvider implements TransitiveInfoProvider {
-
- private final ImmutableList<Dependency> strictDependencies;
-
- public DirectDependencyProvider(Iterable<Dependency> strictDependencies) {
- this.strictDependencies = ImmutableList.copyOf(strictDependencies);
- }
-
- /**
- * @returns the direct (strict) dependencies of this provider. All symbols that are directly
- * reachable from the sources of the provider should be available in one these artifacts.
- */
- public Iterable<Dependency> getStrictDependencies() {
- return strictDependencies;
- }
-
- /**
- * A pair of label and its generated list of artifacts.
- */
- public static class Dependency {
- private final Label label;
-
- // TODO(bazel-team): change this to Artifacts
- private final Iterable<String> fileExecPaths;
-
- public Dependency(Label label, Iterable<String> fileExecPaths) {
- this.label = label;
- this.fileExecPaths = fileExecPaths;
- }
-
- public Label getLabel() {
- return label;
- }
-
- public Iterable<String> getDependencyOutputs() {
- return fileExecPaths;
- }
- }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
index ce7954c7fb..702cd906ef 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java
@@ -15,13 +15,11 @@ package com.google.devtools.build.lib.rules.java;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
-import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
@@ -42,7 +40,6 @@ import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.TargetUtils;
import com.google.devtools.build.lib.rules.cpp.CppCompilationContext;
import com.google.devtools.build.lib.rules.cpp.LinkerInput;
-import com.google.devtools.build.lib.rules.java.DirectDependencyProvider.Dependency;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgs.ClasspathType;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector.InstrumentationSpec;
@@ -707,20 +704,6 @@ public class JavaCommon {
return NestedSetBuilder.create(Order.STABLE_ORDER, classJar);
}
- public ImmutableList<Dependency> computeStrictDepsFromJavaAttributes(
- JavaTargetAttributes javaTargetAttributes) {
- Multimap<Label, String> depMap = HashMultimap.<Label, String>create();
- for (Artifact jar : javaTargetAttributes.getDirectJars()) {
- depMap.put(Preconditions.checkNotNull(jar.getOwner()),
- jar.getExecPathString());
- }
- ImmutableList.Builder<Dependency> depOuts = ImmutableList.builder();
- for (Label label : depMap.keySet()) {
- depOuts.add(new Dependency(label, depMap.get(label)));
- }
- return depOuts.build();
- }
-
public ImmutableList<Artifact> getSrcsArtifacts() {
return sources;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
index 7aad5ba86a..d13258c259 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
@@ -265,10 +265,6 @@ public class JavaCompilationHelper extends BaseJavaCompilationHelper {
.setMnemonic("JavaSourceJar")
.build(getRuleContext()));
}
-
- public Artifact getOutputDepsProtoArtifact() {
- return outputDepsProtoArtifact;
- }
/**
* Creates the jdeps file artifact if needed. Returns null if the target can't emit dependency
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index 13457f304a..4496bc743c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -568,8 +568,7 @@ public class JavaCompileAction extends AbstractAction {
// written out and whether we try to minimize the compile-time classpath.
if (strictJavaDeps != BuildConfiguration.StrictDepsMode.OFF) {
result.add("--strict_java_deps");
- result.add((semantics.useStrictJavaDeps(configuration) ? strictJavaDeps
- : BuildConfiguration.StrictDepsMode.OFF).toString());
+ result.add(strictJavaDeps.toString());
result.add(new CustomMultiArgv() {
@Override
public Iterable<String> argv() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
index 16ad9756d5..6695da7fe2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java
@@ -299,12 +299,6 @@ public interface JavaSemantics {
RuleConfiguredTargetBuilder ruleBuilder) throws InterruptedException;
/**
- * Tell if a build with the given configuration should use strict java dependencies. This method
- * enforces strict java dependencies off if it returns false.
- */
- boolean useStrictJavaDeps(BuildConfiguration configuration);
-
- /**
* Translates XMB messages to translations artifact suitable for Java targets.
*/
Collection<Artifact> translate(RuleContext ruleContext, JavaConfiguration javaConfig,