libcore: java_resource_dirs -> java_resources
Before this CL, core resources were included via java_resource_dirs. This makes
it difficult to add additional individual files / filegroups from elsewhere
(needed for bug 135431432).
This CL uses java_resources instead. Because the luni/ resources are currently
mixed-in with .java source files, whereas ojluni/ resources are in their own
resources/ subdirectory, this CL lists the luni resource paths explicitly but
uses a glob to collect the ojluni/ resources. I have a separate draft CL to
move the luni resources to a resources/ subdirectory, but am not yet sure
whether I should upload it for review.
Bug: 135431432
Test: Checked that the following md5sums don't change as part of this CL:
make core-all core-oj core-libart && md5sum \
out/soong/.intermediates/libcore/core-oj/android_common/withres/core-oj.jar \
out/soong/.intermediates/libcore/core-libart/android_common/withres/core-libart.jar
Change-Id: Ie9f0fcc63c8c2db12011323c2fa549b13f1383a1
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index f446439..824626a 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -45,9 +45,35 @@
]
// The Java files and their associated resources.
-core_resource_dirs = [
- "luni/src/main/java",
- "ojluni/src/main/resources/",
+filegroup {
+ name: "core-luni-resources",
+ visibility: [
+ "//libcore:__subpackages__",
+ ],
+ path: "luni/src/main/java/",
+ srcs: [
+ "luni/src/main/java/libcore/net/mime.types",
+ "luni/src/main/java/libcore/net/android.mime.types",
+ "luni/src/main/java/libcore/net/mime.types.README",
+ "luni/src/main/java/java/util/logging/logging.properties",
+ "luni/src/main/java/java/security/security.properties",
+ ],
+}
+
+filegroup {
+ name: "core-ojluni-resources",
+ visibility: [
+ "//libcore:__subpackages__",
+ ],
+ path: "ojluni/src/main/resources/",
+ srcs: [
+ "ojluni/src/main/resources/**/*",
+ ],
+}
+
+core_resources = [
+ ":core-luni-resources",
+ ":core-ojluni-resources",
]
// The source files that go into core-oj.
@@ -180,7 +206,7 @@
javacflags: ["--patch-module=java.base=."],
},
- java_resource_dirs: core_resource_dirs,
+ java_resources: core_resources,
static_libs: ["android_icu4j_resources_lib"],
java_version: "1.9",
@@ -216,7 +242,7 @@
hostdex: true,
srcs: [":core_oj_java_files"],
- java_resource_dirs: core_resource_dirs,
+ java_resources: core_resources,
sdk_version: "none",
libs: ["core-all"],