• 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 guice within the Android Open Source Project
18// See https://source.android.com/source/building.html for more information
19//
20
21//##################################
22//           Guice                 #
23//##################################
24
25//
26// Builds the 'no_aop' flavor for Android.
27// -- see core/pom.xml NO_AOP rule.
28//
29
30package {
31    default_applicable_licenses: ["external_guice_license"],
32}
33
34// Added automatically by a large-scale-change
35//
36// large-scale-change included anything that looked like it might be a license
37// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
38//
39// Please consider removing redundant or irrelevant files from 'license_text:'.
40// See: http://go/android-license-faq
41license {
42    name: "external_guice_license",
43    visibility: [":__subpackages__"],
44    license_kinds: [
45        "SPDX-license-identifier-Apache-2.0",
46    ],
47    license_text: [
48        "COPYING",
49        "NOTICE",
50    ],
51}
52
53filegroup {
54    name: "guice_srcs",
55    srcs: ["core/src/**/*.java"],
56    exclude_srcs: [
57        "core/src/com/google/inject/spi/InterceptorBinding.java",
58        "core/src/com/google/inject/internal/InterceptorBindingProcessor.java",
59        "core/src/com/google/inject/internal/InterceptorStackCallback.java",
60        "core/src/com/google/inject/internal/InterceptorStackCallback.java",
61        "core/src/com/google/inject/internal/util/LineNumbers.java",
62        "core/src/com/google/inject/internal/MethodAspect.java",
63        "core/src/com/google/inject/internal/ProxyFactory.java",
64    ],
65}
66
67filegroup {
68    name: "guice_test_src_files",
69    srcs: ["core/test/**/*.java"],
70    exclude_srcs: [
71        "core/test/com/googlecode/guice/BytecodeGenTest.java",
72        "core/test/com/google/inject/IntegrationTest.java",
73        "core/test/com/google/inject/MethodInterceptionTest.java",
74        "core/test/com/google/inject/internal/ProxyFactoryTest.java",
75    ],
76}
77
78// Copy munge.jar to a srcjar.
79// Remove MungeTask.java, which is missing ant dependencies in Android.
80genrule {
81    name: "guice_munge_srcjar",
82    out: ["guice_munge.srcjar"],
83    srcs: ["lib/build/munge.jar"],
84    cmd: "zip -q --temp-path $${TMPDIR:-/tmp} $(in) -O $(out) -d MungeTask.java *.class",
85}
86
87genrule {
88    name: "guice_munge_manifest",
89    out: ["guice_munge.manifest"],
90    srcs: ["lib/build/munge.jar"],
91    cmd: "unzip -p -q $(in) META-INF/MANIFEST.MF > $(out)",
92}
93
94java_binary_host {
95    name: "guice_munge",
96    srcs: [":guice_munge_srcjar"],
97    manifest: ":guice_munge_manifest",
98    libs: ["junit"],
99}
100
101genrule {
102    name: "guice_munged_srcs",
103    srcs: [":guice_srcs"],
104    out: ["guice_munged_srcs.srcjar"],
105    tools: [
106        "guice_munge",
107        "soong_zip",
108    ],
109    cmd: "for src in $(in); do " +
110        "  mkdir -p $$(dirname $(genDir)/$${src}) && " +
111        "  $(location guice_munge) -DNO_AOP $${src} > $(genDir)/$${src} || exit 1; " +
112        " done && " +
113        " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
114}
115
116// Target-side Dalvik, host-side, and host-side Dalvik build
117
118java_library_static {
119    name: "guice",
120    visibility: [
121       "//external/testng:__pkg__",
122       "//platform_testing/libraries/audio-test-harness/server:__pkg__",
123       "//tools/tradefederation/core:__pkg__",
124    ],
125    host_supported: true,
126    hostdex: true,
127    sdk_version: "core_current",
128    srcs: [":guice_munged_srcs"],
129    static_libs: [
130        "guava",
131        "jsr330",
132    ],
133}
134
135// Variation that doesn't link guava statically
136java_library_static {
137    name: "guice-no-guava",
138    host_supported: true,
139    hostdex: true,
140    sdk_version: "core_current",
141    srcs: [":guice_munged_srcs"],
142    libs: [
143        "guava",
144    ],
145    static_libs: [
146        "jsr330",
147    ],
148}
149
150// TODO: Consider adding tests.
151