Skip to content

Commit

Permalink
Remove references to native and soon-to-be-deleted `AndroidResourcesI…
Browse files Browse the repository at this point in the history
…nfo`, `AndroidAssestInfo`, and `AnroidManifestInfo`. These are no longer provided from `android_library` or other rules. Use `StarlarkAndroidResourcesInfo` instead.

PiperOrigin-RevId: 676166498
Change-Id: Iec80b80584c84641683fecc72d8ee5ee281963b6
  • Loading branch information
ahumesky authored and copybara-github committed Sep 18, 2024
1 parent dc7e1ab commit e2153a4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 62 deletions.
88 changes: 43 additions & 45 deletions providers/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""Bazel providers for Android rules."""

load("//providers:reexport_providers.bzl", "providers")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")

visibility(PROJECT_VISIBILITY)
Expand Down Expand Up @@ -403,45 +402,45 @@ AndroidIdeInfo, _AndroidIdeInfo_raw = provider(

# buildifier: disable=unused-variable
def _AndroidSdkInfo_init(
build_tools_version,
framework_aidl,
aidl_lib,
android_jar,
source_properties,
shrinked_android_jar,
main_dex_classes,
adb,
dx,
main_dex_list_creator,
aidl,
aapt,
aapt2,
apk_builder,
apk_signer,
proguard,
zip_align,
system, # not used
legacy_main_dex_list_generator):
return {
"android_jar": android_jar,
"legacy_main_dex_list_generator": legacy_main_dex_list_generator,
"zip_align": zip_align,
"proguard": proguard,
"apk_signer": apk_signer,
"apk_builder": apk_builder,
"aapt2": aapt2,
"aapt": aapt,
"aidl": aidl,
"main_dex_list_creator": main_dex_list_creator,
"dx": dx,
"adb": adb,
"main_dex_classes": main_dex_classes,
"shrinked_android_jar": shrinked_android_jar,
"source_properties": source_properties,
"aidl_lib": aidl_lib,
"framework_aidl": framework_aidl,
"build_tools_version": build_tools_version,
}
build_tools_version,
framework_aidl,
aidl_lib,
android_jar,
source_properties,
shrinked_android_jar,
main_dex_classes,
adb,
dx,
main_dex_list_creator,
aidl,
aapt,
aapt2,
apk_builder,
apk_signer,
proguard,
zip_align,
system, # not used
legacy_main_dex_list_generator):
return {
"android_jar": android_jar,
"legacy_main_dex_list_generator": legacy_main_dex_list_generator,
"zip_align": zip_align,
"proguard": proguard,
"apk_signer": apk_signer,
"apk_builder": apk_builder,
"aapt2": aapt2,
"aapt": aapt,
"aidl": aidl,
"main_dex_list_creator": main_dex_list_creator,
"dx": dx,
"adb": adb,
"main_dex_classes": main_dex_classes,
"shrinked_android_jar": shrinked_android_jar,
"source_properties": source_properties,
"aidl_lib": aidl_lib,
"framework_aidl": framework_aidl,
"build_tools_version": build_tools_version,
}

# buildifier: disable=name-conventions
AndroidSdkInfo, _AndroidSdkInfo_raw = provider(
Expand Down Expand Up @@ -469,8 +468,7 @@ AndroidSdkInfo, _AndroidSdkInfo_raw = provider(
),
)

# Native defined providers which will be gradually migrated to Starlark.
# We re-export these here so that all our providers can be loaded from this file.
AndroidResourcesInfo = providers.AndroidResourcesInfo
AndroidManifestInfo = providers.AndroidManifestInfo
AndroidAssetsInfo = providers.AndroidAssetsInfo
# Keep these symobols until rules/providers.bzl is deleted from release.
AndroidResourcesInfo = None
AndroidManifestInfo = None
AndroidAssetsInfo = None
3 changes: 0 additions & 3 deletions providers/reexport_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@ load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
visibility(PROJECT_VISIBILITY)

providers = struct(
AndroidResourcesInfo = AndroidResourcesInfo,
AndroidManifestInfo = AndroidManifestInfo,
AndroidAssetsInfo = AndroidAssetsInfo,
)
1 change: 0 additions & 1 deletion rules/android_binary/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ DEPS_ALLOW_RULES = [
DEPS_PROVIDERS = [
[CcInfo],
[JavaInfo],
["AndroidResourcesInfo", "AndroidAssetsInfo"],
]

DEPS_ASPECTS = [
Expand Down
6 changes: 0 additions & 6 deletions rules/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@

load(
"//providers:providers.bzl",
_AndroidAssetsInfo = "AndroidAssetsInfo",
_AndroidBundleInfo = "AndroidBundleInfo",
_AndroidDeviceInfo = "AndroidDeviceInfo",
_AndroidDeviceScriptFixtureInfo = "AndroidDeviceScriptFixtureInfo",
_AndroidHostServiceFixtureInfo = "AndroidHostServiceFixtureInfo",
_AndroidIdeInfo = "AndroidIdeInfo",
_AndroidInstrumentationInfo = "AndroidInstrumentationInfo",
_AndroidLibraryAarInfo = "AndroidLibraryAarInfo",
_AndroidManifestInfo = "AndroidManifestInfo",
_AndroidNativeLibsInfo = "AndroidNativeLibsInfo",
_AndroidResourcesInfo = "AndroidResourcesInfo",
_AndroidSdkInfo = "AndroidSdkInfo",
_ApkInfo = "ApkInfo",
_Dex2OatApkInfo = "Dex2OatApkInfo",
Expand All @@ -38,17 +35,14 @@ load("//rules:visibility.bzl", "PROJECT_VISIBILITY")

visibility(PROJECT_VISIBILITY)

AndroidAssetsInfo = _AndroidAssetsInfo
AndroidBundleInfo = _AndroidBundleInfo
AndroidDeviceInfo = _AndroidDeviceInfo
AndroidDeviceScriptFixtureInfo = _AndroidDeviceScriptFixtureInfo
AndroidHostServiceFixtureInfo = _AndroidHostServiceFixtureInfo
AndroidIdeInfo = _AndroidIdeInfo
AndroidInstrumentationInfo = _AndroidInstrumentationInfo
AndroidLibraryAarInfo = _AndroidLibraryAarInfo
AndroidManifestInfo = _AndroidManifestInfo
AndroidNativeLibsInfo = _AndroidNativeLibsInfo
AndroidResourcesInfo = _AndroidResourcesInfo
AndroidSdkInfo = _AndroidSdkInfo
ApkInfo = _ApkInfo
Dex2OatApkInfo = _Dex2OatApkInfo
Expand Down
7 changes: 0 additions & 7 deletions rules/resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ _VERSION_CODE = "versionCode"
_MIN_SDK_VERSION = "minSdkVersion"

# Resources context attributes.
_ASSETS_PROVIDER = "assets_provider"
_DATA_BINDING_LAYOUT_INFO = "data_binding_layout_info"
_DEFINES_RESOURCES = "defines_resources"
_DIRECT_ANDROID_RESOURCES = "direct_android_resources"
Expand All @@ -79,7 +78,6 @@ _R_JAVA = "r_java"
_RESOURCES_APK = "resources_apk"
_VALIDATION_RESULTS = "validation_results"
_VALIDATION_OUTPUTS = "validation_outputs"
_RESOURCES_PROVIDER = "resources_provider"
_STARLARK_PROCESSED_MANIFEST = "starlark_processed_manifest"
_STARLARK_R_TXT = "starlark_r_txt"
_STARLARK_PROCESSED_RESOURCES = "starlark_processed_resources"
Expand All @@ -96,11 +94,6 @@ _ResourcesProcessContextInfo = provider(
_RESOURCES_APK: "ResourcesApk.",
_VALIDATION_RESULTS: "List of validation results.",
_VALIDATION_OUTPUTS: "List of outputs given to OutputGroupInfo _validation group",

# TODO(djwhang): The android_library aar generation requires direct
# access to providers. Remove once aar is its own rule.
_ASSETS_PROVIDER: "AndroidAssetsInfo provider.",
_RESOURCES_PROVIDER: "AndroidResourcesInfo provider.",
_STARLARK_PROCESSED_MANIFEST: "The processed manifest from the starlark resource processing pipeline.",
_STARLARK_R_TXT: "The R.txt from the starlark resource processing pipeline.",
_STARLARK_PROCESSED_RESOURCES: "The processed resources from the starlark processing pipeline.",
Expand Down

0 comments on commit e2153a4

Please sign in to comment.