Merge "AAPT2: Follow symlinks when compiling" into oc-dev am: 6ea61f9c6d

am: c69611fd86

Change-Id: Idd8ebb98c04fcfd061c36c2e5dcd678d88c5a267
This commit is contained in:
Adam Lesinski
2017-05-30 13:58:24 +00:00
committed by android-build-merger
12 changed files with 94 additions and 6 deletions

View File

@@ -480,7 +480,8 @@ static bool CompilePng(IAaptContext* context, const CompileOptions& options,
{
std::string content;
if (!android::base::ReadFileToString(path_data.source.path, &content)) {
if (!android::base::ReadFileToString(path_data.source.path, &content,
true /*follow_symlinks*/)) {
context->GetDiagnostics()->Error(DiagMessage(path_data.source)
<< "failed to open file: "
<< android::base::SystemErrorCodeToString(errno));

View File

@@ -632,7 +632,7 @@ static bool WriteStableIdMapToPath(IDiagnostics* diag,
static bool LoadStableIdMap(IDiagnostics* diag, const std::string& path,
std::unordered_map<ResourceName, ResourceId>* out_id_map) {
std::string content;
if (!android::base::ReadFileToString(path, &content)) {
if (!android::base::ReadFileToString(path, &content, true /*follow_symlinks*/)) {
diag->Error(DiagMessage(path) << "failed reading stable ID file");
return false;
}

View File

@@ -0,0 +1,23 @@
#
# Copyright (C) 2017 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)
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_PACKAGE_NAME := AaptSymlinkTest
LOCAL_MODULE_TAGS := tests
include $(BUILD_PACKAGE)

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.aapt.symlinktest" />

View File

@@ -0,0 +1 @@
../../targets/white_3x3.9.png

View File

@@ -0,0 +1 @@
../../targets/layout.xml

View File

@@ -0,0 +1 @@
../../targets/values.xml

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->
<resources>
<bool name="foo">true</bool>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

View File

@@ -1,5 +1,9 @@
# Android Asset Packaging Tool 2.0 (AAPT2) release notes
## Version 2.17
### `aapt2 compile ...`
- Fixed an issue where symlinks would not be followed when compiling PNGs. (bug 62144459)
## Version 2.16
### `aapt2 link ...`
- Versioning of XML files is more intelligent, using a small set of rules to degrade

View File

@@ -181,12 +181,13 @@ Maybe<android::FileMap> MmapPath(const StringPiece& path,
return std::move(filemap);
}
bool AppendArgsFromFile(const StringPiece& path,
std::vector<std::string>* out_arglist,
bool AppendArgsFromFile(const StringPiece& path, std::vector<std::string>* out_arglist,
std::string* out_error) {
std::string contents;
if (!android::base::ReadFileToString(path.to_string(), &contents)) {
if (out_error) *out_error = "failed to read argument-list file";
if (!android::base::ReadFileToString(path.to_string(), &contents, true /*follow_symlinks*/)) {
if (out_error) {
*out_error = "failed to read argument-list file";
}
return false;
}