aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdeInfoProvider.java146
2 files changed, 0 insertions, 162 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
index 4229728f65..5624734808 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
@@ -37,7 +37,6 @@ import com.google.devtools.build.lib.collect.IterablesChain;
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.packages.AggregatingAttributeMapper;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.Info;
@@ -242,7 +241,6 @@ public class AndroidCommon {
public static AndroidIdeInfoProvider createAndroidIdeInfoProvider(
RuleContext ruleContext,
- AndroidSemantics semantics,
AndroidIdlHelper idlHelper,
OutputJar resourceJar,
Artifact aar,
@@ -258,7 +256,6 @@ public class AndroidCommon {
.setAar(aar)
.setNativeLibs(nativeLibs.getMap())
.addIdlImportRoot(idlHelper.getIdlImportRoot())
- .addIdlParcelables(idlHelper.getIdlParcelables())
.addIdlSrcs(idlHelper.getIdlSources())
.addIdlGeneratedJavaFiles(idlHelper.getIdlGeneratedJavaSources())
.addAllApksUnderTest(apksUnderTest);
@@ -271,10 +268,6 @@ public class AndroidCommon {
if (LocalResourceContainer.definesAndroidResources(ruleContext.attributes())) {
ideInfoProviderBuilder
.setDefinesAndroidResources(true)
- .addResourceSources(resourceApk.getPrimaryResource().getArtifacts(ResourceType.RESOURCES))
- .addAssetSources(
- resourceApk.getPrimaryResource().getArtifacts(ResourceType.ASSETS),
- getAssetDir(ruleContext))
// Sets the possibly merged manifest and the raw manifest.
.setGeneratedManifest(resourceApk.getPrimaryResource().getManifest())
.setManifest(ruleContext.getPrerequisiteArtifact("manifest", Mode.TARGET))
@@ -293,14 +286,6 @@ public class AndroidCommon {
return getDefaultJavaPackage(ruleContext.getRule());
}
- public static Iterable<String> getPossibleJavaPackages(Rule rule) {
- AggregatingAttributeMapper attributes = AggregatingAttributeMapper.of(rule);
- if (attributes.isAttributeValueExplicitlySpecified("custom_package")) {
- return attributes.visitAttribute("custom_package", Type.STRING);
- }
- return ImmutableList.of(getDefaultJavaPackage(rule));
- }
-
private static String getDefaultJavaPackage(Rule rule) {
PathFragment nameFragment = rule.getPackage().getNameFragment();
String packageName = JavaUtil.getJavaFullClassname(nameFragment);
@@ -762,7 +747,6 @@ public class AndroidCommon {
AndroidIdeInfoProvider.class,
createAndroidIdeInfoProvider(
ruleContext,
- androidSemantics,
idlHelper,
resourceJar,
aar,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdeInfoProvider.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdeInfoProvider.java
index 85c371cf2d..316c11d69c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdeInfoProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdeInfoProvider.java
@@ -13,98 +13,26 @@
// limitations under the License.
package com.google.devtools.build.lib.rules.android;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider.OutputJar;
-import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
import javax.annotation.Nullable;
/** An Android target provider to provide Android-specific info to IDEs. */
@Immutable
public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
- /** Represents a directory that contains sources, generated or otherwise, for an IDE. */
- @Immutable
- public static class SourceDirectory {
- final PathFragment relativePath;
- final PathFragment rootPath;
- final boolean isSource;
-
- @VisibleForTesting
- public static SourceDirectory fromSourceRoot(PathFragment rootPath, PathFragment relativePath) {
- return new SourceDirectory(rootPath, relativePath, true);
- }
-
- public static SourceDirectory fromRoot(Root root, PathFragment relativePath) {
- return new SourceDirectory(
- root.getPath().asFragment(), relativePath, root.isSourceRoot());
- }
-
- private SourceDirectory(
- PathFragment rootPath,
- PathFragment relativePath,
- boolean isSource) {
- this.rootPath = rootPath;
- this.relativePath = relativePath;
- this.isSource = isSource;
- }
-
- /** The root relative path, {@link Artifact#getRootRelativePath()}. */
- public PathFragment getRelativePath() {
- return relativePath;
- }
-
- /** The absolute path of the root that contains this directory, {@link Root#getPath()}. */
- public PathFragment getRootPath() {
- return rootPath;
- }
-
- /** Indicates if the directory is in the gen files tree. */
- public boolean isSource() {
- return isSource;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(relativePath, rootPath, isSource);
- }
-
- @Override
- public boolean equals(Object other) {
- if (other instanceof SourceDirectory) {
- SourceDirectory otherDir = (SourceDirectory) other;
- return Objects.equals(rootPath, otherDir.rootPath)
- && Objects.equals(relativePath, otherDir.relativePath)
- && Objects.equals(isSource, otherDir.isSource);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "SourceDirectory [relativePath="
- + relativePath
- + ", rootPath="
- + rootPath
- + ", isSource="
- + isSource
- + "]";
- }
- }
/** Builder for {@link AndroidIdeInfoProvider} */
public static class Builder {
@@ -117,9 +45,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
private OutputJar resourceJar = null;
private String javaPackage = null;
private String idlImportRoot = null;
- private final Set<SourceDirectory> resourceDirs = new LinkedHashSet<>();
- private final Set<SourceDirectory> assetDirs = new LinkedHashSet<>();
- private final Set<SourceDirectory> idlDirs = new LinkedHashSet<>();
private final Set<Artifact> idlSrcs = new LinkedHashSet<>();
private final Set<Artifact> idlGeneratedJavaFiles = new LinkedHashSet<>();
private final Set<Artifact> apksUnderTest = new LinkedHashSet<>();
@@ -139,9 +64,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
resourceJar,
definesAndroidResources,
aar,
- ImmutableList.copyOf(assetDirs),
- ImmutableList.copyOf(resourceDirs),
- ImmutableList.copyOf(idlDirs),
ImmutableList.copyOf(idlSrcs),
ImmutableList.copyOf(idlGeneratedJavaFiles),
ImmutableList.copyOf(apksUnderTest),
@@ -219,7 +141,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
/** Add "idl_srcs" contents. */
public Builder addIdlSrcs(Collection<Artifact> idlSrcs) {
this.idlSrcs.addAll(idlSrcs);
- addIdlDirs(idlSrcs);
return this;
}
@@ -229,49 +150,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
return this;
}
- /** Add "idl_parcelables" contents. */
- public Builder addIdlParcelables(Collection<Artifact> idlParcelables) {
- addIdlDirs(idlParcelables);
- return this;
- }
-
- private void addIdlDirs(Collection<Artifact> idlArtifacts) {
- for (Artifact idl : idlArtifacts) {
- this.idlDirs.add(
- SourceDirectory.fromRoot(
- idl.getRoot(), idl.getRootRelativePath().getParentDirectory()));
- }
- }
-
- public Builder addResourceSource(Artifact resource) {
- resourceDirs.add(
- SourceDirectory.fromRoot(
- resource.getRoot(),
- AndroidCommon.getSourceDirectoryRelativePathFromResource(resource)));
- return this;
- }
-
- public Builder addResourceSources(Collection<Artifact> resources) {
- for (Artifact resource : resources) {
- addResourceSource(resource);
- }
- return this;
- }
-
- public Builder addAssetSources(Collection<Artifact> assets, PathFragment assetDir) {
- for (Artifact asset : assets) {
- addAssetSource(asset, assetDir);
- }
- return this;
- }
-
- public Builder addAssetSource(Artifact asset, PathFragment assetDir) {
- assetDirs.add(
- SourceDirectory.fromRoot(
- asset.getRoot(), AndroidCommon.trimTo(asset.getRootRelativePath(), assetDir)));
- return this;
- }
-
public Builder addAllApksUnderTest(Iterable<Artifact> apks) {
Iterables.addAll(apksUnderTest, apks);
return this;
@@ -287,11 +165,8 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
@Nullable private final Artifact idlSourceJar;
@Nullable private final OutputJar resourceJar;
@Nullable private final Artifact resourceApk;
- private final ImmutableCollection<SourceDirectory> resourceDirs;
private final boolean definesAndroidResources;
private final Artifact aar;
- private final ImmutableCollection<SourceDirectory> assetDirs;
- private final ImmutableCollection<SourceDirectory> idlImports;
private final ImmutableCollection<Artifact> idlSrcs;
private final ImmutableCollection<Artifact> idlGeneratedJavaFiles;
private final ImmutableCollection<Artifact> apksUnderTest;
@@ -308,9 +183,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
@Nullable OutputJar resourceJar,
boolean definesAndroidResources,
@Nullable Artifact aar,
- ImmutableCollection<SourceDirectory> assetDirs,
- ImmutableCollection<SourceDirectory> resourceDirs,
- ImmutableCollection<SourceDirectory> idlImports,
ImmutableCollection<Artifact> idlSrcs,
ImmutableCollection<Artifact> idlGeneratedJavaFiles,
ImmutableCollection<Artifact> apksUnderTest,
@@ -326,9 +198,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
this.resourceJar = resourceJar;
this.definesAndroidResources = definesAndroidResources;
this.aar = aar;
- this.assetDirs = assetDirs;
- this.resourceDirs = resourceDirs;
- this.idlImports = idlImports;
this.idlSrcs = idlSrcs;
this.idlGeneratedJavaFiles = idlGeneratedJavaFiles;
this.apksUnderTest = apksUnderTest;
@@ -397,21 +266,6 @@ public final class AndroidIdeInfoProvider implements TransitiveInfoProvider {
return resourceApk;
}
- /** A list of the direct Resource directories. */
- public ImmutableCollection<SourceDirectory> getResourceDirs() {
- return resourceDirs;
- }
-
- /** A list of the direct Asset directories. */
- public ImmutableCollection<SourceDirectory> getAssetDirs() {
- return assetDirs;
- }
-
- /** A list of direct idl directories. */
- public ImmutableCollection<SourceDirectory> getIdlImports() {
- return idlImports;
- }
-
/** A list of sources from the "idl_srcs" attribute. */
public ImmutableCollection<Artifact> getIdlSrcs() {
return idlSrcs;