forked from ibmruntimes/openj9-openjdk-jdk10
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8169069: Module system implementation refresh (11/2016)
Reviewed-by: alanb, mchung Contributed-by: [email protected], [email protected], [email protected], [email protected]
- Loading branch information
alanb
committed
Dec 1, 2016
1 parent
c58d341
commit bc1cda5
Showing
7 changed files
with
35 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,8 @@ TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) \ | |
|
||
################################################################################ | ||
|
||
# Name of data file. Keep module-info.java.ext until javafx has changed. | ||
MOD_FILENAME := module-info.java.extra module-info.java.ext | ||
# Name of modification file. | ||
MOD_FILENAME := module-info.java.extra | ||
|
||
# Construct all possible src directories for the module. | ||
MODULE_CLASSES_DIRS := $(call FindModuleSrcDirs, $(MODULE)) | ||
|
@@ -74,74 +74,24 @@ ifneq ($(MOD_FILES), ) | |
# Only make this call if modification files are found for this module | ||
ALL_MODULES := $(call FindAllModules) | ||
|
||
# Read the contents of all the files into a variable. Replace space with / to | ||
# let space represent new lines in the variable as $(shell) normalizes all | ||
# whitespace. | ||
$(foreach f, $(MOD_FILES), \ | ||
$(eval MOD_FILE_CONTENTS += $(shell $(GREP) -v -e ".\*" -e "//" $f | $(TR) ' ' '/'))) | ||
|
||
# Separate the modifications into qualified exports and the rest | ||
MODS_QUALIFIED_EXPORTS := $(call containing, /to/, $(MOD_FILE_CONTENTS)) | ||
MODS_REST := $(filter-out $(MODS_QUALIFIED_EXPORTS), $(MOD_FILE_CONTENTS)) | ||
|
||
# Filter the contents for modules that are actually being built | ||
ALL_MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES))) | ||
MODIFICATIONS := $(filter $(ALL_MODULES_FILTER), $(MODS_QUALIFIED_EXPORTS)) \ | ||
$(MODS_REST) | ||
|
||
# Returns non empty if the package exists in the current module | ||
# Param 1 - Name of package with dots | ||
PackageExists = \ | ||
$(strip $(wildcard $(addsuffix $(subst .,/,/$(strip $1)), \ | ||
$(MODULE_CLASSES_DIRS) \ | ||
$(addsuffix /$(MODULE), $(IMPORT_MODULES_CLASSES)) \ | ||
$(JDK_OUTPUTDIR)/modules/$(MODULE) \ | ||
))) | ||
|
||
# Convert the modification lines into arguments for the modification tool. | ||
# Filter out modifications for non existing to-modules. | ||
$(foreach line, $(MODIFICATIONS), \ | ||
$(eval split_line := $(subst /,$(SPACE),$(line))) \ | ||
$(eval command := $(word 1, $(split_line))) \ | ||
$(if $(filter $(command), exports), \ | ||
$(eval package := $(patsubst %;,%,$(word 2, $(split_line)))) \ | ||
$(if $(call PackageExists, $(package)), \ | ||
$(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \ | ||
$(if $(to_module), \ | ||
$(eval ARGS += -$(command) $(package)/$(to_module)) \ | ||
, \ | ||
$(eval ARGS += -$(command) $(package)) \ | ||
) \ | ||
) \ | ||
, \ | ||
$(if $(filter $(command), provides), \ | ||
$(eval provider := $(patsubst %;,%,$(word 2, $(split_line)))) \ | ||
$(eval class := $(patsubst %;,%,$(word 4, $(split_line)))) \ | ||
$(eval ARGS += -$(command) $(provider)/$(class)) \ | ||
, \ | ||
$(error A module-info.extra in $(MODULE) contains invalid command $(command)) \ | ||
) \ | ||
) \ | ||
) | ||
|
||
ifneq ($(ARGS), ) | ||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \ | ||
$(firstword $(call FindAllModuleInfos, $(MODULE))) \ | ||
$(BUILD_TOOLS_JDK) \ | ||
$(call DependOnVariable, ARGS) | ||
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java: \ | ||
$(firstword $(call FindAllModuleInfos, $(MODULE))) \ | ||
$(BUILD_TOOLS_JDK) \ | ||
$(MOD_FILES) \ | ||
$(call DependOnVariable, ALL_MODULES) | ||
$(MKDIR) -p $(@D) | ||
$(RM) $@ [email protected] | ||
$(TOOL_GENMODULEINFOSOURCE) $(ARGS) -o [email protected] $< | ||
$(TOOL_GENMODULEINFOSOURCE) -o [email protected] \ | ||
--source-file $< \ | ||
--modules $(call CommaList, $(ALL_MODULES)) \ | ||
$(MOD_FILES) | ||
$(MV) [email protected] $@ | ||
|
||
TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java | ||
endif | ||
|
||
endif | ||
TARGETS += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java | ||
|
||
# If no modifications are found for this module, remove any module-info.java | ||
# created by a previous build since that is no longer valid. | ||
ifeq ($(MODIFICATIONS), ) | ||
else | ||
# If no modifications are found for this module, remove any module-info.java | ||
# created by a previous build since that is no longer valid. | ||
ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java), ) | ||
$(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/module-info.java) | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters