Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 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 | |
Bob Badour | 656c248 | 2021-02-12 15:42:49 -0800 | [diff] [blame] | 30 | package { |
| 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 |
| 41 | license { |
| 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 Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 53 | filegroup { |
| 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 | |
| 67 | filegroup { |
| 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. |
| 80 | genrule { |
| 81 | name: "guice_munge_srcjar", |
| 82 | out: ["guice_munge.srcjar"], |
| 83 | srcs: ["lib/build/munge.jar"], |
Luca Stefani | a3c7060 | 2020-07-26 10:23:34 +0200 | [diff] [blame] | 84 | cmd: "zip -q --temp-path $${TMPDIR:-/tmp} $(in) -O $(out) -d MungeTask.java *.class", |
Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | genrule { |
| 88 | name: "guice_munge_manifest", |
| 89 | out: ["guice_munge.manifest"], |
| 90 | srcs: ["lib/build/munge.jar"], |
Elliott Hughes | 0ee306f | 2019-11-15 14:26:50 -0800 | [diff] [blame] | 91 | cmd: "unzip -p -q $(in) META-INF/MANIFEST.MF > $(out)", |
Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | java_binary_host { |
| 95 | name: "guice_munge", |
| 96 | srcs: [":guice_munge_srcjar"], |
| 97 | manifest: ":guice_munge_manifest", |
| 98 | libs: ["junit"], |
| 99 | } |
| 100 | |
| 101 | genrule { |
| 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 Cross | bdaef22 | 2019-01-14 16:41:18 -0800 | [diff] [blame] | 111 | " $(location guice_munge) -DNO_AOP $${src} > $(genDir)/$${src} || exit 1; " + |
Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 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 | |
| 118 | java_library_static { |
| 119 | name: "guice", |
Dan Shi | 1afd1b1 | 2021-11-30 10:11:31 -0800 | [diff] [blame] | 120 | visibility: [ |
| 121 | "//external/testng:__pkg__", |
| 122 | "//platform_testing/libraries/audio-test-harness/server:__pkg__", |
| 123 | "//tools/tradefederation/core:__pkg__", |
| 124 | ], |
Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 125 | host_supported: true, |
| 126 | hostdex: true, |
Jiyong Park | cd79069 | 2018-01-31 10:56:27 +0900 | [diff] [blame] | 127 | sdk_version: "core_current", |
Colin Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 128 | srcs: [":guice_munged_srcs"], |
| 129 | static_libs: [ |
| 130 | "guava", |
| 131 | "jsr330", |
| 132 | ], |
| 133 | } |
| 134 | |
Julien Desprez | 4545ec5 | 2018-08-28 14:49:08 -0700 | [diff] [blame] | 135 | // Variation that doesn't link guava statically |
| 136 | java_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 Cross | 61ebe08 | 2017-12-08 13:54:03 -0800 | [diff] [blame] | 150 | // TODO: Consider adding tests. |