diff options
Diffstat (limited to 'tools')
25 files changed, 527 insertions, 449 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 ba731801e507..5e8580255197 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/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 14d05fdf6ee8..86f7c31b665d 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, } @@ -145,7 +141,7 @@ cc_library_host_static { proto: { export_proto_headers: true, }, - defaults: ["aapt_defaults"], + defaults: ["aapt2_defaults"], } // ========================================================== @@ -155,7 +151,7 @@ cc_library_host_shared { name: "libaapt2_jni", srcs: toolSources + ["jni/aapt2_jni.cpp"], static_libs: ["libaapt2"], - defaults: ["aapt_defaults"], + defaults: ["aapt2_defaults"], } // ========================================================== @@ -171,7 +167,7 @@ cc_test_host { "libaapt2", "libgmock", ], - defaults: ["aapt_defaults"], + defaults: ["aapt2_defaults"], } // ========================================================== @@ -181,5 +177,5 @@ cc_binary_host { name: "aapt2", srcs: ["Main.cpp"] + toolSources, static_libs: ["libaapt2"], - defaults: ["aapt_defaults"], + defaults: ["aapt2_defaults"], } 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..258e9b517f6d --- /dev/null +++ b/tools/bit/Android.bp @@ -0,0 +1,40 @@ +// +// 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", + ], + + 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.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/incident_report/Android.bp b/tools/incident_report/Android.bp new file mode 100644 index 000000000000..ab55dbd81821 --- /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: ["-Wno-unused-parameter"], +} 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_section_gen/Android.bp b/tools/incident_section_gen/Android.bp new file mode 100644 index 000000000000..1756e06c66fa --- /dev/null +++ b/tools/incident_section_gen/Android.bp @@ -0,0 +1,31 @@ +// +// 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", + ], + 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.mk b/tools/locked_region_code_injection/Android.mk index 0aed0cec27ab..77d5163c1b78 100644 --- a/tools/locked_region_code_injection/Android.mk +++ b/tools/locked_region_code_injection/Android.mk @@ -9,7 +9,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ asm-5.2 \ asm-commons-5.2 \ asm-tree-5.2 \ - asm-analysis-5.2 - + asm-analysis-5.2 \ + guava-21.0 \ 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..99ef8a7b707a 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: * @@ -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/test/lockedregioncodeinjection/TestMain.java b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java index 1d4f2d455270..b86954d5e377 100644 --- a/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java +++ b/tools/locked_region_code_injection/test/lockedregioncodeinjection/TestMain.java @@ -228,4 +228,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 |