summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/Android.bp115
-rw-r--r--tools/aapt/Android.mk90
-rw-r--r--tools/aapt/Command.cpp18
-rw-r--r--tools/aapt/Images.cpp6
-rw-r--r--tools/aapt/Main.cpp17
-rw-r--r--tools/aapt2/Android.bp16
-rw-r--r--tools/aapt2/compile/Png.cpp6
-rw-r--r--tools/aapt2/link/ManifestFixer.cpp1
-rw-r--r--tools/bit/Android.bp45
-rw-r--r--tools/bit/Android.mk44
-rw-r--r--tools/bit/adb.cpp4
-rw-r--r--tools/bit/adb.h2
-rw-r--r--tools/bit/command.cpp6
-rw-r--r--tools/bit/main.cpp21
-rw-r--r--tools/bit/make.cpp29
-rw-r--r--tools/bit/make.h2
-rw-r--r--tools/bit/util.cpp5
-rw-r--r--tools/incident_report/Android.bp35
-rw-r--r--tools/incident_report/Android.mk41
-rw-r--r--tools/incident_report/printer.cpp1
-rw-r--r--tools/incident_section_gen/Android.bp33
-rw-r--r--tools/incident_section_gen/Android.mk35
-rw-r--r--tools/locked_region_code_injection/Android.bp12
-rw-r--r--tools/locked_region_code_injection/Android.mk15
-rw-r--r--tools/locked_region_code_injection/src/lockedregioncodeinjection/LockFindingClassVisitor.java25
-rw-r--r--tools/locked_region_code_injection/src/lockedregioncodeinjection/Utils.java2
-rw-r--r--tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java29
-rw-r--r--tools/locked_region_code_injection/test/lockedregioncodeinjection/TestTarget.java12
-rw-r--r--tools/obbtool/Android.bp51
-rw-r--r--tools/obbtool/Android.mk47
-rw-r--r--tools/split-select/Android.bp108
-rw-r--r--tools/split-select/Android.mk119
-rw-r--r--tools/streaming_proto/Android.bp29
-rw-r--r--tools/streaming_proto/Android.mk13
-rw-r--r--tools/validatekeymaps/Android.bp30
-rw-r--r--tools/validatekeymaps/Android.mk33
36 files changed, 589 insertions, 508 deletions
diff --git a/tools/aapt/Android.bp b/tools/aapt/Android.bp
new file mode 100644
index 000000000000..e26c9c3fdf63
--- /dev/null
+++ b/tools/aapt/Android.bp
@@ -0,0 +1,115 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// ==========================================================
+// Setup some common variables for the different build
+// targets here.
+// ==========================================================
+
+cc_defaults {
+ name: "aapt_defaults",
+
+ static_libs: [
+ "libandroidfw",
+ "libpng",
+ "libutils",
+ "liblog",
+ "libcutils",
+ "libexpat",
+ "libziparchive",
+ "libbase",
+ "libz",
+ ],
+ group_static_libs: true,
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+
+ // This tool is prebuilt if we're doing an app-only build.
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
+
+// ==========================================================
+// Build the host static library: libaapt
+// ==========================================================
+cc_library_host_static {
+ name: "libaapt",
+ defaults: ["aapt_defaults"],
+ target: {
+ darwin: {
+ cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
+ },
+ },
+ cflags: [
+ "-Wno-format-y2k",
+ "-DSTATIC_ANDROIDFW_FOR_TOOLS",
+ ],
+
+ srcs: [
+ "AaptAssets.cpp",
+ "AaptConfig.cpp",
+ "AaptUtil.cpp",
+ "AaptXml.cpp",
+ "ApkBuilder.cpp",
+ "Command.cpp",
+ "CrunchCache.cpp",
+ "FileFinder.cpp",
+ "Images.cpp",
+ "Package.cpp",
+ "pseudolocalize.cpp",
+ "Resource.cpp",
+ "ResourceFilter.cpp",
+ "ResourceIdCache.cpp",
+ "ResourceTable.cpp",
+ "SourcePos.cpp",
+ "StringPool.cpp",
+ "WorkQueue.cpp",
+ "XMLNode.cpp",
+ "ZipEntry.cpp",
+ "ZipFile.cpp",
+ ],
+}
+
+// ==========================================================
+// Build the host tests: libaapt_tests
+// ==========================================================
+cc_test_host {
+ name: "libaapt_tests",
+ defaults: ["aapt_defaults"],
+ srcs: [
+ "tests/AaptConfig_test.cpp",
+ "tests/AaptGroupEntry_test.cpp",
+ "tests/Pseudolocales_test.cpp",
+ "tests/ResourceFilter_test.cpp",
+ "tests/ResourceTable_test.cpp",
+ ],
+ static_libs: ["libaapt"],
+}
diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk
index 04f46d9b27fc..7bcf631da652 100644
--- a/tools/aapt/Android.mk
+++ b/tools/aapt/Android.mk
@@ -14,7 +14,6 @@
# limitations under the License.
#
-# This tool is prebuilt if we're doing an app-only build.
ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
# ==========================================================
@@ -23,37 +22,6 @@ ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
# ==========================================================
LOCAL_PATH:= $(call my-dir)
-aaptMain := Main.cpp
-aaptSources := \
- AaptAssets.cpp \
- AaptConfig.cpp \
- AaptUtil.cpp \
- AaptXml.cpp \
- ApkBuilder.cpp \
- Command.cpp \
- CrunchCache.cpp \
- FileFinder.cpp \
- Images.cpp \
- Package.cpp \
- pseudolocalize.cpp \
- Resource.cpp \
- ResourceFilter.cpp \
- ResourceIdCache.cpp \
- ResourceTable.cpp \
- SourcePos.cpp \
- StringPool.cpp \
- WorkQueue.cpp \
- XMLNode.cpp \
- ZipEntry.cpp \
- ZipFile.cpp
-
-aaptTests := \
- tests/AaptConfig_test.cpp \
- tests/AaptGroupEntry_test.cpp \
- tests/Pseudolocales_test.cpp \
- tests/ResourceFilter_test.cpp \
- tests/ResourceTable_test.cpp
-
aaptHostStaticLibs := \
libandroidfw \
libpng \
@@ -62,35 +30,10 @@ aaptHostStaticLibs := \
libcutils \
libexpat \
libziparchive \
- libbase
-
-aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\"
-aaptCFlags += -Wall -Werror
+ libbase \
+ libz
-aaptHostLdLibs_linux := -lrt -ldl -lpthread
-
-# Statically link libz for MinGW (Win SDK under Linux),
-# and dynamically link for all others.
-aaptHostStaticLibs_windows := libz
-aaptHostLdLibs_linux += -lz
-aaptHostLdLibs_darwin := -lz
-
-
-# ==========================================================
-# Build the host static library: libaapt
-# ==========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libaapt
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_CFLAGS := -Wno-format-y2k -DSTATIC_ANDROIDFW_FOR_TOOLS $(aaptCFlags)
-LOCAL_CPPFLAGS := $(aaptCppFlags)
-LOCAL_CFLAGS_darwin := -D_DARWIN_UNLIMITED_STREAMS
-LOCAL_SRC_FILES := $(aaptSources)
-LOCAL_STATIC_LIBRARIES := $(aaptHostStaticLibs)
-LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
-
-include $(BUILD_HOST_STATIC_LIBRARY)
+aaptCFlags := -Wall -Werror
# ==========================================================
# Build the host executable: aapt
@@ -99,33 +42,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := aapt
LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_CFLAGS := $(aaptCFlags)
-LOCAL_CPPFLAGS := $(aaptCppFlags)
-LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
-LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
-LOCAL_SRC_FILES := $(aaptMain)
+LOCAL_CFLAGS := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\" $(aaptCFlags)
+LOCAL_SRC_FILES := Main.cpp
LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
-LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
include $(BUILD_HOST_EXECUTABLE)
-
-# ==========================================================
-# Build the host tests: libaapt_tests
-# ==========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libaapt_tests
-LOCAL_CFLAGS := $(aaptCFlags)
-LOCAL_CPPFLAGS := $(aaptCppFlags)
-LOCAL_LDLIBS_darwin := $(aaptHostLdLibs_darwin)
-LOCAL_LDLIBS_linux := $(aaptHostLdLibs_linux)
-LOCAL_SRC_FILES := $(aaptTests)
-LOCAL_C_INCLUDES := $(LOCAL_PATH)
-LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs)
-LOCAL_STATIC_LIBRARIES_windows := $(aaptHostStaticLibs_windows)
-
-include $(BUILD_HOST_NATIVE_TEST)
-
-
endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 63f1802fdf2e..cb87737c6868 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -29,24 +29,6 @@
using namespace android;
-#ifndef AAPT_VERSION
- #define AAPT_VERSION ""
-#endif
-
-/*
- * Show version info. All the cool kids do it.
- */
-int doVersion(Bundle* bundle)
-{
- if (bundle->getFileSpecCount() != 0) {
- printf("(ignoring extra arguments)\n");
- }
- printf("Android Asset Packaging Tool, v0.2-" AAPT_VERSION "\n");
-
- return 0;
-}
-
-
/*
* Open the file read only. The call fails if the file doesn't exist.
*
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 5f586a15eeb8..627a231de5c8 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -1246,7 +1246,7 @@ static void write_png(const char* imageName,
if (kIsDebug) {
printf("Adding 9-patch info...\n");
}
- strcpy((char*)unknowns[p_index].name, "npTc");
+ memcpy((char*)unknowns[p_index].name, "npTc", 5);
unknowns[p_index].data = (png_byte*)imageInfo.serialize9patch();
unknowns[p_index].size = imageInfo.info9Patch.serializedSize();
// TODO: remove the check below when everything works
@@ -1254,7 +1254,7 @@ static void write_png(const char* imageName,
// automatically generated 9 patch outline data
int chunk_size = sizeof(png_uint_32) * 6;
- strcpy((char*)unknowns[o_index].name, "npOl");
+ memcpy((char*)unknowns[o_index].name, "npOl", 5);
unknowns[o_index].data = (png_byte*) calloc(chunk_size, 1);
png_byte outputData[chunk_size];
memcpy(&outputData, &imageInfo.outlineInsetsLeft, 4 * sizeof(png_uint_32));
@@ -1266,7 +1266,7 @@ static void write_png(const char* imageName,
// optional optical inset / layout bounds data
if (imageInfo.haveLayoutBounds) {
int chunk_size = sizeof(png_uint_32) * 4;
- strcpy((char*)unknowns[b_index].name, "npLb");
+ memcpy((char*)unknowns[b_index].name, "npLb", 5);
unknowns[b_index].data = (png_byte*) calloc(chunk_size, 1);
memcpy(unknowns[b_index].data, &imageInfo.layoutBoundsLeft, chunk_size);
unknowns[b_index].size = chunk_size;
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 417b7ae087e1..d714687ee914 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -20,6 +20,23 @@ using namespace android;
static const char* gProgName = "aapt";
+#ifndef AAPT_VERSION
+ #define AAPT_VERSION ""
+#endif
+
+/*
+ * Show version info. All the cool kids do it.
+ */
+int doVersion(Bundle* bundle)
+{
+ if (bundle->getFileSpecCount() != 0) {
+ printf("(ignoring extra arguments)\n");
+ }
+ printf("Android Asset Packaging Tool, v0.2-" AAPT_VERSION "\n");
+
+ return 0;
+}
+
/*
* When running under Cygwin on Windows, this will convert slash-based
* paths into back-slash-based ones. Otherwise the ApptAssets file comparisons
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index 76225748009f..ade638d2c422 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -24,7 +24,7 @@ toolSources = [
]
cc_defaults {
- name: "aapt_defaults",
+ name: "aapt2_defaults",
cflags: [
"-Wall",
"-Werror",
@@ -39,14 +39,9 @@ cc_defaults {
windows: {
enabled: true,
cflags: ["-Wno-maybe-uninitialized"],
- static_libs: ["libz"],
},
darwin: {
cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
- host_ldlibs: ["-lz"],
- },
- linux: {
- host_ldlibs: ["-lz"],
},
},
static_libs: [
@@ -59,6 +54,7 @@ cc_defaults {
"libpng",
"libbase",
"libprotobuf-cpp-lite",
+ "libz",
],
group_static_libs: true,
}
@@ -148,7 +144,7 @@ cc_library_host_static {
proto: {
export_proto_headers: true,
},
- defaults: ["aapt_defaults"],
+ defaults: ["aapt2_defaults"],
}
// ==========================================================
@@ -158,7 +154,7 @@ cc_library_host_shared {
name: "libaapt2_jni",
srcs: toolSources + ["jni/aapt2_jni.cpp"],
static_libs: ["libaapt2"],
- defaults: ["aapt_defaults"],
+ defaults: ["aapt2_defaults"],
}
// ==========================================================
@@ -175,7 +171,7 @@ cc_test_host {
"libaapt2",
"libgmock",
],
- defaults: ["aapt_defaults"],
+ defaults: ["aapt2_defaults"],
}
// ==========================================================
@@ -185,5 +181,5 @@ cc_binary_host {
name: "aapt2",
srcs: ["Main.cpp"] + toolSources,
static_libs: ["libaapt2"],
- defaults: ["aapt_defaults"],
+ defaults: ["aapt2_defaults"],
}
diff --git a/tools/aapt2/compile/Png.cpp b/tools/aapt2/compile/Png.cpp
index 6d6147d8c97a..33122dccb7de 100644
--- a/tools/aapt2/compile/Png.cpp
+++ b/tools/aapt2/compile/Png.cpp
@@ -538,7 +538,7 @@ static bool writePng(IDiagnostics* diag, png_structp writePtr,
if (kDebug) {
diag->Note(DiagMessage() << "adding 9-patch info..");
}
- strcpy((char*)unknowns[pIndex].name, "npTc");
+ memcpy((char*)unknowns[pIndex].name, "npTc", 5);
unknowns[pIndex].data = (png_byte*)info->serialize9Patch();
unknowns[pIndex].size = info->info9Patch.serializedSize();
// TODO: remove the check below when everything works
@@ -546,7 +546,7 @@ static bool writePng(IDiagnostics* diag, png_structp writePtr,
// automatically generated 9 patch outline data
int chunkSize = sizeof(png_uint_32) * 6;
- strcpy((char*)unknowns[oIndex].name, "npOl");
+ memcpy((char*)unknowns[oIndex].name, "npOl", 5);
unknowns[oIndex].data = (png_byte*)calloc(chunkSize, 1);
png_byte outputData[chunkSize];
memcpy(&outputData, &info->outlineInsetsLeft, 4 * sizeof(png_uint_32));
@@ -558,7 +558,7 @@ static bool writePng(IDiagnostics* diag, png_structp writePtr,
// optional optical inset / layout bounds data
if (info->haveLayoutBounds) {
int chunkSize = sizeof(png_uint_32) * 4;
- strcpy((char*)unknowns[bIndex].name, "npLb");
+ memcpy((char*)unknowns[bIndex].name, "npLb", 5);
unknowns[bIndex].data = (png_byte*)calloc(chunkSize, 1);
memcpy(unknowns[bIndex].data, &info->layoutBoundsLeft, chunkSize);
unknowns[bIndex].size = chunkSize;
diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp
index a0ffefad1e1c..6fb1793d90ed 100644
--- a/tools/aapt2/link/ManifestFixer.cpp
+++ b/tools/aapt2/link/ManifestFixer.cpp
@@ -293,6 +293,7 @@ bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,
manifest_action["instrumentation"]["meta-data"] = meta_data_action;
manifest_action["original-package"];
+ manifest_action["overlay"];
manifest_action["protected-broadcast"];
manifest_action["uses-permission"];
manifest_action["uses-permission-sdk-23"];
diff --git a/tools/bit/Android.bp b/tools/bit/Android.bp
new file mode 100644
index 000000000000..a8062719d586
--- /dev/null
+++ b/tools/bit/Android.bp
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2015 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.
+//
+
+// ==========================================================
+// Build the host executable: bit
+// ==========================================================
+cc_binary_host {
+ name: "bit",
+
+ srcs: [
+ "aapt.cpp",
+ "adb.cpp",
+ "command.cpp",
+ "main.cpp",
+ "make.cpp",
+ "print.cpp",
+ "util.cpp",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ static_libs: [
+ "libexpat",
+ "libinstrumentation",
+ "libjsoncpp",
+ ],
+
+ shared_libs: ["libprotobuf-cpp-full"],
+}
diff --git a/tools/bit/Android.mk b/tools/bit/Android.mk
deleted file mode 100644
index 57f46d490f24..000000000000
--- a/tools/bit/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2015 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.
-#
-LOCAL_PATH:= $(call my-dir)
-
-# ==========================================================
-# Build the host executable: protoc-gen-javastream
-# ==========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bit
-
-LOCAL_MODULE_HOST_OS := linux darwin
-
-LOCAL_SRC_FILES := \
- aapt.cpp \
- adb.cpp \
- command.cpp \
- main.cpp \
- make.cpp \
- print.cpp \
- util.cpp
-
-LOCAL_STATIC_LIBRARIES := \
- libexpat \
- libinstrumentation \
- libjsoncpp
-
-LOCAL_SHARED_LIBRARIES := \
- libprotobuf-cpp-full
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/bit/adb.cpp b/tools/bit/adb.cpp
index c8faf5c66722..fa7d3d4031d4 100644
--- a/tools/bit/adb.cpp
+++ b/tools/bit/adb.cpp
@@ -302,7 +302,9 @@ run_instrumentation_test(const string& packageName, const string& runner, const
print_command(cmd);
int fds[2];
- pipe(fds);
+ if (0 != pipe(fds)) {
+ return errno;
+ }
pid_t pid = fork();
diff --git a/tools/bit/adb.h b/tools/bit/adb.h
index dca80c853b45..f0774db933ba 100644
--- a/tools/bit/adb.h
+++ b/tools/bit/adb.h
@@ -17,7 +17,7 @@
#ifndef ADB_H
#define ADB_H
-#include "instrumentation_data.pb.h"
+#include "proto/instrumentation_data.pb.h"
#include <string>
diff --git a/tools/bit/command.cpp b/tools/bit/command.cpp
index 9a8449bf9356..f95ea117a96e 100644
--- a/tools/bit/command.cpp
+++ b/tools/bit/command.cpp
@@ -105,7 +105,9 @@ get_command_output(const Command& command, int* err, bool quiet)
}
int fds[2];
- pipe(fds);
+ if (0 != pipe(fds)) {
+ return string();
+ }
pid_t pid = fork();
@@ -187,7 +189,7 @@ run_command(const Command& command)
int
exec_with_path_search(const char* prog, char const* const* argv, char const* const* envp)
{
- if (prog[0] == '/') {
+ if (strchr(prog, '/') != NULL) {
return execve(prog, (char*const*)argv, (char*const*)envp);
} else {
char* pathEnv = strdup(getenv("PATH"));
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index 91ca5143965e..a71cea1c44f9 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -596,6 +596,15 @@ check_device_property(const string& property, const string& expected)
}
}
+static void
+chdir_or_exit(const char *path) {
+ // TODO: print_command("cd", path);
+ if (0 != chdir(path)) {
+ print_error("Error: Could not chdir: %s", path);
+ exit(1);
+ }
+}
+
/**
* Run the build, install, and test actions.
*/
@@ -614,12 +623,12 @@ run_phases(vector<Target*> targets, const Options& options)
const string buildProduct = get_required_env("TARGET_PRODUCT", false);
const string buildVariant = get_required_env("TARGET_BUILD_VARIANT", false);
const string buildType = get_required_env("TARGET_BUILD_TYPE", false);
- const string buildDevice = get_build_var(buildTop, "TARGET_DEVICE", false);
- const string buildId = get_build_var(buildTop, "BUILD_ID", false);
- const string buildOut = get_out_dir();
- // TODO: print_command("cd", buildTop.c_str());
- chdir(buildTop.c_str());
+ chdir_or_exit(buildTop.c_str());
+
+ const string buildDevice = get_build_var("TARGET_DEVICE", false);
+ const string buildId = get_build_var("BUILD_ID", false);
+ const string buildOut = get_out_dir();
// Get the modules for the targets
map<string,Module> modules;
@@ -999,7 +1008,7 @@ run_tab_completion(const string& word)
const string buildProduct = get_required_env("TARGET_PRODUCT", false);
const string buildOut = get_out_dir();
- chdir(buildTop.c_str());
+ chdir_or_exit(buildTop.c_str());
string buildDevice = sniff_device_name(buildOut, buildProduct);
diff --git a/tools/bit/make.cpp b/tools/bit/make.cpp
index a8002417b916..ef3ccc541589 100644
--- a/tools/bit/make.cpp
+++ b/tools/bit/make.cpp
@@ -36,31 +36,16 @@ using namespace std;
map<string,string> g_buildVars;
-static unsigned int
-get_thread_count()
-{
- unsigned int threads = std::thread::hardware_concurrency();
- // Guess if the value cannot be computed
- return threads == 0 ? 4 : static_cast<unsigned int>(threads * 1.3f);
-}
-
string
-get_build_var(const string& buildTop, const string& name, bool quiet)
+get_build_var(const string& name, bool quiet)
{
int err;
map<string,string>::iterator it = g_buildVars.find(name);
if (it == g_buildVars.end()) {
- Command cmd("make");
- cmd.AddArg("--no-print-directory");
- cmd.AddArg(string("-j") + std::to_string(get_thread_count()));
- cmd.AddArg("-C");
- cmd.AddArg(buildTop);
- cmd.AddArg("-f");
- cmd.AddArg("build/core/config.mk");
- cmd.AddArg(string("dumpvar-") + name);
- cmd.AddEnv("CALLED_FROM_SETUP", "true");
- cmd.AddEnv("BUILD_SYSTEM", "build/core");
+ Command cmd("build/soong/soong_ui.bash");
+ cmd.AddArg("--dumpvar-mode");
+ cmd.AddArg(name);
string output = trim(get_command_output(cmd, &err, quiet));
if (err == 0) {
@@ -208,10 +193,8 @@ read_modules(const string& buildOut, const string& device, map<string,Module>* r
int
build_goals(const vector<string>& goals)
{
- Command cmd("make");
- cmd.AddArg(string("-j") + std::to_string(get_thread_count()));
- cmd.AddArg("-f");
- cmd.AddArg("build/core/main.mk");
+ Command cmd("build/soong/soong_ui.bash");
+ cmd.AddArg("--make-mode");
for (size_t i=0; i<goals.size(); i++) {
cmd.AddArg(goals[i]);
}
diff --git a/tools/bit/make.h b/tools/bit/make.h
index bb83c6e14226..1c9504d62d46 100644
--- a/tools/bit/make.h
+++ b/tools/bit/make.h
@@ -31,7 +31,7 @@ struct Module
vector<string> installed;
};
-string get_build_var(const string& buildTop, const string& name, bool quiet);
+string get_build_var(const string& name, bool quiet);
/**
* Poke around in the out directory and try to find a device name that matches
diff --git a/tools/bit/util.cpp b/tools/bit/util.cpp
index fc93bcb8c935..922393146b10 100644
--- a/tools/bit/util.cpp
+++ b/tools/bit/util.cpp
@@ -101,7 +101,6 @@ TrackedFile::HasChanged() const
void
get_directory_contents(const string& name, map<string,FileInfo>* results)
{
- int err;
DIR* dir = opendir(name.c_str());
if (dir == NULL) {
return;
@@ -241,7 +240,9 @@ read_file(const string& filename)
fseek(file, 0, SEEK_SET);
char* buf = (char*)malloc(size);
- fread(buf, 1, size, file);
+ if ((size_t) size != fread(buf, 1, size, file)) {
+ return string();
+ }
string result(buf, size);
diff --git a/tools/incident_report/Android.bp b/tools/incident_report/Android.bp
new file mode 100644
index 000000000000..f2d0d0f3e553
--- /dev/null
+++ b/tools/incident_report/Android.bp
@@ -0,0 +1,35 @@
+//
+// Copyright (C) 2015 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.
+//
+
+// ==========================================================
+// Build the host executable: incident_report
+// ==========================================================
+cc_binary_host {
+ name: "incident_report",
+
+ srcs: [
+ "generic_message.cpp",
+ "main.cpp",
+ "printer.cpp",
+ ],
+
+ shared_libs: [
+ "libplatformprotos",
+ "libprotobuf-cpp-full",
+ ],
+
+ cflags: ["-Wall", "-Werror"],
+}
diff --git a/tools/incident_report/Android.mk b/tools/incident_report/Android.mk
deleted file mode 100644
index 9e56e3d7eeaf..000000000000
--- a/tools/incident_report/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Copyright (C) 2015 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.
-#
-LOCAL_PATH:= $(call my-dir)
-
-# ==========================================================
-# Build the host executable: protoc-gen-javastream
-# ==========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := incident_report
-
-LOCAL_C_INCLUDES := \
- external/protobuf/src
-
-LOCAL_SRC_FILES := \
- generic_message.cpp \
- main.cpp \
- printer.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libplatformprotos \
- libprotobuf-cpp-full
-
-LOCAL_C_FLAGS := \
- -Wno-unused-parameter
-include $(BUILD_HOST_EXECUTABLE)
-
-
diff --git a/tools/incident_report/printer.cpp b/tools/incident_report/printer.cpp
index bd660dd20dfd..bff1025ad8da 100644
--- a/tools/incident_report/printer.cpp
+++ b/tools/incident_report/printer.cpp
@@ -70,7 +70,6 @@ Out::printf(const char* format, ...)
len = vsnprintf(mBuf, mBufSize, format, args);
va_end(args);
- bool truncated = (len >= mBufSize) && (reallocate(len) < len);
va_start(args, format);
len = vsnprintf(mBuf, mBufSize, format, args);
diff --git a/tools/incident_section_gen/Android.bp b/tools/incident_section_gen/Android.bp
new file mode 100644
index 000000000000..f07445a17781
--- /dev/null
+++ b/tools/incident_section_gen/Android.bp
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2015 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.
+//
+
+// ==========================================================
+// Build the host executable: incident-section-gen
+// ==========================================================
+cc_binary_host {
+ name: "incident-section-gen",
+ cflags: [
+ "-g",
+ "-O0",
+ "-Wall",
+ "-Werror",
+ ],
+ srcs: ["main.cpp"],
+ shared_libs: [
+ "libplatformprotos",
+ "libprotobuf-cpp-full",
+ ],
+}
diff --git a/tools/incident_section_gen/Android.mk b/tools/incident_section_gen/Android.mk
deleted file mode 100644
index acf3f8327b5c..000000000000
--- a/tools/incident_section_gen/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Copyright (C) 2015 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.
-#
-LOCAL_PATH:= $(call my-dir)
-
-# ==========================================================
-# Build the host executable: protoc-gen-javastream
-# ==========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := incident-section-gen
-LOCAL_CFLAGS += -g -O0
-LOCAL_C_INCLUDES := \
- external/protobuf/src
-LOCAL_SRC_FILES := \
- main.cpp
-LOCAL_LDFLAGS := -ldl
-LOCAL_SHARED_LIBRARIES := \
- libplatformprotos \
- libprotobuf-cpp-full
-
-include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/tools/locked_region_code_injection/Android.bp b/tools/locked_region_code_injection/Android.bp
new file mode 100644
index 000000000000..6dd6059dcc4f
--- /dev/null
+++ b/tools/locked_region_code_injection/Android.bp
@@ -0,0 +1,12 @@
+java_library_host {
+ name: "lockedregioncodeinjection",
+ manifest: "manifest.txt",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "asm-6.0",
+ "asm-commons-6.0",
+ "asm-tree-6.0",
+ "asm-analysis-6.0",
+ "guava-21.0",
+ ],
+}
diff --git a/tools/locked_region_code_injection/Android.mk b/tools/locked_region_code_injection/Android.mk
deleted file mode 100644
index 0aed0cec27ab..000000000000
--- a/tools/locked_region_code_injection/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_JAR_MANIFEST := manifest.txt
-LOCAL_MODULE := lockedregioncodeinjection
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_STATIC_JAVA_LIBRARIES := \
- asm-5.2 \
- asm-commons-5.2 \
- asm-tree-5.2 \
- asm-analysis-5.2
-
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/locked_region_code_injection/src/lockedregioncodeinjection/LockFindingClassVisitor.java b/tools/locked_region_code_injection/src/lockedregioncodeinjection/LockFindingClassVisitor.java
index 9374f23c945e..ee0e36c9f76e 100644
--- a/tools/locked_region_code_injection/src/lockedregioncodeinjection/LockFindingClassVisitor.java
+++ b/tools/locked_region_code_injection/src/lockedregioncodeinjection/LockFindingClassVisitor.java
@@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.TryCatchBlockSorter;
@@ -32,6 +33,10 @@ import org.objectweb.asm.tree.analysis.AnalyzerException;
import org.objectweb.asm.tree.analysis.BasicValue;
import org.objectweb.asm.tree.analysis.Frame;
+import static com.google.common.base.Preconditions.checkElementIndex;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
/**
* This visitor does two things:
*
@@ -71,7 +76,7 @@ class LockFindingClassVisitor extends ClassVisitor {
private MethodVisitor chain;
public LockFindingMethodVisitor(String owner, MethodNode mn, MethodVisitor chain) {
- super(Opcodes.ASM5, mn);
+ super(Utils.ASM_VERSION, mn);
assert owner != null;
this.owner = owner;
this.chain = chain;
@@ -140,10 +145,26 @@ class LockFindingClassVisitor extends ClassVisitor {
if (operand instanceof LockTargetState) {
LockTargetState state = (LockTargetState) operand;
for (int j = 0; j < state.getTargets().size(); j++) {
+ // The instruction after a monitor_exit should be a label for the end of the implicit
+ // catch block that surrounds the synchronized block to call monitor_exit when an exception
+ // occurs.
+ checkState(instructions.get(i + 1).getType() == AbstractInsnNode.LABEL,
+ "Expected to find label after monitor exit");
+
+ int labelIndex = i + 1;
+ checkElementIndex(labelIndex, instructions.size());
+
+ LabelNode label = (LabelNode)instructions.get(labelIndex);
+
+ checkNotNull(handlersMap.get(i));
+ checkElementIndex(0, handlersMap.get(i).size());
+ checkState(handlersMap.get(i).get(0).end == label,
+ "Expected label to be the end of monitor exit's try block");
+
LockTarget target = state.getTargets().get(j);
MethodInsnNode call = new MethodInsnNode(Opcodes.INVOKESTATIC,
target.getPostOwner(), target.getPostMethod(), "()V", false);
- insertMethodCallAfter(mn, frameMap, handlersMap, s, i, call);
+ insertMethodCallAfter(mn, frameMap, handlersMap, label, labelIndex, call);
}
}
}
diff --git a/tools/locked_region_code_injection/src/lockedregioncodeinjection/Utils.java b/tools/locked_region_code_injection/src/lockedregioncodeinjection/Utils.java
index d2a2e7b90f2b..219c2b3a2fec 100644
--- a/tools/locked_region_code_injection/src/lockedregioncodeinjection/Utils.java
+++ b/tools/locked_region_code_injection/src/lockedregioncodeinjection/Utils.java
@@ -19,7 +19,7 @@ import org.objectweb.asm.Opcodes;
public class Utils {
- public static final int ASM_VERSION = Opcodes.ASM5;
+ public static final int ASM_VERSION = Opcodes.ASM6;
/**
* Reads a comma separated configuration similar to the Jack definition.
diff --git a/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java
index 1d4f2d455270..c408b9e99c32 100644
--- a/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java
+++ b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java
@@ -23,11 +23,14 @@ import org.junit.Test;
* <code>
* set -x
*
+ * croot frameworks/base/tools/locked_region_code_injection
+ *
* # Clean
+ * mkdir -p out
* rm -fr out/*
*
* # Make booster
- * javac -cp lib/asm-all-5.2.jar src&#47;*&#47;*.java -d out/
+ * javac -cp lib/asm-6.0_BETA.jar:lib/asm-commons-6.0_BETA.jar:lib/asm-tree-6.0_BETA.jar:lib/asm-analysis-6.0_BETA.jar:lib/guava-21.0.jar src&#47;*&#47;*.java -d out/
* pushd out
* jar cfe lockedregioncodeinjection.jar lockedregioncodeinjection.Main *&#47;*.class
* popd
@@ -40,7 +43,7 @@ import org.junit.Test;
* popd
*
* # Run tool on unit tests.
- * java -ea -cp lib/asm-all-5.2.jar:out/lockedregioncodeinjection.jar \
+ * java -ea -cp lib/asm-6.0_BETA.jar:lib/asm-commons-6.0_BETA.jar:lib/asm-tree-6.0_BETA.jar:lib/asm-analysis-6.0_BETA.jar:lib/guava-21.0.jar:out/lockedregioncodeinjection.jar \
* lockedregioncodeinjection.Main \
* -i out/test_input.jar -o out/test_output.jar \
* --targets 'Llockedregioncodeinjection/TestTarget;' \
@@ -228,4 +231,26 @@ public class TestMain {
Assert.assertEquals(TestTarget.unboostCount, 1);
Assert.assertEquals(TestTarget.invokeCount, 1);
}
+
+ @Test
+ public void testUnboostThatThrows() {
+ TestTarget.resetCount();
+ TestTarget t = new TestTarget();
+ boolean asserted = false;
+
+ Assert.assertEquals(TestTarget.boostCount, 0);
+ Assert.assertEquals(TestTarget.unboostCount, 0);
+
+ try {
+ t.synchronizedThrowsOnUnboost();
+ } catch (RuntimeException e) {
+ asserted = true;
+ }
+
+ Assert.assertEquals(asserted, true);
+ Assert.assertEquals(TestTarget.boostCount, 1);
+ Assert.assertEquals(TestTarget.unboostCount, 0);
+ Assert.assertEquals(TestTarget.invokeCount, 1);
+ }
+
}
diff --git a/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestTarget.java b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestTarget.java
index 8e7d478a0e29..d1c8f340a598 100644
--- a/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestTarget.java
+++ b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestTarget.java
@@ -17,12 +17,17 @@ public class TestTarget {
public static int boostCount = 0;
public static int unboostCount = 0;
public static int invokeCount = 0;
+ public static boolean nextUnboostThrows = false;
public static void boost() {
boostCount++;
}
public static void unboost() {
+ if (nextUnboostThrows) {
+ nextUnboostThrows = false;
+ throw new RuntimeException();
+ }
unboostCount++;
}
@@ -49,4 +54,11 @@ public class TestTarget {
invoke();
return this;
}
+
+ public void synchronizedThrowsOnUnboost() {
+ nextUnboostThrows = true;
+ synchronized(this) {
+ invoke();
+ }
+ }
}
diff --git a/tools/obbtool/Android.bp b/tools/obbtool/Android.bp
new file mode 100644
index 000000000000..f87965860ce1
--- /dev/null
+++ b/tools/obbtool/Android.bp
@@ -0,0 +1,51 @@
+//
+// Copyright 2010 The Android Open Source Project
+//
+// Opaque Binary Blob (OBB) Tool
+//
+
+cc_binary_host {
+ name: "obbtool",
+
+ srcs: ["Main.cpp"],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-mismatched-tags",
+ ],
+
+ static_libs: [
+ "libandroidfw",
+ "libutils",
+ "libcutils",
+ "liblog",
+ ],
+
+ // This tool is prebuilt if we're doing an app-only build.
+ product_variables: {
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
+
+//####################################################
+cc_binary_host {
+ name: "pbkdf2gen",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-mismatched-tags",
+ ],
+ srcs: ["pbkdf2gen.cpp"],
+ static_libs: ["libcrypto"],
+
+ // This tool is prebuilt if we're doing an app-only build.
+ product_variables: {
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
diff --git a/tools/obbtool/Android.mk b/tools/obbtool/Android.mk
deleted file mode 100644
index 6dc306e85bc6..000000000000
--- a/tools/obbtool/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright 2010 The Android Open Source Project
-#
-# Opaque Binary Blob (OBB) Tool
-#
-
-# This tool is prebuilt if we're doing an app-only build.
-ifeq ($(TARGET_BUILD_APPS),)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- Main.cpp
-
-LOCAL_CFLAGS := -Wall -Werror -Wno-mismatched-tags
-
-#LOCAL_C_INCLUDES +=
-
-LOCAL_STATIC_LIBRARIES := \
- libandroidfw \
- libutils \
- libcutils \
- liblog
-
-ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -ldl -lpthread
-endif
-
-LOCAL_MODULE := obbtool
-
-include $(BUILD_HOST_EXECUTABLE)
-
-#####################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := pbkdf2gen
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wall -Werror -Wno-mismatched-tags
-LOCAL_SRC_FILES := pbkdf2gen.cpp
-LOCAL_LDLIBS += -ldl
-LOCAL_STATIC_LIBRARIES := libcrypto
-
-include $(BUILD_HOST_EXECUTABLE)
-
-#######################################################
-endif # TARGET_BUILD_APPS
diff --git a/tools/split-select/Android.bp b/tools/split-select/Android.bp
new file mode 100644
index 000000000000..ee822b7d7fa7
--- /dev/null
+++ b/tools/split-select/Android.bp
@@ -0,0 +1,108 @@
+//
+// Copyright (C) 2014 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.
+//
+
+// ==========================================================
+// Setup some common variables for the different build
+// targets here.
+// ==========================================================
+
+cc_defaults {
+ name: "split-select_defaults",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ include_dirs: ["frameworks/base/tools"],
+ static_libs: [
+ "libaapt",
+ "libandroidfw",
+ "libpng",
+ "libutils",
+ "liblog",
+ "libcutils",
+ "libexpat",
+ "libziparchive",
+ "libbase",
+ "libz",
+ ],
+ group_static_libs: true,
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+
+ // This tool is prebuilt if we're doing an app-only build.
+ product_variables: {
+ pdk: {
+ enabled: false,
+ },
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
+
+// ==========================================================
+// Build the host static library: libsplit-select
+// ==========================================================
+cc_library_host_static {
+ name: "libsplit-select",
+ defaults: ["split-select_defaults"],
+
+ srcs: [
+ "Abi.cpp",
+ "Grouper.cpp",
+ "Rule.cpp",
+ "RuleGenerator.cpp",
+ "SplitDescription.cpp",
+ "SplitSelector.cpp",
+ ],
+ cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
+
+}
+
+// ==========================================================
+// Build the host tests: libsplit-select_tests
+// ==========================================================
+cc_test_host {
+ name: "libsplit-select_tests",
+ defaults: ["split-select_defaults"],
+
+ srcs: [
+ "Grouper_test.cpp",
+ "Rule_test.cpp",
+ "RuleGenerator_test.cpp",
+ "SplitSelector_test.cpp",
+ "TestRules.cpp",
+ ],
+
+ static_libs: ["libsplit-select"],
+
+}
+
+// ==========================================================
+// Build the host executable: split-select
+// ==========================================================
+cc_binary_host {
+ name: "split-select",
+ defaults: ["split-select_defaults"],
+ srcs: ["Main.cpp"],
+
+ static_libs: ["libsplit-select"],
+}
diff --git a/tools/split-select/Android.mk b/tools/split-select/Android.mk
deleted file mode 100644
index 4a1511eae43a..000000000000
--- a/tools/split-select/Android.mk
+++ /dev/null
@@ -1,119 +0,0 @@
-#
-# Copyright (C) 2014 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.
-#
-
-# This tool is prebuilt if we're doing an app-only build.
-ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),)
-
-# ==========================================================
-# Setup some common variables for the different build
-# targets here.
-# ==========================================================
-LOCAL_PATH:= $(call my-dir)
-
-main := Main.cpp
-sources := \
- Abi.cpp \
- Grouper.cpp \
- Rule.cpp \
- RuleGenerator.cpp \
- SplitDescription.cpp \
- SplitSelector.cpp
-
-testSources := \
- Grouper_test.cpp \
- Rule_test.cpp \
- RuleGenerator_test.cpp \
- SplitSelector_test.cpp \
- TestRules.cpp
-
-cIncludes := \
- external/zlib \
- frameworks/base/tools
-
-hostStaticLibs := \
- libaapt \
- libandroidfw \
- libpng \
- libutils \
- liblog \
- libcutils \
- libexpat \
- libziparchive \
- libbase
-
-cFlags := -Wall -Werror
-
-hostLdLibs_linux := -lrt -ldl -lpthread
-
-# Statically link libz for MinGW (Win SDK under Linux),
-# and dynamically link for all others.
-hostStaticLibs_windows := libz
-hostLdLibs_darwin := -lz
-hostLdLibs_linux += -lz
-
-
-# ==========================================================
-# Build the host static library: libsplit-select
-# ==========================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := libsplit-select
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-LOCAL_SRC_FILES := $(sources)
-LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
-LOCAL_C_INCLUDES := $(cIncludes)
-LOCAL_CFLAGS := $(cFlags) -D_DARWIN_UNLIMITED_STREAMS
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-
-# ==========================================================
-# Build the host tests: libsplit-select_tests
-# ==========================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := libsplit-select_tests
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(testSources)
-
-LOCAL_C_INCLUDES := $(cIncludes)
-LOCAL_STATIC_LIBRARIES := libsplit-select $(hostStaticLibs)
-LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
-LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
-LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
-LOCAL_CFLAGS := $(cFlags)
-
-include $(BUILD_HOST_NATIVE_TEST)
-
-# ==========================================================
-# Build the host executable: split-select
-# ==========================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := split-select
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-LOCAL_SRC_FILES := $(main)
-
-LOCAL_C_INCLUDES := $(cIncludes)
-LOCAL_STATIC_LIBRARIES := libsplit-select $(hostStaticLibs)
-LOCAL_STATIC_LIBRARIES_windows := $(hostStaticLibs_windows)
-LOCAL_LDLIBS_darwin := $(hostLdLibs_darwin)
-LOCAL_LDLIBS_linux := $(hostLdLibs_linux)
-LOCAL_CFLAGS := $(cFlags)
-
-include $(BUILD_HOST_EXECUTABLE)
-
-endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK
diff --git a/tools/streaming_proto/Android.bp b/tools/streaming_proto/Android.bp
new file mode 100644
index 000000000000..24068e9ffe92
--- /dev/null
+++ b/tools/streaming_proto/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2015 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.
+//
+
+// ==========================================================
+// Build the host executable: protoc-gen-javastream
+// ==========================================================
+cc_binary_host {
+ name: "protoc-gen-javastream",
+ srcs: [
+ "Errors.cpp",
+ "string_utils.cpp",
+ "main.cpp",
+ ],
+
+ shared_libs: ["libprotoc"],
+}
diff --git a/tools/streaming_proto/Android.mk b/tools/streaming_proto/Android.mk
index 5a54fd10415d..ebb77a197883 100644
--- a/tools/streaming_proto/Android.mk
+++ b/tools/streaming_proto/Android.mk
@@ -16,19 +16,6 @@
LOCAL_PATH:= $(call my-dir)
# ==========================================================
-# Build the host executable: protoc-gen-javastream
-# ==========================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := protoc-gen-javastream
-LOCAL_SRC_FILES := \
- Errors.cpp \
- string_utils.cpp \
- main.cpp
-LOCAL_SHARED_LIBRARIES := \
- libprotoc
-include $(BUILD_HOST_EXECUTABLE)
-
-# ==========================================================
# Build the java test
# ==========================================================
include $(CLEAR_VARS)
diff --git a/tools/validatekeymaps/Android.bp b/tools/validatekeymaps/Android.bp
new file mode 100644
index 000000000000..6fb278c83f0a
--- /dev/null
+++ b/tools/validatekeymaps/Android.bp
@@ -0,0 +1,30 @@
+//
+// Copyright 2010 The Android Open Source Project
+//
+// Keymap validation tool.
+//
+
+cc_binary_host {
+ name: "validatekeymaps",
+
+ srcs: ["Main.cpp"],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ static_libs: [
+ "libinput",
+ "libutils",
+ "libcutils",
+ "liblog",
+ ],
+
+ // This tool is prebuilt if we're doing an app-only build.
+ product_variables: {
+ unbundled_build: {
+ enabled: false,
+ },
+ },
+}
diff --git a/tools/validatekeymaps/Android.mk b/tools/validatekeymaps/Android.mk
deleted file mode 100644
index 9af721de97db..000000000000
--- a/tools/validatekeymaps/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright 2010 The Android Open Source Project
-#
-# Keymap validation tool.
-#
-
-# This tool is prebuilt if we're doing an app-only build.
-ifeq ($(TARGET_BUILD_APPS),)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- Main.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_STATIC_LIBRARIES := \
- libinput \
- libutils \
- libcutils \
- liblog
-
-ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -ldl -lpthread
-endif
-
-LOCAL_MODULE := validatekeymaps
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_HOST_EXECUTABLE)
-
-endif # TARGET_BUILD_APPS