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) 22package { 23 default_applicable_licenses: ["external_snakeyaml_license"], 24} 25 26// Added automatically by a large-scale-change that took the approach of 27// 'apply every license found to every target'. While this makes sure we respect 28// every license restriction, it may not be entirely correct. 29// 30// e.g. GPL in an MIT project might only apply to the contrib/ directory. 31// 32// Please consider splitting the single license below into multiple licenses, 33// taking care not to lose any license_kind information, and overriding the 34// default license using the 'licenses: [...]' property on targets as needed. 35// 36// For unused files, consider creating a 'fileGroup' with "//visibility:private" 37// to attach the license to, and including a comment whether the files may be 38// used in the current project. 39// 40// large-scale-change included anything that looked like it might be a license 41// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 42// 43// Please consider removing redundant or irrelevant files from 'license_text:'. 44// 45// large-scale-change filtered out the below license kinds as false-positives: 46// SPDX-license-identifier-GPL 47// SPDX-license-identifier-LGPL 48// See: http://go/android-license-faq 49license { 50 name: "external_snakeyaml_license", 51 visibility: [":__subpackages__"], 52 license_kinds: [ 53 "SPDX-license-identifier-Apache-2.0", 54 "SPDX-license-identifier-BSD", 55 ], 56 license_text: [ 57 "LICENSE.txt", 58 "LICENSE", 59 ], 60} 61 62snakeyaml_need_patch_src_files = [ 63 "src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java", 64] 65 66genrule { 67 name: "snakeyaml_patched_src_files", 68 srcs: snakeyaml_need_patch_src_files, 69 tool_files: [ 70 "patch-android-src", 71 "src/patches/android/*.patch", 72 ], 73 tools: [ 74 "soong_zip", 75 ], 76 cmd: "for src in $(in); do " + 77 " $(location patch-android-src) external/snakeyaml/ $${src} $(genDir)/$${src}; " + 78 " done && " + 79 " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)", 80 out: ["snakeyaml_patched_src_files.srcjar"], 81} 82 83java_library { 84 name: "snakeyaml", 85 host_supported: true, 86 hostdex: true, 87 sdk_version: "core_current", 88 89 srcs: ["src/main/**/*.java"], 90 target: { 91 android: { 92 exclude_srcs: snakeyaml_need_patch_src_files + [ 93 // List of all files that are unsupported on android (see pom.xml) 94 "src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java", 95 ], 96 srcs: [":snakeyaml_patched_src_files"], 97 }, 98 }, 99 // b/267831518: Pin tradefed and dependencies to Java 11. 100 java_version: "11", 101 errorprone: { 102 javacflags: [ 103 "-Xep:ReturnValueIgnored:WARN", 104 ], 105 }, 106} 107 108// TODO: Consider adding tests. 109