aboutsummaryrefslogtreecommitdiff
path: root/rules/resources.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'rules/resources.bzl')
-rw-r--r--rules/resources.bzl20
1 files changed, 10 insertions, 10 deletions
diff --git a/rules/resources.bzl b/rules/resources.bzl
index 9bebb87..2ad89c6 100644
--- a/rules/resources.bzl
+++ b/rules/resources.bzl
@@ -60,11 +60,6 @@ _ASSET_DEFINITION_ERROR = (
"both empty or non-empty."
)
-_JAVA_PACKAGE_MISSING_ERROR = (
- "In target %s, a java package is required when stamping " +
- "the manifest."
-)
-
_INCORRECT_RESOURCE_LAYOUT_ERROR = (
"'%s' is not in the expected resource directory structure of " +
"<resource directory>/{%s}/<file>" % (",").join(_RESOURCE_FOLDER_TYPES)
@@ -139,7 +134,7 @@ def _generate_dummy_manifest(
min_sdk_version = None):
content = """<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="%s">""" % java_package
+ package="%s">""" % (java_package or "com.default")
if min_sdk_version:
content = content + """
@@ -316,6 +311,7 @@ def _fix_databinding_compiled_resources(
ctx: The context.
out_compiled_resources: File. The modified compiled_resources output.
compiled_resources: File. The compiled_resources zip.
+ zip_tool: FilesToRunProvider. The zip tool executable or FilesToRunProvider
"""
ctx.actions.run_shell(
outputs = [out_compiled_resources],
@@ -420,6 +416,7 @@ def _package(
resource_files = [],
nocompress_extensions = [],
java_package = None,
+ package_id = None,
compilation_mode = _compilation_mode.FASTBUILD,
shrink_resources = None,
use_android_resource_shrinking = None,
@@ -460,6 +457,11 @@ def _package(
java_package: String. Java package for which java sources will be
generated. By default the package is inferred from the directory where
the BUILD file containing the rule is.
+ package_id: An optional integer in [2,255]. This is the prefix byte for
+ all generated resource IDs, defaults to 0x7F (127). 1 is reserved by the
+ framework, and some builds are known to crash when given IDs > 127.
+ Shared libraries are also assigned monotonically increasing IDs in
+ [2,126], so care should be taken that there is room at the lower end.
compilation_mode: String. A string that represents compilation mode. The
list of expected values are as follows: dbg, fastbuild, opt.
shrink_resources: Tristate. Whether resource shrinking is enabled by the rule.
@@ -579,7 +581,7 @@ def _package(
processed_resources = resource_files
data_binding_layout_info = None
if enable_data_binding:
- data_binding_layout_info = ctx.actions.declare_file("_migrated/databinding/" + ctx.label.name + "/layout-info.zip")
+ data_binding_layout_info = ctx.actions.declare_file("_migrated/" + ctx.label.name + "/layout-info.zip")
processed_resources, resources_dirname = _make_databinding_outputs(
ctx,
resource_files,
@@ -620,6 +622,7 @@ def _package(
out_main_dex_proguard_cfg = main_dex_proguard_cfg,
out_resource_files_zip = resource_files_zip,
application_id = manifest_values.get("applicationId", None),
+ package_id = package_id,
manifest = merged_manifest,
assets = assets,
assets_dir = assets_dir,
@@ -1092,9 +1095,6 @@ def _process_starlark(
if resource_files and not manifest:
_log.error(_MANIFEST_MISSING_ERROR % ctx.label)
- if stamp_manifest and not java_package:
- _log.error(_JAVA_PACKAGE_MISSING_ERROR % ctx.label)
-
direct_resources_nodes = []
transitive_resources_nodes = []
transitive_assets = []