blob: 404abf867385b35201ecc7d80e132974eb4ebde9 [file] [log] [blame]
Igor Murashkin34a08fb2016-03-16 12:03:09 -07001# 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# Factored-out implementation of calling munge to post-process guice java files.
22#
23# Arguments:
24# (Constant)
25# munge_host_jar = Path to munge-host.jar (built by munge-host rule)
26# munge_zip_location = Path to lib/build/munge.jar source archive
27# (Varying)
28# munge_src_arguments = List of files that need to be munged
29# guice_munge_flags = List of flags to pass to munge (e.g. guice_munge_flags := -DNO_AOP)
30#
31
32LOCAL_MODULE_CLASS := JAVA_LIBRARIES
33# Run munge over every single java file.
34intermediates:= $(local-generated-sources-dir)
35GEN := $(addprefix $(intermediates)/, $(munge_src_arguments)) # List of all files that need to be munged.
36$(GEN) : PRIVATE_ZIP_LOCATION := $(munge_zip_location)
37$(GEN) : PRIVATE_HOST_JAR := $(munge_host_jar)
38$(GEN) : PRIVATE_MUNGE_FLAGS := $(guice_munge_flags)
39$(GEN) : PRIVATE_CUSTOM_TOOL = java -cp $(PRIVATE_HOST_JAR) Munge $(PRIVATE_MUNGE_FLAGS) $< > $@
40$(GEN): $(intermediates)/%.java : $(LOCAL_PATH)/%.java $(LOCAL_PATH)/$(munge_zip_location) $(munge_host_jar)
41 $(transform-generated-source)
42LOCAL_GENERATED_SOURCES += $(GEN)