blob: 154cee32bcb283fd435bbb9b7218db0369944c4d [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
30filegroup {
31 name: "guice_srcs",
32 srcs: ["core/src/**/*.java"],
33 exclude_srcs: [
34 "core/src/com/google/inject/spi/InterceptorBinding.java",
35 "core/src/com/google/inject/internal/InterceptorBindingProcessor.java",
36 "core/src/com/google/inject/internal/InterceptorStackCallback.java",
37 "core/src/com/google/inject/internal/InterceptorStackCallback.java",
38 "core/src/com/google/inject/internal/util/LineNumbers.java",
39 "core/src/com/google/inject/internal/MethodAspect.java",
40 "core/src/com/google/inject/internal/ProxyFactory.java",
41 ],
42}
43
44filegroup {
45 name: "guice_test_src_files",
46 srcs: ["core/test/**/*.java"],
47 exclude_srcs: [
48 "core/test/com/googlecode/guice/BytecodeGenTest.java",
49 "core/test/com/google/inject/IntegrationTest.java",
50 "core/test/com/google/inject/MethodInterceptionTest.java",
51 "core/test/com/google/inject/internal/ProxyFactoryTest.java",
52 ],
53}
54
55// Copy munge.jar to a srcjar.
56// Remove MungeTask.java, which is missing ant dependencies in Android.
57genrule {
58 name: "guice_munge_srcjar",
59 out: ["guice_munge.srcjar"],
60 srcs: ["lib/build/munge.jar"],
Diego Wilson109f3532018-01-30 17:19:37 -080061 cmd: "zip --temp-path $${TMPDIR:-/tmp} $(in) -O $(out) -d MungeTask.java",
Colin Cross61ebe082017-12-08 13:54:03 -080062}
63
64genrule {
65 name: "guice_munge_manifest",
66 out: ["guice_munge.manifest"],
67 srcs: ["lib/build/munge.jar"],
68 cmd: "unzip -qc $(in) META-INF/MANIFEST.MF > $(out)",
69}
70
71java_binary_host {
72 name: "guice_munge",
73 srcs: [":guice_munge_srcjar"],
74 manifest: ":guice_munge_manifest",
75 libs: ["junit"],
76}
77
78genrule {
79 name: "guice_munged_srcs",
80 srcs: [":guice_srcs"],
81 out: ["guice_munged_srcs.srcjar"],
82 tools: [
83 "guice_munge",
84 "soong_zip",
85 ],
86 cmd: "for src in $(in); do " +
87 " mkdir -p $$(dirname $(genDir)/$${src}) && " +
88 " $(location guice_munge) -DNO_AOP $${src} > $(genDir)/$${src}; " +
89 " done && " +
90 " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
91}
92
93// Target-side Dalvik, host-side, and host-side Dalvik build
94
95java_library_static {
96 name: "guice",
97 host_supported: true,
98 hostdex: true,
Jiyong Parkcd790692018-01-31 10:56:27 +090099 sdk_version: "core_current",
Colin Cross61ebe082017-12-08 13:54:03 -0800100 srcs: [":guice_munged_srcs"],
101 static_libs: [
102 "guava",
103 "jsr330",
104 ],
105}
106
107// TODO: Consider adding tests.