aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-12-08 13:54:03 -0800
committerColin Cross <ccross@android.com>2017-12-11 16:28:52 -0800
commit61ebe08ef0132f4df784be476c18dbcf76e16a2c (patch)
tree45b6579a73b378332ffc4e3d92493e70d70daa20
parent2f4c6dfce39d38e64a6e4993a808270e16d7dc1b (diff)
downloadguice-61ebe08ef0132f4df784be476c18dbcf76e16a2c.tar.gz
Convert external/guice to Android.bpandroid-wear-8.0.0_r1
See build/soong/README.md for more information. Test: m checkbuild Change-Id: I71ca0c253d06b4bdda5205083ae39e876fadfadb
-rw-r--r--Android.bp106
-rw-r--r--Android.mk132
-rw-r--r--AndroidCallMunge.mk42
3 files changed, 106 insertions, 174 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..1cd42f31
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,106 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+//
+// Build support for guice within the Android Open Source Project
+// See https://source.android.com/source/building.html for more information
+//
+
+//##################################
+// Guice #
+//##################################
+
+//
+// Builds the 'no_aop' flavor for Android.
+// -- see core/pom.xml NO_AOP rule.
+//
+
+filegroup {
+ name: "guice_srcs",
+ srcs: ["core/src/**/*.java"],
+ exclude_srcs: [
+ "core/src/com/google/inject/spi/InterceptorBinding.java",
+ "core/src/com/google/inject/internal/InterceptorBindingProcessor.java",
+ "core/src/com/google/inject/internal/InterceptorStackCallback.java",
+ "core/src/com/google/inject/internal/InterceptorStackCallback.java",
+ "core/src/com/google/inject/internal/util/LineNumbers.java",
+ "core/src/com/google/inject/internal/MethodAspect.java",
+ "core/src/com/google/inject/internal/ProxyFactory.java",
+ ],
+}
+
+filegroup {
+ name: "guice_test_src_files",
+ srcs: ["core/test/**/*.java"],
+ exclude_srcs: [
+ "core/test/com/googlecode/guice/BytecodeGenTest.java",
+ "core/test/com/google/inject/IntegrationTest.java",
+ "core/test/com/google/inject/MethodInterceptionTest.java",
+ "core/test/com/google/inject/internal/ProxyFactoryTest.java",
+ ],
+}
+
+// Copy munge.jar to a srcjar.
+// Remove MungeTask.java, which is missing ant dependencies in Android.
+genrule {
+ name: "guice_munge_srcjar",
+ out: ["guice_munge.srcjar"],
+ srcs: ["lib/build/munge.jar"],
+ cmd: "zip $(in) -O $(out) -d MungeTask.java",
+}
+
+genrule {
+ name: "guice_munge_manifest",
+ out: ["guice_munge.manifest"],
+ srcs: ["lib/build/munge.jar"],
+ cmd: "unzip -qc $(in) META-INF/MANIFEST.MF > $(out)",
+}
+
+java_binary_host {
+ name: "guice_munge",
+ srcs: [":guice_munge_srcjar"],
+ manifest: ":guice_munge_manifest",
+ libs: ["junit"],
+}
+
+genrule {
+ name: "guice_munged_srcs",
+ srcs: [":guice_srcs"],
+ out: ["guice_munged_srcs.srcjar"],
+ tools: [
+ "guice_munge",
+ "soong_zip",
+ ],
+ cmd: "for src in $(in); do " +
+ " mkdir -p $$(dirname $(genDir)/$${src}) && " +
+ " $(location guice_munge) -DNO_AOP $${src} > $(genDir)/$${src}; " +
+ " done && " +
+ " $(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
+}
+
+// Target-side Dalvik, host-side, and host-side Dalvik build
+
+java_library_static {
+ name: "guice",
+ host_supported: true,
+ hostdex: true,
+ srcs: [":guice_munged_srcs"],
+ static_libs: [
+ "guava",
+ "jsr330",
+ ],
+}
+
+// TODO: Consider adding tests.
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index b45bc715..00000000
--- a/Android.mk
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Build support for guice within the Android Open Source Project
-# See https://source.android.com/source/building.html for more information
-#
-
-###################################
-# Guice #
-###################################
-
-#
-# Builds the 'no_aop' flavor for Android.
-# -- see core/pom.xml NO_AOP rule.
-#
-guice_exclude_src_files := \
- core/src/com/google/inject/spi/InterceptorBinding.java \
- core/src/com/google/inject/internal/InterceptorBindingProcessor.java \
- core/src/com/google/inject/internal/InterceptorStackCallback.java \
- core/src/com/google/inject/internal/InterceptorStackCallback.java \
- core/src/com/google/inject/internal/util/LineNumbers.java \
- core/src/com/google/inject/internal/MethodAspect.java \
- core/src/com/google/inject/internal/ProxyFactory.java
-
-guice_exclude_test_files := \
- core/test/com/googlecode/guice/BytecodeGenTest.java \
- core/test/com/google/inject/IntegrationTest.java \
- core/test/com/google/inject/MethodInterceptionTest.java \
- core/test/com/google/inject/internal/ProxyFactoryTest.java
-
-guice_munge_flags := \
- -DNO_AOP
-#
-#
-#
-
-LOCAL_PATH := $(call my-dir)
-
-guice_src_files_raw := $(call all-java-files-under,core/src)
-guice_test_files_raw := $(call all-java-files-under,core/test)
-guice_src_files := $(filter-out $(guice_exclude_src_files),$(guice_src_files_raw))
-guice_test_files := $(filter-out $(guice_exclude_test_files),$(guice_test_files_raw))
-munge_host_jar := $(HOST_OUT)/framework/munge-host.jar
-munge_zip_location := lib/build/munge.jar
-
-#
-# Target-side Dalvik build
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := # None. Everything is post-processed by munge. See below.
-LOCAL_MODULE := guice
-LOCAL_STATIC_JAVA_LIBRARIES := guava jsr330
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-munge_src_arguments := $(guice_src_files)
-include $(LOCAL_PATH)/AndroidCallMunge.mk
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-#
-# Host-side Java build
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := # None. Everything is post-processed by munge. See below.
-LOCAL_MODULE := guice-host
-LOCAL_STATIC_JAVA_LIBRARIES := guavalib jsr330-host
-
-munge_src_arguments := $(guice_src_files)
-include $(LOCAL_PATH)/AndroidCallMunge.mk
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-
-#
-# Host-side Dalvik build
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := # None. Everything is post-processed by munge. See below.
-LOCAL_MODULE := guice-hostdex
-LOCAL_STATIC_JAVA_LIBRARIES := guava-hostdex jsr330-hostdex
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-munge_src_arguments := $(guice_src_files)
-include $(LOCAL_PATH)/AndroidCallMunge.mk
-include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY)
-
-###################################
-# Munge #
-###################################
-
-# This is required to post-process the guice source to strip out the AOP-specific code.
-# We build it from source (conveniently zipped inside of lib/build/munge.jar) instead
-# of relying on a prebuilt.
-
-munge_zipped_src_files_raw := $(filter %.java,$(shell unzip -Z1 "$(LOCAL_PATH)/$(munge_zip_location)"))
-munge_zipped_unsupported_files := MungeTask.java # Missing ant dependencies in Android.
-munge_zipped_src_files := $(filter-out $(munge_zipped_unsupported_files),$(munge_zipped_src_files_raw))
-
-#
-# We build munge from lib/build/munge.jar source code.
-#
-
-# (Munge) Host-side Java build
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := # None because we get everything by unzipping the munge jar first.
-LOCAL_MODULE := munge-host
-LOCAL_JAVA_LIBRARIES := junit-host
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-# Unzip munge and build it
-intermediates:= $(local-generated-sources-dir)
-GEN := $(addprefix $(intermediates)/, $(munge_zipped_src_files)) # List of all files that need to be patched.
-$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
-$(GEN) : PRIVATE_INPUT_FILE := $(munge_zipped_src_files)
-$(GEN) : PRIVATE_ZIP_LOCATION := $(munge_zip_location)
-$(GEN) : PRIVATE_CUSTOM_TOOL = unzip -p "$(PRIVATE_PATH)/$(PRIVATE_ZIP_LOCATION)" $(shell echo $@ | awk -F / "{if (NF>1) {print \$$NF}}") >$@ ## unzip -p munge.jar Filename.java > intermediates/Filename.java
-$(GEN): $(intermediates)/%.java : $(LOCAL_PATH)/$(PRIVATE_ZIP_LOCATION)
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-
-# Rules for target, hostdex, etc., are omitted since munge is only used during the build.
-
-# TODO: Consider adding tests.
diff --git a/AndroidCallMunge.mk b/AndroidCallMunge.mk
deleted file mode 100644
index 404abf86..00000000
--- a/AndroidCallMunge.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Build support for guice within the Android Open Source Project
-# See https://source.android.com/source/building.html for more information
-#
-
-# Factored-out implementation of calling munge to post-process guice java files.
-#
-# Arguments:
-# (Constant)
-# munge_host_jar = Path to munge-host.jar (built by munge-host rule)
-# munge_zip_location = Path to lib/build/munge.jar source archive
-# (Varying)
-# munge_src_arguments = List of files that need to be munged
-# guice_munge_flags = List of flags to pass to munge (e.g. guice_munge_flags := -DNO_AOP)
-#
-
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-# Run munge over every single java file.
-intermediates:= $(local-generated-sources-dir)
-GEN := $(addprefix $(intermediates)/, $(munge_src_arguments)) # List of all files that need to be munged.
-$(GEN) : PRIVATE_ZIP_LOCATION := $(munge_zip_location)
-$(GEN) : PRIVATE_HOST_JAR := $(munge_host_jar)
-$(GEN) : PRIVATE_MUNGE_FLAGS := $(guice_munge_flags)
-$(GEN) : PRIVATE_CUSTOM_TOOL = java -cp $(PRIVATE_HOST_JAR) Munge $(PRIVATE_MUNGE_FLAGS) $< > $@
-$(GEN): $(intermediates)/%.java : $(LOCAL_PATH)/%.java $(LOCAL_PATH)/$(munge_zip_location) $(munge_host_jar)
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)