load("//ReactNative:DEFS.bzl", "rn_android_library", "rn_android_resource", "react_native_dep", "rn_prebuilt_jar") # This is a bit messy and hopefully a temporary thing # The problem is that Gradle extracts appcompat resources into app namespace, com.facebook.react # While BUCK behaves properly and extracts them into android.support.v7.appcompat package. # We want to support both Gradle and BUCK builds so we hack a bit how BUCK extracts resources. # Besides that we still need JAVA classes from appcompat-v7.aar, that is why rn_android_library # extracts classes.jar but the trick is that we can't take full appcompat.aar because resources # extracted from it by BUCK would conflict with resources we use under Gradelified package # All this mumbo jumbo will go away after t10182713 rn_android_library( name = "appcompat", visibility = [ "PUBLIC", ], deps = [ ":res-for-appcompat", ], exported_deps = [ ":classes-for-react-native", react_native_dep("third-party/android/support-annotations:android-support-annotations"), ], ) # still used by appcompat library internally, so we need both during the build rn_android_resource( name = "res-for-appcompat", package = "android.support.v7.appcompat", res = ":res-unpacker-cmd", visibility = ["//ReactAndroid/..."], ) rn_prebuilt_jar( name = "classes-for-react-native", binary_jar = ":classes-unpacker-cmd", visibility = ["//ReactAndroid/..."], ) genrule( name = "classes-unpacker-cmd", out = "classes.jar", cmd = "$(exe :aar-unpacker) $(location :appcompat-binary-aar) classes.jar $OUT", ) genrule( name = "res-unpacker-cmd", out = "res", cmd = "$(exe :aar-unpacker) $(location :appcompat-binary-aar) res/ $OUT", visibility = ["//ReactAndroid/..."], ) python_binary( name = "aar-unpacker", main = "aar-unpacker.py", ) remote_file( name = "appcompat-binary-aar", sha1 = "da5771a9ac6e8f3a461360eed3c6f921dc7580fd", url = "mvn:com.android.support:appcompat-v7:aar:26.1.0", )