diff options
Diffstat (limited to 'tools/aapt')
-rw-r--r-- | tools/aapt/Android.bp | 115 | ||||
-rw-r--r-- | tools/aapt/Android.mk | 62 |
2 files changed, 116 insertions, 61 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 e74a3dfbb839..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 \ @@ -68,20 +36,6 @@ aaptHostStaticLibs := \ aaptCFlags := -Wall -Werror # ========================================================== -# 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_CFLAGS_darwin := -D_DARWIN_UNLIMITED_STREAMS -LOCAL_SRC_FILES := $(aaptSources) -LOCAL_STATIC_LIBRARIES := $(aaptHostStaticLibs) - -include $(BUILD_HOST_STATIC_LIBRARY) - -# ========================================================== # Build the host executable: aapt # ========================================================== include $(CLEAR_VARS) @@ -89,23 +43,9 @@ include $(CLEAR_VARS) LOCAL_MODULE := aapt LOCAL_MODULE_HOST_OS := darwin linux windows LOCAL_CFLAGS := -DAAPT_VERSION=\"$(BUILD_NUMBER_FROM_FILE)\" $(aaptCFlags) -LOCAL_SRC_FILES := $(aaptMain) +LOCAL_SRC_FILES := Main.cpp LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs) include $(BUILD_HOST_EXECUTABLE) - -# ========================================================== -# Build the host tests: libaapt_tests -# ========================================================== -include $(CLEAR_VARS) - -LOCAL_MODULE := libaapt_tests -LOCAL_CFLAGS := $(aaptCFlags) -LOCAL_SRC_FILES := $(aaptTests) -LOCAL_STATIC_LIBRARIES := libaapt $(aaptHostStaticLibs) - -include $(BUILD_HOST_NATIVE_TEST) - - endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK |