Colin Cross | f76463b | 2017-12-08 18:04:25 -0800 | [diff] [blame] | 1 | // Copyright (C) 2016 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | // |
| 15 | |
| 16 | // |
| 17 | // Build support for snakeyaml within the Android Open Source Project |
| 18 | // See https://source.android.com/source/building.html for more information |
| 19 | // |
| 20 | |
| 21 | // List of all files that need to be patched (see src/patches/android) |
| 22 | snakeyaml_need_patch_src_files = [ |
| 23 | "src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java", |
| 24 | "src/main/java/org/yaml/snakeyaml/constructor/Constructor.java", |
| 25 | "src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java", |
| 26 | "src/main/java/org/yaml/snakeyaml/representer/Representer.java", |
| 27 | ] |
| 28 | |
| 29 | genrule { |
| 30 | name: "snakeyaml_patched_src_files", |
| 31 | srcs: snakeyaml_need_patch_src_files, |
| 32 | tool_files: [ |
| 33 | "patch-android-src", |
| 34 | "src/patches/android/*.patch", |
| 35 | ], |
| 36 | tools: [ |
| 37 | "soong_zip", |
| 38 | ], |
| 39 | cmd: "for src in $(in); do " + |
| 40 | " $(location patch-android-src) external/snakeyaml/ $${src} $(genDir)/$${src}; " + |
| 41 | " done && " + |
| 42 | " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)", |
| 43 | out: ["snakeyaml_patched_src_files.srcjar"], |
| 44 | } |
| 45 | |
Gerald Corrigan | 0e41746 | 2017-12-13 08:36:03 -0800 | [diff] [blame] | 46 | java_library { |
Colin Cross | f76463b | 2017-12-08 18:04:25 -0800 | [diff] [blame] | 47 | name: "snakeyaml", |
| 48 | host_supported: true, |
| 49 | hostdex: true, |
Jiyong Park | 92d847d | 2018-01-31 10:59:56 +0900 | [diff] [blame] | 50 | sdk_version: "core_current", |
Colin Cross | f76463b | 2017-12-08 18:04:25 -0800 | [diff] [blame] | 51 | |
| 52 | srcs: ["src/main/**/*.java"], |
| 53 | target: { |
| 54 | android: { |
| 55 | exclude_srcs: snakeyaml_need_patch_src_files + [ |
| 56 | // List of all files that are unsupported on android (see pom.xml) |
| 57 | "src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java", |
| 58 | ], |
| 59 | srcs: [":snakeyaml_patched_src_files"], |
| 60 | }, |
| 61 | }, |
| 62 | } |
| 63 | |
| 64 | // TODO: Consider adding tests. |