Skip to content

Commit

Permalink
Use remap_paths to android_tools
Browse files Browse the repository at this point in the history
This ensures that the `all_android_tools_deploy.jar` and `ImportDepsChecker_deploy.jar` artifacts end up in the root of the `tar` where `exports_files` is able to reference them.

Before this PR the tar had the following directory structure:
```
  ./
  ./BUILD
  ./WORKSPACE
  ./desugar_jdk_libs.jar
  ./version.txt
  ./src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ImportDepsChecker_deploy.jar
  ./src/tools/android/java/com/google/devtools/build/android/all_android_tools_deploy.jar
```

After:
```
  BUILD
  ImportDepsChecker_deploy.jar
  WORKSPACE
  all_android_tools_deploy.jar
  desugar_jdk_libs.jar
  version.txt
```

Closes #17187.

PiperOrigin-RevId: 501862387
Change-Id: Ida51fa3f0bd3b07d3106653e5292a90cac143b68
  • Loading branch information
Bencodes authored and ahumesky committed Jul 6, 2023
1 parent ebff138 commit b7a79ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/test/shell/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ gen_workspace_stanza(
"rules_cc",
"rules_java",
"rules_license",
"rules_pkg",
"rules_proto",
],
template = "testenv.sh.tmpl",
Expand Down
9 changes: 9 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
EOF
}

function add_rules_pkg_to_workspace() {
cat >> "$1"<<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
{rules_pkg}
EOF
}

function add_rules_proto_to_workspace() {
cat >> "$1"<<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand All @@ -575,6 +583,7 @@ EOF
add_rules_cc_to_workspace "WORKSPACE"
add_rules_java_to_workspace "WORKSPACE"
add_rules_license_to_workspace "WORKSPACE"
add_rules_pkg_to_workspace "WORKSPACE"
add_rules_proto_to_workspace "WORKSPACE"

maybe_setup_python_windows_workspace
Expand Down
6 changes: 5 additions & 1 deletion tools/android/runtime_deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# extract all Android rules and tools out of Bazel and into rules_android
# and tools_android.

load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

filegroup(
name = "srcs",
Expand Down Expand Up @@ -84,5 +84,9 @@ pkg_tar(
"//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:ImportDepsChecker_deploy.jar",
"//src/tools/android/java/com/google/devtools/build/android:all_android_tools_deploy.jar",
],
remap_paths = {
"src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:ImportDepsChecker_deploy.jar": "ImportDepsChecker_deploy.jar",
"src/tools/android/java/com/google/devtools/build/android:all_android_tools_deploy.jar": "all_android_tools_deploy.jar",
},
visibility = ["//src/test/shell/bazel:__subpackages__"],
)

0 comments on commit b7a79ff

Please sign in to comment.