Loading tools/aapt2/Android.mk +4 −0 Original line number Diff line number Diff line LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Target for running host unit tests on post/pre-submit. .PHONY: aapt2_run_host_unit_tests aapt2_run_host_unit_tests: PRIVATE_GTEST_OPTIONS := --gtest_output=xml:$(DIST_DIR)/gtest/aapt2_host_unit_tests_result.xml aapt2_run_host_unit_tests: $(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests -$(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests $(PRIVATE_GTEST_OPTIONS) > /dev/null 2>&1 include $(call all-makefiles-under,$(LOCAL_PATH)) tools/aapt2/cmd/Link.cpp +31 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include "ValueVisitor.h" #include "cmd/Util.h" #include "compile/IdAssigner.h" #include "compile/XmlIdCollector.h" #include "filter/ConfigFilter.h" #include "format/Archive.h" #include "format/Container.h" Loading Loading @@ -1235,19 +1236,10 @@ class LinkCommand { return true; } bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) { if (context_->IsVerbose()) { context_->GetDiagnostics()->Note(DiagMessage() << "merging '" << compiled_file.name << "' from compiled file " << compiled_file.source); } if (!table_merger_->MergeFile(compiled_file, override, file)) { return false; } bool MergeExportedSymbols(const Source& source, const std::vector<SourcedResourceName>& exported_symbols) { // Add the exports of this file to the table. for (const SourcedResourceName& exported_symbol : compiled_file.exported_symbols) { for (const SourcedResourceName& exported_symbol : exported_symbols) { ResourceName res_name = exported_symbol.name; if (res_name.package.empty()) { res_name.package = context_->GetCompilationPackage(); Loading @@ -1259,7 +1251,7 @@ class LinkCommand { } std::unique_ptr<Id> id = util::make_unique<Id>(); id->SetSource(compiled_file.source.WithLine(exported_symbol.line)); id->SetSource(source.WithLine(exported_symbol.line)); bool result = final_table_.AddResourceAllowMangled( res_name, ConfigDescription::DefaultConfig(), std::string(), std::move(id), context_->GetDiagnostics()); Loading @@ -1270,6 +1262,19 @@ class LinkCommand { return true; } bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) { if (context_->IsVerbose()) { context_->GetDiagnostics()->Note(DiagMessage() << "merging '" << compiled_file.name << "' from compiled file " << compiled_file.source); } if (!table_merger_->MergeFile(compiled_file, override, file)) { return false; } return MergeExportedSymbols(compiled_file.source, compiled_file.exported_symbols); } // Takes a path to load as a ZIP file and merges the files within into the master ResourceTable. // If override is true, conflicting resources are allowed to override each other, in order of last // seen. Loading Loading @@ -1573,6 +1578,19 @@ class LinkCommand { context_->GetPackageId())); } // Extract symbols from AndroidManifest.xml, since this isn't merged like the other XML files // in res/**/*. { XmlIdCollector collector; if (!collector.Consume(context_, manifest_xml.get())) { return false; } if (!MergeExportedSymbols(manifest_xml->file.source, manifest_xml->file.exported_symbols)) { return false; } } for (const std::string& input : input_files) { if (!MergePath(input, false)) { context_->GetDiagnostics()->Error(DiagMessage() << "failed parsing input"); Loading tools/aapt2/integration-tests/StaticLibTest/App/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <uses-permission-sdk-23 android:name="android.permission.TEST" android:maxSdkVersion="22" /> <application> <activity android:name=".MyActivity"> <activity android:name=".MyActivity" android:id="@+id/sample_generated_id"> <layout android:defaultHeight="500dp" android:defaultWidth="600dp" /> </activity> Loading tools/aapt2/integration-tests/StaticLibTest/App/res/layout/main.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> <fragment class="android.test.sample.App$Inner" /> <fragment class="android.test.sample.App$Inner" android:id="@id/sample_generated_id"/> <variable name="user" type="com.android.User" /> Loading Loading
tools/aapt2/Android.mk +4 −0 Original line number Diff line number Diff line LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Target for running host unit tests on post/pre-submit. .PHONY: aapt2_run_host_unit_tests aapt2_run_host_unit_tests: PRIVATE_GTEST_OPTIONS := --gtest_output=xml:$(DIST_DIR)/gtest/aapt2_host_unit_tests_result.xml aapt2_run_host_unit_tests: $(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests -$(HOST_OUT_NATIVE_TESTS)/aapt2_tests/aapt2_tests $(PRIVATE_GTEST_OPTIONS) > /dev/null 2>&1 include $(call all-makefiles-under,$(LOCAL_PATH))
tools/aapt2/cmd/Link.cpp +31 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include "ValueVisitor.h" #include "cmd/Util.h" #include "compile/IdAssigner.h" #include "compile/XmlIdCollector.h" #include "filter/ConfigFilter.h" #include "format/Archive.h" #include "format/Container.h" Loading Loading @@ -1235,19 +1236,10 @@ class LinkCommand { return true; } bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) { if (context_->IsVerbose()) { context_->GetDiagnostics()->Note(DiagMessage() << "merging '" << compiled_file.name << "' from compiled file " << compiled_file.source); } if (!table_merger_->MergeFile(compiled_file, override, file)) { return false; } bool MergeExportedSymbols(const Source& source, const std::vector<SourcedResourceName>& exported_symbols) { // Add the exports of this file to the table. for (const SourcedResourceName& exported_symbol : compiled_file.exported_symbols) { for (const SourcedResourceName& exported_symbol : exported_symbols) { ResourceName res_name = exported_symbol.name; if (res_name.package.empty()) { res_name.package = context_->GetCompilationPackage(); Loading @@ -1259,7 +1251,7 @@ class LinkCommand { } std::unique_ptr<Id> id = util::make_unique<Id>(); id->SetSource(compiled_file.source.WithLine(exported_symbol.line)); id->SetSource(source.WithLine(exported_symbol.line)); bool result = final_table_.AddResourceAllowMangled( res_name, ConfigDescription::DefaultConfig(), std::string(), std::move(id), context_->GetDiagnostics()); Loading @@ -1270,6 +1262,19 @@ class LinkCommand { return true; } bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) { if (context_->IsVerbose()) { context_->GetDiagnostics()->Note(DiagMessage() << "merging '" << compiled_file.name << "' from compiled file " << compiled_file.source); } if (!table_merger_->MergeFile(compiled_file, override, file)) { return false; } return MergeExportedSymbols(compiled_file.source, compiled_file.exported_symbols); } // Takes a path to load as a ZIP file and merges the files within into the master ResourceTable. // If override is true, conflicting resources are allowed to override each other, in order of last // seen. Loading Loading @@ -1573,6 +1578,19 @@ class LinkCommand { context_->GetPackageId())); } // Extract symbols from AndroidManifest.xml, since this isn't merged like the other XML files // in res/**/*. { XmlIdCollector collector; if (!collector.Consume(context_, manifest_xml.get())) { return false; } if (!MergeExportedSymbols(manifest_xml->file.source, manifest_xml->file.exported_symbols)) { return false; } } for (const std::string& input : input_files) { if (!MergePath(input, false)) { context_->GetDiagnostics()->Error(DiagMessage() << "failed parsing input"); Loading
tools/aapt2/integration-tests/StaticLibTest/App/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <uses-permission-sdk-23 android:name="android.permission.TEST" android:maxSdkVersion="22" /> <application> <activity android:name=".MyActivity"> <activity android:name=".MyActivity" android:id="@+id/sample_generated_id"> <layout android:defaultHeight="500dp" android:defaultWidth="600dp" /> </activity> Loading
tools/aapt2/integration-tests/StaticLibTest/App/res/layout/main.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> <fragment class="android.test.sample.App$Inner" /> <fragment class="android.test.sample.App$Inner" android:id="@id/sample_generated_id"/> <variable name="user" type="com.android.User" /> Loading