File tree Expand file tree Collapse file tree
test/rules/android_binary/r8_integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,18 +62,3 @@ script_test(
6262 ],
6363)
6464
65- script_test (
66- name = "r8_java_resources_integration_test" ,
67- size = "enormous" ,
68- srcs = ["r8_java_resources_integration_test.sh" ],
69- additional_env_inherit = ["ANDROID_HOME" ],
70- bazel_binaries = bazel_binaries ,
71- bazel_version = bazel_binaries .versions .current ,
72- tags = ["manual" ],
73- timeout = "eternal" ,
74- deps = [
75- ":r8_integration_helper" ,
76- "//test/bashunit" ,
77- "@rules_shell//shell/runfiles" ,
78- ],
79- )
Original file line number Diff line number Diff line change 1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- # Integration tests for R8 desugaring with and without --desugar_java8_libs .
17+ # Integration tests for R8 desugaring and Java resource preservation .
1818
1919# --- begin runfiles.bash initialization v2 ---
2020# Copy-pasted from the Bazel Bash runfiles library v2.
@@ -62,4 +62,22 @@ function test_desugaring_disabled() {
6262 fi
6363}
6464
65+ # Test: with --desugar_java8_libs enabled, Java resources from dependency JARs
66+ # must be present in the final APK.
67+ function test_java_resources_preserved_with_desugaring() {
68+ build_app --desugar_java8_libs
69+
70+ apk_contains_file ' com/test/data/metadata.txt' || \
71+ fail " Java resource 'com/test/data/metadata.txt' not found in APK. " \
72+ " DexReducer likely stripped non-.dex entries and java_resource_jar was not set."
73+ }
74+
75+ # Test: without desugaring, Java resources should also be preserved.
76+ function test_java_resources_preserved_without_desugaring() {
77+ build_app --nodesugar_java8_libs
78+
79+ apk_contains_file ' com/test/data/metadata.txt' || \
80+ fail " Java resource 'com/test/data/metadata.txt' not found in APK even without desugaring."
81+ }
82+
6583run_suite " R8 desugaring integration tests"
Original file line number Diff line number Diff line change @@ -41,9 +41,8 @@ function get_rules_android_path() {
4141 if [[ -z " ${module_bazel} " || ! -f " ${module_bazel} " ]]; then
4242 fail " Failed to locate rules_android MODULE.bazel"
4343 fi
44- local real_path
45- real_path=" $( python3 -c " import os; print(os.path.realpath('${module_bazel} '))" ) "
46- dirname " ${real_path} "
44+ # pwd -P resolves symlinks (POSIX built-in, no python3 dependency).
45+ (cd " $( dirname " ${module_bazel} " ) " && pwd -P)
4746}
4847
4948# set_up is called before each test by bashunit. We only initialize the
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments