forked from openkylin/platform_build
Normalize java source file paths before running "sort -u".
We rely on "sort -u" to dedupe aidl/logtags generated java files added by both from $(all_java_sources) and from "find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java". But "sort -u" doesn't work if any of the aidl/logtags source file path has "../" in it. This change fixes this issue by normalizing the source file paths before passing them to "sort -u". Change-Id: I12d2c4e0397bed9f426a1ed9b13608d72d01e0df
This commit is contained in:
parent
ac4ec1a4ea
commit
4d68879ca6
|
@ -550,6 +550,8 @@ else
|
|||
MD5SUM:=md5sum
|
||||
endif
|
||||
|
||||
NORMALIZE_PATH := build/tools/normalize_path.py
|
||||
|
||||
APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
|
||||
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
|
|
|
@ -1804,7 +1804,7 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
|||
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
|
||||
fi
|
||||
$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
|
||||
| sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
| $(NORMALIZE_PATH) | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
|
||||
$(1) -encoding UTF-8 \
|
||||
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||
|
@ -1867,7 +1867,7 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
|||
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
|
||||
fi
|
||||
$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
|
||||
| sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
| $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
|
||||
$(hide) echo -basedirectory $(CURDIR) > $@.flags; \
|
||||
echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
|
||||
|
@ -1946,7 +1946,7 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
|||
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
|
||||
fi
|
||||
$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
|
||||
| sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
| $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
|
||||
$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
|
||||
$(hide) echo -basedirectory $(CURDIR) > $@.flags; \
|
||||
echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
"""
|
||||
Normalize and output paths read from stdin.
|
||||
"""
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
for line in sys.stdin:
|
||||
print os.path.normpath(line.strip())
|
Loading…
Reference in New Issue