diff options
-rw-r--r-- | Android.mk | 19 | ||||
-rw-r--r-- | ApplyAndroidPatches.mk | 39 |
2 files changed, 47 insertions, 11 deletions
@@ -33,6 +33,13 @@ 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) @@ -43,17 +50,7 @@ include $(BUILD_HOST_JAVA_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(snakeyaml_src_files) LOCAL_MODULE := snakeyaml-hostdex -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) - +include $(LOCAL_PATH)/ApplyAndroidPatches.mk include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) # TODO: Consider adding tests. diff --git a/ApplyAndroidPatches.mk b/ApplyAndroidPatches.mk new file mode 100644 index 00000000..ac6ccbc2 --- /dev/null +++ b/ApplyAndroidPatches.mk @@ -0,0 +1,39 @@ +# 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) |