diff options
author | Josh Guilfoyle <Josh.Guilfoyle@T-Mobile.com> | 2009-08-06 15:25:59 -0700 |
---|---|---|
committer | Josh Guilfoyle <Josh.Guilfoyle@T-Mobile.com> | 2009-08-07 11:43:09 -0700 |
commit | 0855d4bc7312044980d29933cbee5f1cafbee87c (patch) | |
tree | 9115171a852d20aeae359fdfc13af15f0dbc4fdd /tools | |
parent | 0bcd97b17d3a25a225cfacb75f55b1b11dc5443f (diff) | |
download | frameworks_base-0855d4bc7312044980d29933cbee5f1cafbee87c.zip frameworks_base-0855d4bc7312044980d29933cbee5f1cafbee87c.tar.gz frameworks_base-0855d4bc7312044980d29933cbee5f1cafbee87c.tar.bz2 |
Revert "This is a patch I've checked in in the old repo and apparently it was not ported to devpde01."
This checkin introduced aapt changes to build on the device, which are no
longer a required part of the flow.
This reverts commit 30f0b7eac75e70e8cedce42b614f33ef5c0a5785.
CR: Sergey Ten
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/Android.mk | 51 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 40 | ||||
-rw-r--r-- | tools/aapt/Main.cpp | 6 | ||||
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 4 | ||||
-rw-r--r-- | tools/aapt/ResourceTable.h | 10 | ||||
-rw-r--r-- | tools/aapt/SourcePos.cpp | 17 | ||||
-rw-r--r-- | tools/aapt/XMLNode.cpp | 9 |
7 files changed, 5 insertions, 132 deletions
diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk index a8a9c1c..fdc859c 100644 --- a/tools/aapt/Android.mk +++ b/tools/aapt/Android.mk @@ -5,8 +5,9 @@ # LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) -commonSources:= \ +LOCAL_SRC_FILES := \ AaptAssets.cpp \ Command.cpp \ Main.cpp \ @@ -16,18 +17,8 @@ commonSources:= \ ResourceTable.cpp \ Images.cpp \ Resource.cpp \ - SourcePos.cpp - - -# For the host -# ===================================================== - -include $(CLEAR_VARS) + SourcePos.cpp -LOCAL_SRC_FILES := $(commonSources) - -LOCAL_CFLAGS += -DHOST_LIB=1 -LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) LOCAL_CFLAGS += -Wno-format-y2k LOCAL_C_INCLUDES += external/expat/lib @@ -59,39 +50,3 @@ LOCAL_MODULE := aapt include $(BUILD_HOST_EXECUTABLE) - -# For the device -# ===================================================== -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= $(commonSources) - -ifeq ($(TARGET_OS),linux) -# Use the futex based mutex and condition variable -# implementation from android-arm because it's shared mem safe -LOCAL_LDLIBS += -lrt -ldl -endif - -LOCAL_C_INCLUDES += external/expat/lib -LOCAL_C_INCLUDES += external/libpng -LOCAL_C_INCLUDES += external/zlib -LOCAL_C_INCLUDES += external/icu4c/common - -LOCAL_SHARED_LIBRARIES := \ - libz \ - libutils \ - libcutils \ - libexpat \ - libsgl - -ifneq ($(TARGET_SIMULATOR),true) -ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86) -# This is needed on x86 to bring in dl_iterate_phdr for CallStack.cpp -LOCAL_SHARED_LIBRARIES += \ - libdl -endif # linux-x86 -endif # sim - -LOCAL_MODULE := aapt - -include $(BUILD_EXECUTABLE) diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 39acc42..6f3461d 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -21,11 +21,9 @@ using namespace android; */ int doVersion(Bundle* bundle) { -#ifdef HOST_LIB if (bundle->getFileSpecCount() != 0) printf("(ignoring extra arguments)\n"); printf("Android Asset Packaging Tool, v0.2\n"); -#endif // HOST_LIB return 0; } @@ -44,15 +42,13 @@ ZipFile* openReadOnly(const char* fileName) zip = new ZipFile; result = zip->open(fileName, ZipFile::kOpenReadOnly); if (result != NO_ERROR) { -#ifdef HOST_LIB - if (result == NAME_NOT_FOUND) + if (result == NAME_NOT_FOUND) fprintf(stderr, "ERROR: '%s' not found\n", fileName); else if (result == PERMISSION_DENIED) fprintf(stderr, "ERROR: '%s' access denied\n", fileName); else fprintf(stderr, "ERROR: failed opening '%s' as Zip file\n", fileName); -#endif // HOST_LIB delete zip; return NULL; } @@ -123,7 +119,6 @@ int calcPercent(long uncompressedLen, long compressedLen) int doList(Bundle* bundle) { int result = 1; -#ifdef HOST_LIB ZipFile* zip = NULL; const ZipEntry* entry; long totalUncLen, totalCompLen; @@ -222,7 +217,6 @@ int doList(Bundle* bundle) bail: delete zip; -#endif // HOST_LIB return result; } @@ -347,7 +341,6 @@ const char *getComponentName(String8 &pkgName, String8 &componentName) { int doDump(Bundle* bundle) { status_t result = UNKNOWN_ERROR; -#ifdef HOST_LIB Asset* asset = NULL; if (bundle->getFileSpecCount() < 1) { @@ -697,7 +690,6 @@ bail: if (asset) { delete asset; } -#endif // HOST_LIB return (result != NO_ERROR); } @@ -714,32 +706,24 @@ int doAdd(Bundle* bundle) if (bundle->getUpdate()) { /* avoid confusion */ -#ifdef HOST_LIB fprintf(stderr, "ERROR: can't use '-u' with add\n"); -#endif // HOST_LIB goto bail; } if (bundle->getFileSpecCount() < 1) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: must specify zip file name\n"); -#endif // HOST_LIB goto bail; } zipFileName = bundle->getFileSpecEntry(0); if (bundle->getFileSpecCount() < 2) { -#ifdef HOST_LIB fprintf(stderr, "NOTE: nothing to do\n"); -#endif // HOST_LIB goto bail; } zip = openReadWrite(zipFileName, true); if (zip == NULL) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: failed opening/creating '%s' as Zip file\n", zipFileName); -#endif // HOST_LIB goto bail; } @@ -747,18 +731,13 @@ int doAdd(Bundle* bundle) const char* fileName = bundle->getFileSpecEntry(i); if (strcasecmp(String8(fileName).getPathExtension().string(), ".gz") == 0) { -#ifdef HOST_LIB printf(" '%s'... (from gzip)\n", fileName); -#endif // HOST_LIB result = zip->addGzip(fileName, String8(fileName).getBasePath().string(), NULL); } else { -#ifdef HOST_LIB printf(" '%s'...\n", fileName); -#endif // HOST_LIB result = zip->add(fileName, bundle->getCompressionMethod(), NULL); } if (result != NO_ERROR) { -#ifdef HOST_LIB fprintf(stderr, "Unable to add '%s' to '%s'", bundle->getFileSpecEntry(i), zipFileName); if (result == NAME_NOT_FOUND) fprintf(stderr, ": file not found\n"); @@ -766,7 +745,6 @@ int doAdd(Bundle* bundle) fprintf(stderr, ": already exists in archive\n"); else fprintf(stderr, "\n"); -#endif // HOST_LIB goto bail; } } @@ -789,26 +767,20 @@ int doRemove(Bundle* bundle) const char* zipFileName; if (bundle->getFileSpecCount() < 1) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: must specify zip file name\n"); -#endif // HOST_LIB goto bail; } zipFileName = bundle->getFileSpecEntry(0); if (bundle->getFileSpecCount() < 2) { -#ifdef HOST_LIB fprintf(stderr, "NOTE: nothing to do\n"); -#endif // HOST_LIB goto bail; } zip = openReadWrite(zipFileName, false); if (zip == NULL) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: failed opening Zip archive '%s'\n", zipFileName); -#endif // HOST_LIB goto bail; } @@ -818,19 +790,15 @@ int doRemove(Bundle* bundle) entry = zip->getEntryByName(fileName); if (entry == NULL) { -#ifdef HOST_LIB printf(" '%s' NOT FOUND\n", fileName); -#endif // HOST_LIB continue; } result = zip->remove(entry); if (result != NO_ERROR) { -#ifdef HOST_LIB fprintf(stderr, "Unable to delete '%s' from '%s'\n", bundle->getFileSpecEntry(i), zipFileName); -#endif // HOST_LIB goto bail; } } @@ -868,9 +836,7 @@ int doPackage(Bundle* bundle) N = bundle->getFileSpecCount(); if (N < 1 && bundle->getResourceSourceDirs().size() == 0 && bundle->getJarFiles().size() == 0 && bundle->getAndroidManifestFile() == NULL && bundle->getAssetSourceDir() == NULL) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: no input files\n"); -#endif // HOST_LIB goto bail; } @@ -881,11 +847,9 @@ int doPackage(Bundle* bundle) FileType type; type = getFileType(outputAPKFile); if (type != kFileTypeNonexistent && type != kFileTypeRegular) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: output file '%s' exists but is not regular file\n", outputAPKFile); -#endif // HOST_LIB goto bail; } } @@ -936,9 +900,7 @@ int doPackage(Bundle* bundle) if (outputAPKFile) { err = writeAPK(bundle, assets, String8(outputAPKFile)); if (err != NO_ERROR) { -#ifdef HOST_LIB fprintf(stderr, "ERROR: packaging of '%s' failed\n", outputAPKFile); -#endif // HOST_LIB goto bail; } } diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp index 552ff24..71b1a3c 100644 --- a/tools/aapt/Main.cpp +++ b/tools/aapt/Main.cpp @@ -129,11 +129,9 @@ int handleCommand(Bundle* bundle) // printf(" %d: '%s'\n", i, bundle->getFileSpecEntry(i)); switch (bundle->getCommand()) { -#ifdef HOST_LIB case kCommandVersion: return doVersion(bundle); case kCommandList: return doList(bundle); case kCommandDump: return doDump(bundle); -#endif // HOST_LIB case kCommandAdd: return doAdd(bundle); case kCommandRemove: return doRemove(bundle); case kCommandPackage: return doPackage(bundle); @@ -366,8 +364,6 @@ bail: result = 2; } -#ifndef HOST_LIB - printf("--> returning %d\n", result); -#endif + //printf("--> returning %d\n", result); return result; } diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index 943bbeb..a09b1a6 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -2117,9 +2117,7 @@ status_t ResourceTable::addSymbols(const sp<AaptSymbols>& outSymbols) { void ResourceTable::addLocalization(const String16& name, const String8& locale) { -#ifdef HOST_LIB mLocalizations[name].insert(locale); -#endif // HOST_LIB } @@ -2138,7 +2136,6 @@ ResourceTable::validateLocalizations(void) status_t err = NO_ERROR; const String8 defaultLocale; -#ifdef HOST_LIB // For all strings... for (map<String16, set<String8> >::iterator nameIter = mLocalizations.begin(); nameIter != mLocalizations.end(); @@ -2198,7 +2195,6 @@ ResourceTable::validateLocalizations(void) } while (comma != NULL); } } -#endif // HOST_LIB return err; } diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h index cacc980..74ba326 100644 --- a/tools/aapt/ResourceTable.h +++ b/tools/aapt/ResourceTable.h @@ -4,22 +4,14 @@ // Build resource files from raw assets. // -// WARNING: Since arm compiler runtime does not include STL, we can't include <map> and <set> types. -// Unless we want to provide our own implementation of these (which should not be too difficult, -// since what we need is a simple hash table which keys are unicode strings and values are sets -// of ASCII chars). On the other hand, since maps/sets are used only to validate localized strings, -// I decided to disable this feature when code is executed on a device. - #ifndef RESOURCE_TABLE_H #define RESOURCE_TABLE_H #include "StringPool.h" #include "SourcePos.h" -#ifdef HOST_LIB #include <set> #include <map> -#endif //HOST_LIB using namespace std; @@ -522,10 +514,8 @@ private: SourcePos mCurrentXmlPos; Bundle* mBundle; -#ifdef HOST_LIB // key = string resource name, value = set of locales in which that name is defined map<String16, set<String8> > mLocalizations; -#endif //HOST_LIB }; class ResourceFilter diff --git a/tools/aapt/SourcePos.cpp b/tools/aapt/SourcePos.cpp index e69b126..2761d18 100644 --- a/tools/aapt/SourcePos.cpp +++ b/tools/aapt/SourcePos.cpp @@ -1,12 +1,7 @@ -// WARNING! Since arm compiler does not have STL library, -// error reporting is disabled. We need to figure out how do we report errors. - #include "SourcePos.h" #include <stdarg.h> -#ifdef HOST_LIB #include <vector> -#endif //HOST_LIB using namespace std; @@ -31,9 +26,7 @@ struct ErrorPos void print(FILE* to) const; }; -#ifdef HOST_LIB static vector<ErrorPos> g_errors; -#endif //HOST_LIB ErrorPos::ErrorPos() :line(-1), fatal(false) @@ -93,7 +86,6 @@ ErrorPos::operator=(const ErrorPos& rhs) void ErrorPos::print(FILE* to) const { -#ifdef HOST_LIB const char* type = fatal ? "ERROR" : "WARNING"; if (this->line >= 0) { @@ -101,7 +93,6 @@ ErrorPos::print(FILE* to) const } else { fprintf(to, "%s: %s %s\n", this->file.string(), type, this->error.string()); } -#endif // HOST_LIB } // SourcePos @@ -129,7 +120,6 @@ int SourcePos::error(const char* fmt, ...) const { int retval=0; -#ifdef HOST_LIB char buf[1024]; va_list ap; va_start(ap, fmt); @@ -141,7 +131,6 @@ SourcePos::error(const char* fmt, ...) const p--; } g_errors.push_back(ErrorPos(this->file, this->line, String8(buf), true)); -#endif // HOST_LIB return retval; } @@ -166,22 +155,16 @@ SourcePos::warning(const char* fmt, ...) const bool SourcePos::hasErrors() { -#ifdef HOST_LIB return g_errors.size() > 0; -#else - return false; -#endif // HOST_LIB } void SourcePos::printErrors(FILE* to) { -#ifdef HOST_LIB vector<ErrorPos>::const_iterator it; for (it=g_errors.begin(); it!=g_errors.end(); it++) { it->print(to); } -#endif // HOST_LIB } diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp index c1c99f5..d476567 100644 --- a/tools/aapt/XMLNode.cpp +++ b/tools/aapt/XMLNode.cpp @@ -4,15 +4,10 @@ // Build resource files from raw assets. // -// WARNING! I disabled pseudolocalizing if we run on device, -// since it does not seem important. - #include "XMLNode.h" #include "ResourceTable.h" -#ifdef HOST_LIB #include <host/pseudolocalize.h> -#endif //HOST_LIB #include <utils/ByteOrder.h> #include <errno.h> #include <string.h> @@ -101,17 +96,13 @@ status_t parseStyledString(Bundle* bundle, pseudolocalize = false; } } -#ifdef HOST_LIB if (xliffDepth == 0 && pseudolocalize) { std::string orig(String8(text).string()); std::string pseudo = pseudolocalize_string(orig); curString.append(String16(String8(pseudo.c_str()))); } else { -#endif //HOST_LIB curString.append(text); -#ifdef HOST_LIB } -#endif //HOST_LIB } else if (code == ResXMLTree::START_TAG) { const String16 element16(inXml->getElementName(&len)); const String8 element8(element16); |