Skip to content

Commit

Permalink
Automated rollback of commit 7c13f90.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 667742703
Change-Id: I46bbf09a90f281bd978ecff2fc2cc4ccb1926359
  • Loading branch information
ahumesky authored and copybara-github committed Aug 26, 2024
1 parent 2d3b7f4 commit e252d3c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
38 changes: 27 additions & 11 deletions rules/data_binding.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ def _get_javac_opts(
deps):
java_packages = []
for info in deps:
for label_and_java_package in info.label_and_java_packages:
java_packages.append(label_and_java_package.java_package)
java_packages.extend(info.java_packages)

javac_opts = []
javac_opts.append("-Aandroid.databinding.dependencyArtifactsDir=" +
Expand All @@ -167,6 +166,12 @@ def _get_javac_opts(
javac_opts.append("-Aandroid.databinding.layoutInfoDir=" + layout_info_path)
return javac_opts

def _merge_lists(lists):
merged = []
for sublist in lists:
merged.extend(sublist)
return merged

def _process(
ctx,
resources_ctx = None,
Expand Down Expand Up @@ -224,8 +229,12 @@ def _process(
if not enable_data_binding:
db_info[_PROVIDERS] = [
DataBindingV2Info(
databinding_v2_providers_in_deps = deps,
databinding_v2_providers_in_exports = exports,
setter_stores = depset(transitive = [info.setter_stores for info in exports]),
class_infos = depset(transitive = [info.class_infos for info in exports]),
transitive_br_files = depset(transitive =
[info.transitive_br_files for info in deps] +
[info.transitive_br_files for info in exports]),
java_packages = _merge_lists([info.java_packages for info in exports]),
),
]
return struct(**db_info)
Expand Down Expand Up @@ -293,13 +302,20 @@ def _process(

db_info[_PROVIDERS] = [
DataBindingV2Info(
setter_store_file = setter_store_out,
class_info_file = class_info,
br_file = br_out,
label = str(ctx.label),
java_package = java_package,
databinding_v2_providers_in_deps = deps,
databinding_v2_providers_in_exports = exports,
setter_stores = depset(
direct = [setter_store_out] if setter_store_out else [],
transitive = [info.setter_stores for info in exports],
),
class_infos = depset(
direct = [class_info] if class_info else [],
transitive = [info.class_infos for info in exports],
),
transitive_br_files = depset(
direct = [br_out] if br_out else [],
transitive = [info.transitive_br_files for info in deps] +
[info.transitive_br_files for info in exports],
),
java_packages = [java_package] + _merge_lists([info.java_packages for info in exports]),
),
]

Expand Down
11 changes: 10 additions & 1 deletion rules/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,20 @@ ProguardMappingInfo = provider(
),
)

DataBindingV2Info = provider(
doc = "DataBindingV2Info",
fields = dict(
class_infos = "",
setter_stores = "",
transitive_br_files = "",
java_packages = "List of the Java packages of this rule and any rules that this rule exports.",
),
)

# 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
AndroidSdkInfo = providers.AndroidSdkInfo
AndroidManifestInfo = providers.AndroidManifestInfo
AndroidAssetsInfo = providers.AndroidAssetsInfo
AndroidIdeInfo = providers.AndroidIdeInfo
DataBindingV2Info = providers.DataBindingV2Info
1 change: 0 additions & 1 deletion rules/reexport_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ providers = struct(
AndroidManifestInfo = AndroidManifestInfo,
AndroidAssetsInfo = AndroidAssetsInfo,
AndroidIdeInfo = AndroidIdeInfo,
DataBindingV2Info = DataBindingV2Info,
)

0 comments on commit e252d3c

Please sign in to comment.