Skip to content

Commit 9d2efab

Browse files
committed
Merge the tests into a single target
1 parent 8d79c2c commit 9d2efab

4 files changed

Lines changed: 21 additions & 70 deletions

File tree

test/rules/android_binary/r8_integration/BUILD

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff 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-
)

test/rules/android_binary/r8_integration/r8_desugaring_integration_test.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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+
6583
run_suite "R8 desugaring integration tests"

test/rules/android_binary/r8_integration/r8_integration_helper.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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

test/rules/android_binary/r8_integration/r8_java_resources_integration_test.sh

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)