• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        "NOTICE",
59    ],
60}
61
62snakeyaml_need_patch_src_files = [
63    "src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java",
64    "src/main/java/org/yaml/snakeyaml/constructor/Constructor.java",
65    "src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java",
66    "src/main/java/org/yaml/snakeyaml/representer/Representer.java",
67]
68
69genrule {
70    name: "snakeyaml_patched_src_files",
71    srcs: snakeyaml_need_patch_src_files,
72    tool_files: [
73        "patch-android-src",
74        "src/patches/android/*.patch",
75    ],
76    tools: [
77        "soong_zip",
78    ],
79    cmd: "for src in $(in); do " +
80        "   $(location patch-android-src) external/snakeyaml/ $${src} $(genDir)/$${src}; " +
81        " done && " +
82        " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
83    out: ["snakeyaml_patched_src_files.srcjar"],
84}
85
86java_library {
87    name: "snakeyaml",
88    host_supported: true,
89    hostdex: true,
90    sdk_version: "core_current",
91
92    srcs: ["src/main/**/*.java"],
93    target: {
94        android: {
95            exclude_srcs: snakeyaml_need_patch_src_files + [
96                // List of all files that are unsupported on android (see pom.xml)
97                "src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java",
98            ],
99            srcs: [":snakeyaml_patched_src_files"],
100        },
101    },
102}
103
104// TODO: Consider adding tests.
105