2
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
################################################################################
27
# This file makes modifications to module-info.java files based on the build
30
# Depending on build platform, imported modules and optional parts of the build
31
# being active, some modules need to have extra exports, provides or uses
32
# declarations added to them. These optional extras are defined in .extra files:
34
# src/<module>/<share,platform>/classes/module-info.java.extra
36
# The contents of the .extra files are simply extra lines that could fit into
37
# the module-info file.
39
# This makefile is called once for each from-module with the variable
40
# MODULE naming the from-module.
42
# The modified module-info.java files are put in the gensrc directory where
43
# they will automatically override the static versions in the src tree.
45
################################################################################
53
################################################################################
54
# Define this here since jdk/make/Tools.gmk cannot be included from the top
55
# make directory. Should probably move some tools away from the jdk repo.
56
TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \
57
$(INTERIM_LANGTOOLS_ARGS) \
58
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes" \
59
build.tools.module.GenModuleInfoSource
61
################################################################################
63
# Name of modification file.
64
MOD_FILENAME := module-info.java.extra
66
# Construct all possible src directories for the module.
67
MODULE_CLASSES_DIRS := $(call FindModuleSrcDirs, $(MODULE))
69
# Find all the .extra files in the src dirs.
70
MOD_FILES := $(wildcard $(foreach f, $(MOD_FILENAME), $(addsuffix /$(f), \
71
$(MODULE_CLASSES_DIRS))))
74
# Only make this call if modification files are found for this module
75
ALL_MODULES := $(call FindAllModules)
77
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \
78
$(firstword $(call FindAllModuleInfos, $(MODULE))) \
81
$(call DependOnVariable, ALL_MODULES)
84
$(TOOL_GENMODULEINFOSOURCE) \
85
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true), -d) \
88
--modules $(call CommaList, $(ALL_MODULES)) \
92
TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java
95
# If no modifications are found for this module, remove any module-info.java
96
# created by a previous build since that is no longer valid.
97
ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), )
98
$(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java)
102
################################################################################