Convert the otatools.zip to soong for jars, cert files and releasetools
- Use "otatools_package_cert_files" to find cert files.
- The jar modules is from $(INTERNAL_OTATOOLS_MODULES_WITH_DEPS).
- The "otatools-package-temp" is temporary. It will be changed as
"otatools-package" after all files are ready in soong.
Bug: 395988167
Test: m dist otatools-package-temp
Change-Id: I473457cbd343473bdbc21874a18565aadd9d37a0
diff --git a/tools/otatools_package/Android.bp b/tools/otatools_package/Android.bp
new file mode 100644
index 0000000..dea3d82
--- /dev/null
+++ b/tools/otatools_package/Android.bp
@@ -0,0 +1,57 @@
+// Copyright (C) 2025 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_genrule_host {
+ name: "otatools_package_dep_jars",
+ tools: ["soong_zip"],
+ compile_multilib: "first",
+ cmd: "mkdir -p $(genDir)/framework && " +
+ "cp $(in) $(genDir)/framework && " +
+ "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/framework",
+ srcs: [
+ ":apksigner",
+ ":boot_signer",
+ ":signapk",
+ ":verity_signer",
+ ],
+ out: ["otatools_package_dep_jars.zip"],
+}
+
+java_genrule_host {
+ name: "otatools_package",
+ tools: ["merge_zips"],
+ compile_multilib: "first",
+ cmd: "$(location merge_zips) $(out) $(in)",
+ srcs: [
+ ":otatools_package_cert_files",
+ ":otatools_package_dep_jars",
+ ":otatools_package_releasetools",
+ ],
+ // TODO: Rename as "otatools.zip" when the rest files are ready.
+ out: ["otatools_temp.zip"],
+ dist: {
+ targets: [
+ "otatools-package-temp",
+ ],
+ },
+}
+
+otatools_package_cert_files {
+ name: "otatools_package_cert_files",
+}
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index 3467152..2232385 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -650,3 +650,12 @@
unit_test: true,
},
}
+
+genrule {
+ name: "otatools_package_releasetools",
+ tools: ["soong_zip"],
+ srcs: ["**/*"],
+ cmd: "find build/make/tools/releasetools -name '*.pyc' -prune -o \\( -type f -o -type l \\) -print | sort > $(genDir)/files.txt && " +
+ "$(location soong_zip) -o $(out) -C build/make/tools -l $(genDir)/files.txt",
+ out: ["otatools_package_releasetools.zip"],
+}