From 5b4ffaec96af206624a95692cbda4ea20d6a64a0 Mon Sep 17 00:00:00 2001 From: Lukacs Berki Date: Tue, 16 Jun 2015 12:18:13 +0000 Subject: This CL adds the android_binary rule to Bazel. Note that despite the rule being present, Android support is still not functional: two tools (//tools/android:{aar_generator,resources_processor} are still missing (and are a-coming!) -- MOS_MIGRATED_REVID=96099045 --- .../com/google/devtools/build/lib/Constants.java | 2 +- .../lib/bazel/rules/BazelRuleClassProvider.java | 23 +++++++++++++++++++++- .../lib/bazel/rules/android/android.WORKSPACE | 4 ---- 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/google/devtools/build') diff --git a/src/main/java/com/google/devtools/build/lib/Constants.java b/src/main/java/com/google/devtools/build/lib/Constants.java index 60d21869c1..0b97f5e406 100644 --- a/src/main/java/com/google/devtools/build/lib/Constants.java +++ b/src/main/java/com/google/devtools/build/lib/Constants.java @@ -87,7 +87,7 @@ public class Constants { */ public static final ImmutableSet IOS_DEVICE_RULE_CLASSES = ImmutableSet.of("ios_device"); - public static final String ANDROID_DEFAULT_SDK = "//external:android_sdk".toString(); + public static final String ANDROID_DEFAULT_SDK = "//external:android/sdk".toString(); public static final boolean ANDROID_ALLOW_SDK_FILEGROUP = Boolean.valueOf(false); public static final String ANDROID_DEP_PREFIX = "//external:android/".toString(); } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java index e15ed200d0..e8a6d656ed 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java @@ -32,6 +32,8 @@ import com.google.devtools.build.lib.analysis.config.InvalidConfigurationExcepti import com.google.devtools.build.lib.analysis.constraints.EnvironmentRule; import com.google.devtools.build.lib.bazel.rules.android.AndroidNdkRepositoryRule; import com.google.devtools.build.lib.bazel.rules.android.AndroidSdkRepositoryRule; +import com.google.devtools.build.lib.bazel.rules.android.BazelAndroidBinaryRule; +import com.google.devtools.build.lib.bazel.rules.android.BazelAndroidSemantics; import com.google.devtools.build.lib.bazel.rules.common.BazelActionListenerRule; import com.google.devtools.build.lib.bazel.rules.common.BazelExtraActionRule; import com.google.devtools.build.lib.bazel.rules.common.BazelFilegroupRule; @@ -66,7 +68,11 @@ import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.packages.PackageGroup; import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.Target; +import com.google.devtools.build.lib.rules.android.AndroidBinaryOnlyRule; +import com.google.devtools.build.lib.rules.android.AndroidConfiguration; +import com.google.devtools.build.lib.rules.android.AndroidRuleClasses; import com.google.devtools.build.lib.rules.cpp.CcToolchainRule; +import com.google.devtools.build.lib.rules.cpp.CcToolchainSuiteRule; import com.google.devtools.build.lib.rules.cpp.CppBuildInfo; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.cpp.CppConfigurationLoader; @@ -191,7 +197,8 @@ public class BazelRuleClassProvider { PythonOptions.class, BazelPythonConfiguration.Options.class, ObjcCommandLineOptions.class, - J2ObjcCommandLineOptions.class + J2ObjcCommandLineOptions.class, + AndroidConfiguration.Options.class ); /** @@ -240,6 +247,7 @@ public class BazelRuleClassProvider { builder.addRuleDefinition(new BazelShTestRule()); builder.addRuleDefinition(new CcToolchainRule()); + builder.addRuleDefinition(new CcToolchainSuiteRule()); builder.addRuleDefinition(new BazelCppRuleClasses.CcLinkingRule()); builder.addRuleDefinition(new BazelCppRuleClasses.CcDeclRule()); builder.addRuleDefinition(new BazelCppRuleClasses.CcBaseRule()); @@ -259,6 +267,8 @@ public class BazelRuleClassProvider { try { builder.addWorkspaceFile( ResourceFileLoader.loadResource(BazelJavaRuleClasses.class, "jdk.WORKSPACE")); + builder.addWorkspaceFile( + ResourceFileLoader.loadResource(BazelAndroidSemantics.class, "android.WORKSPACE")); } catch (IOException e) { throw new IllegalStateException(e); } @@ -275,6 +285,16 @@ public class BazelRuleClassProvider { builder.addRuleDefinition(new BazelJavaPluginRule()); builder.addRuleDefinition(new JavaToolchainRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidSdkRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidToolsDefaultsJarRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidBaseRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidAaptBaseRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidResourceSupportRule()); + builder.addRuleDefinition(new AndroidRuleClasses.AndroidBinaryBaseRule()); + builder.addRuleDefinition(new AndroidRuleClasses.JackRule()); + builder.addRuleDefinition(new AndroidBinaryOnlyRule()); + builder.addRuleDefinition(new BazelAndroidBinaryRule()); + builder.addRuleDefinition(new BazelIosTestRule()); builder.addRuleDefinition(new ExperimentalIosTestRule()); builder.addRuleDefinition(new IosDeviceRule()); @@ -328,5 +348,6 @@ public class BazelRuleClassProvider { builder.addConfigurationFragment(new JavaConfigurationLoader(JAVA_CPU_SUPPLIER)); builder.addConfigurationFragment(new ObjcConfigurationLoader()); builder.addConfigurationFragment(new J2ObjcConfiguration.Loader()); + builder.addConfigurationFragment(new AndroidConfiguration.Loader()); } } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE index 94b80edcf1..a3f4130589 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE @@ -13,7 +13,3 @@ bind(name = "android/shuffle_jars", actual = "//tools/android:shuffle_jars") bind(name = "android/merge_dexzips", actual = "//tools/android:merge_dexzips") bind(name = "android/debug_keystore", actual = "//tools/android:debug_keystore") bind(name = "android/sdk", actual = "//tools/android:sdk") - - - - -- cgit v1.2.3