aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Xie <tedx@google.com>2023-03-13 12:27:00 -0700
committerCopybara-Service <copybara-worker@google.com>2023-03-13 12:27:37 -0700
commit96cfc9e436965ec3a1597af99ed5037d77a183b2 (patch)
treec6879d8798002ab206eef8cba4a67de08161f021
parent3ccac9bd5cb5da91c00bb3589902f4bc3bbd95ba (diff)
downloadbazelbuild-rules_android-96cfc9e436965ec3a1597af99ed5037d77a183b2.tar.gz
Reorganize AK command map in ak.go
Part of #12 PiperOrigin-RevId: 516288377 Change-Id: Ie2fd65aacbbe7a879a3a29da77da2eba930c2791
-rw-r--r--src/tools/ak/BUILD45
-rw-r--r--src/tools/ak/akcommands.go56
2 files changed, 84 insertions, 17 deletions
diff --git a/src/tools/ak/BUILD b/src/tools/ak/BUILD
index 985575f..51d524f 100644
--- a/src/tools/ak/BUILD
+++ b/src/tools/ak/BUILD
@@ -9,26 +9,13 @@ licenses(["notice"])
go_binary(
name = "ak",
- srcs = ["ak.go"],
+ srcs = [
+ "ak.go",
+ ],
deps = [
+ ":akcommands",
":types",
"//src/common/golang:flagfile",
- "//src/tools/ak/bucketize",
- "//src/tools/ak/compile",
- "//src/tools/ak/dex",
- "//src/tools/ak/extractaar",
- "//src/tools/ak/finalrjar",
- "//src/tools/ak/generatemanifest",
- "//src/tools/ak/link",
- "//src/tools/ak/liteparse",
- "//src/tools/ak/manifest",
- "//src/tools/ak/mindex",
- "//src/tools/ak/nativelib",
- "//src/tools/ak/patch",
- "//src/tools/ak/repack",
- "//src/tools/ak/rjar",
- "//src/tools/ak/rstub",
- "//src/tools/ak/shellapk",
],
)
@@ -52,3 +39,27 @@ go_library(
"//src/common/golang:xml2",
],
)
+
+go_library(
+ name = "akcommands",
+ srcs = ["akcommands.go"],
+ importpath = "src/tools/ak/akcommands",
+ deps = [
+ ":types",
+ "//src/tools/ak/bucketize",
+ "//src/tools/ak/compile",
+ "//src/tools/ak/dex",
+ "//src/tools/ak/extractaar",
+ "//src/tools/ak/finalrjar",
+ "//src/tools/ak/generatemanifest",
+ "//src/tools/ak/link",
+ "//src/tools/ak/liteparse",
+ "//src/tools/ak/manifest",
+ "//src/tools/ak/mindex",
+ "//src/tools/ak/nativelib",
+ "//src/tools/ak/patch",
+ "//src/tools/ak/repack",
+ "//src/tools/ak/rjar",
+ "//src/tools/ak/shellapk",
+ ],
+)
diff --git a/src/tools/ak/akcommands.go b/src/tools/ak/akcommands.go
new file mode 100644
index 0000000..7a100ca
--- /dev/null
+++ b/src/tools/ak/akcommands.go
@@ -0,0 +1,56 @@
+// Copyright 2023 The Bazel Authors. All rights reserved.
+//
+// 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 akcommands provides a map of all AK commands to their respective binaries.
+package akcommands
+
+import (
+ "src/tools/ak/bucketize/bucketize"
+ "src/tools/ak/compile/compile"
+ "src/tools/ak/dex/dex"
+ "src/tools/ak/extractaar/extractaar"
+ "src/tools/ak/finalrjar/finalrjar"
+ "src/tools/ak/generatemanifest/generatemanifest"
+ "src/tools/ak/link/link"
+ "src/tools/ak/liteparse/liteparse"
+ "src/tools/ak/manifest/manifest"
+ "src/tools/ak/mindex/mindex"
+ "src/tools/ak/nativelib/nativelib"
+ "src/tools/ak/patch/patch"
+ "src/tools/ak/repack/repack"
+ "src/tools/ak/rjar/rjar"
+ "src/tools/ak/shellapk/shellapk"
+ "src/tools/ak/types"
+)
+
+var (
+ // Cmds map AK commands to their respective binaries
+ Cmds = map[string]types.Command{
+ "bucketize": bucketize.Cmd,
+ "compile": compile.Cmd,
+ "dex": dex.Cmd,
+ "extractaar": extractaar.Cmd,
+ "link": link.Cmd,
+ "liteparse": liteparse.Cmd,
+ "generatemanifest": generatemanifest.Cmd,
+ "manifest": manifest.Cmd,
+ "mindex": mindex.Cmd,
+ "nativelib": nativelib.Cmd,
+ "patch": patch.Cmd,
+ "repack": repack.Cmd,
+ "rjar": rjar.Cmd,
+ "finalrjar": finalrjar.Cmd,
+ "shellapk": shellapk.Cmd,
+ }
+)