blob: 9d2fb68dba294a02237030cc8e101d8e36c4a689 [file] [log] [blame]
Colin Cross61ebe082017-12-08 13:54:03 -08001// 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
Bob Badour656c2482021-02-12 15:42:49 -080030package {
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
Colin Cross61ebe082017-12-08 13:54:03 -080053filegroup {
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"],
Luca Stefania3c70602020-07-26 10:23:34 +020084 cmd: "zip -q --temp-path $${TMPDIR:-/tmp} $(in) -O $(out) -d MungeTask.java *.class",
Colin Cross61ebe082017-12-08 13:54:03 -080085}
86
87genrule {
88 name: "guice_munge_manifest",
89 out: ["guice_munge.manifest"],
90 srcs: ["lib/build/munge.jar"],
Elliott Hughes0ee306f2019-11-15 14:26:50 -080091 cmd: "unzip -p -q $(in) META-INF/MANIFEST.MF > $(out)",
Colin Cross61ebe082017-12-08 13:54:03 -080092}
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}) && " +
Colin Crossbdaef222019-01-14 16:41:18 -0800111 " $(location guice_munge) -DNO_AOP $${src} > $(genDir)/$${src} || exit 1; " +
Colin Cross61ebe082017-12-08 13:54:03 -0800112 " 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",
Dan Shi1afd1b12021-11-30 10:11:31 -0800120 visibility: [
121 "//external/testng:__pkg__",
122 "//platform_testing/libraries/audio-test-harness/server:__pkg__",
123 "//tools/tradefederation/core:__pkg__",
124 ],
Colin Cross61ebe082017-12-08 13:54:03 -0800125 host_supported: true,
126 hostdex: true,
Jiyong Parkcd790692018-01-31 10:56:27 +0900127 sdk_version: "core_current",
Colin Cross61ebe082017-12-08 13:54:03 -0800128 srcs: [":guice_munged_srcs"],
129 static_libs: [
130 "guava",
131 "jsr330",
132 ],
133}
134
Julien Desprez4545ec52018-08-28 14:49:08 -0700135// 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
Colin Cross61ebe082017-12-08 13:54:03 -0800150// TODO: Consider adding tests.