diff options
author | Colin Cross <ccross@android.com> | 2017-12-12 23:11:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-12-12 23:11:07 +0000 |
commit | e40b13c7916fd565f46e6691d0f81ad341578145 (patch) | |
tree | e78e3627b01ac1e40726cc59100fba658b502e10 | |
parent | c2d7be0abdbdfae49db372518b7d460f5ac02b5f (diff) | |
parent | f76463bc2f69e49a96c493b5b652da465abec314 (diff) | |
download | snakeyaml-e40b13c7916fd565f46e6691d0f81ad341578145.tar.gz |
Convert external/snakeyaml to Android.bp
am: f76463bc2f
Change-Id: I29d29563527bf56ce24fb6fa9f73634a5dd420d3
-rw-r--r-- | Android.bp | 63 | ||||
-rw-r--r-- | Android.mk | 56 | ||||
-rw-r--r-- | ApplyAndroidPatches.mk | 39 | ||||
-rwxr-xr-x | patch-android-src | 3 |
4 files changed, 64 insertions, 97 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..f3ca9129 --- /dev/null +++ b/Android.bp @@ -0,0 +1,63 @@ +// Copyright (C) 2016 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. +// + +// +// Build support for snakeyaml within the Android Open Source Project +// See https://source.android.com/source/building.html for more information +// + +// List of all files that need to be patched (see src/patches/android) +snakeyaml_need_patch_src_files = [ + "src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java", + "src/main/java/org/yaml/snakeyaml/constructor/Constructor.java", + "src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java", + "src/main/java/org/yaml/snakeyaml/representer/Representer.java", +] + +genrule { + name: "snakeyaml_patched_src_files", + srcs: snakeyaml_need_patch_src_files, + tool_files: [ + "patch-android-src", + "src/patches/android/*.patch", + ], + tools: [ + "soong_zip", + ], + cmd: "for src in $(in); do " + + " $(location patch-android-src) external/snakeyaml/ $${src} $(genDir)/$${src}; " + + " done && " + + " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)", + out: ["snakeyaml_patched_src_files.srcjar"], +} + +java_library_static { + name: "snakeyaml", + host_supported: true, + hostdex: true, + + srcs: ["src/main/**/*.java"], + target: { + android: { + exclude_srcs: snakeyaml_need_patch_src_files + [ + // List of all files that are unsupported on android (see pom.xml) + "src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java", + ], + srcs: [":snakeyaml_patched_src_files"], + }, + }, +} + +// TODO: Consider adding tests. diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 6b5c4dc8..00000000 --- a/Android.mk +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2016 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. -# - -# -# Build support for snakeyaml within the Android Open Source Project -# See https://source.android.com/source/building.html for more information -# - -LOCAL_PATH := $(call my-dir) - -# List of all files that need to be patched (see src/patches/android) -snakeyaml_need_patch_src_files := \ - src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java \ - src/main/java/org/yaml/snakeyaml/constructor/Constructor.java \ - src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java \ - src/main/java/org/yaml/snakeyaml/representer/Representer.java -# List of all files that are unsupported on android (see pom.xml) -snakeyaml_unsupported_android_src_files := \ - src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java -snakeyaml_src_files_unfiltered := $(call all-java-files-under, src/main) -# We omit the list of files that need to be patched because those are included by LOCAL_GENERATED_SOURCES instead. -snakeyaml_src_files := $(filter-out $(snakeyaml_need_patch_src_files) $(snakeyaml_unsupported_android_src_files),$(snakeyaml_src_files_unfiltered)) - -# Target Java build -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(snakeyaml_src_files) -LOCAL_MODULE := snakeyaml -include $(LOCAL_PATH)/ApplyAndroidPatches.mk -include $(BUILD_STATIC_JAVA_LIBRARY) - -# Host-side Java build -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(snakeyaml_src_files_unfiltered) -LOCAL_MODULE := snakeyaml-host -include $(BUILD_HOST_JAVA_LIBRARY) - -# Host-side Dalvik build -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(snakeyaml_src_files) -LOCAL_MODULE := snakeyaml-hostdex -include $(LOCAL_PATH)/ApplyAndroidPatches.mk -include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY) - -# TODO: Consider adding tests. diff --git a/ApplyAndroidPatches.mk b/ApplyAndroidPatches.mk deleted file mode 100644 index ac6ccbc2..00000000 --- a/ApplyAndroidPatches.mk +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2016 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. -# - -# -# Apply the android patches in src/patches/android -# - Required in order to build correctly for AOSP. -# - -# -# Input variables: -# (Constant) -# -- snakeyaml_need_patch_src_files: List of .java files that will need to be patched. -# -# This mk file will automatically look up the corresponding patch in src/patches/android -# and apply it to every file in $(snakeyaml_need_patch_src_files). -# - -LOCAL_MODULE_CLASS := JAVA_LIBRARIES - -# Apply all of the Android patches in src/patches/android by running patch-android-src script on them. -intermediates:= $(local-generated-sources-dir) -GEN := $(addprefix $(intermediates)/, $(snakeyaml_need_patch_src_files)) # List of all files that need to be patched. -$(GEN) : PRIVATE_PATH := $(LOCAL_PATH) -$(GEN) : PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/patch-android-src $(PRIVATE_PATH)/ $< $@ -$(GEN): $(intermediates)/%.java : $(LOCAL_PATH)/%.java $(LOCAL_PATH)/patch-android-src - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) diff --git a/patch-android-src b/patch-android-src index dacf1fcc..8b4dc50c 100755 --- a/patch-android-src +++ b/patch-android-src @@ -87,5 +87,4 @@ if ! [[ -f "$dst_file" ]]; then exit 1 fi cd "$dst_dir" -patch "$(basename "$dst_file")" "$patch_file_src" -echo "Successfully applied patch $patch_file_src into copy of file $dst_file" +patch --quiet "$(basename "$dst_file")" "$patch_file_src" |