annotate make/BuildNashorn.gmk @ 47398:1fd27535bc57

8182285: Speeding up incremental build by hashing module APIs Reviewed-by: ihse Contributed-by: jan.lahoda@oracle.com, erik.joelsson@oracle.com
author erikj
date Fri, 20 Oct 2017 13:33:35 +0200
parents 6b3389375f31
children
rev   line source
jlaskey@16198 1 #
ihse@43554 2 # Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
jlaskey@16198 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jlaskey@16198 4 #
jlaskey@16198 5 # This code is free software; you can redistribute it and/or modify it
jlaskey@16198 6 # under the terms of the GNU General Public License version 2 only, as
jlaskey@16198 7 # published by the Free Software Foundation. Oracle designates this
jlaskey@16198 8 # particular file as subject to the "Classpath" exception as provided
jlaskey@16198 9 # by Oracle in the LICENSE file that accompanied this code.
jlaskey@16198 10 #
jlaskey@16198 11 # This code is distributed in the hope that it will be useful, but WITHOUT
jlaskey@16198 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jlaskey@16198 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jlaskey@16198 14 # version 2 for more details (a copy is included in the LICENSE file that
jlaskey@16198 15 # accompanied this code).
jlaskey@16198 16 #
jlaskey@16198 17 # You should have received a copy of the GNU General Public License version
jlaskey@16198 18 # 2 along with this work; if not, write to the Free Software Foundation,
jlaskey@16198 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jlaskey@16198 20 #
jlaskey@16198 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jlaskey@16198 22 # or visit www.oracle.com if you need additional information or have any
jlaskey@16198 23 # questions.
jlaskey@16198 24 #
jlaskey@16198 25
jlaskey@16198 26 # This must be the first rule
jlaskey@16198 27 default: all
jlaskey@16198 28
erikj@41240 29 include $(SPEC)
jlaskey@16198 30 include MakeBase.gmk
ihse@33535 31 include JarArchive.gmk
jlaskey@16198 32 include JavaCompilation.gmk
erikj@26892 33 include SetupJavaCompilers.gmk
ihse@34020 34 include TextFileProcessing.gmk
erikj@47217 35 include Modules.gmk
jlaskey@16198 36
ihse@32526 37 JDK_CLASSES := $(call PathList, $(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
attila@34447 38 java.base java.logging java.scripting jdk.dynalink)))
jlaskey@16198 39
attila@29134 40 # Need to use source and target 8 for nasgen to work.
ihse@43554 41 $(eval $(call SetupJavaCompiler, GENERATE_NEWBYTECODE_DEBUG, \
erikj@41240 42 JVM := $(JAVA_JAVAC), \
ihse@20576 43 JAVAC := $(NEW_JAVAC), \
ihse@47274 44 FLAGS := -g -source 10 -target 10 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
erikj@47217 45 --system none --module-source-path $(call GetModuleSrcPath), \
ihse@20576 46 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
ihse@20576 47 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
jlaskey@16198 48
jlaskey@16198 49 # Build nashorn into intermediate directory
sundar@32152 50 # Name the compilation setup the same as the module, as is done in the global
sundar@32152 51 # CompileJavaModules.gmk, to make dependency checking with other modules work
sundar@32152 52 # seamlessly.
ihse@43554 53 $(eval $(call SetupJavaCompilation, jdk.scripting.nashorn, \
ihse@20576 54 SETUP := GENERATE_NEWBYTECODE_DEBUG, \
alanb@36517 55 MODULE := jdk.scripting.nashorn, \
erikj@47217 56 SRC := $(TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
ihse@20576 57 COPY := .properties .js, \
erikj@47398 58 BIN := $(SUPPORT_OUTPUTDIR)/special_classes, \
erikj@47398 59 CREATE_API_DIGEST := true, \
erikj@47398 60 ))
erikj@47398 61
erikj@47398 62 # Declare dependencies between java compilations of different modules.
erikj@47398 63 # Since the other modules are declared in different invocations of this file,
erikj@47398 64 # use the macro to find the correct target file to depend on.
erikj@47398 65 # Only the javac compilation actually depends on other modules so limit
erikj@47398 66 # dependency declaration to that by using the *_COMPILE_TARGET variable.
erikj@47398 67 $(jdk.scripting.nashorn_COMPILE_TARGET): $(foreach d, $(call FindDepsForModule, jdk.scripting.nashorn), \
erikj@47398 68 $(call SetupJavaCompilationApiTarget, $d, \
erikj@47398 69 $(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
jlaskey@16198 70
erikj@47217 71 NASGEN_SRC := $(TOPDIR)/make/nashorn/buildtools/nasgen/src
erikj@47217 72 ASM_SRC := $(TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
sundar@16265 73
jlaskey@16198 74 # Build nasgen
ihse@43554 75 $(eval $(call SetupJavaCompilation, BUILD_NASGEN, \
erikj@26892 76 SETUP := GENERATE_OLDBYTECODE, \
ihse@20576 77 SRC := $(NASGEN_SRC) $(ASM_SRC), \
alanb@36517 78 BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes))
jlaskey@16198 79
chegar@25865 80 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
chegar@25865 81 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
chegar@25865 82
erikj@47364 83 NASGEN_OPTIONS := \
erikj@47364 84 -cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
erikj@47364 85 --patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
erikj@47364 86 --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
erikj@47364 87 --add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
erikj@47364 88 #
alanb@36517 89
jlaskey@16198 90 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
alanb@36517 91 $(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
jlaskey@16198 92 $(ECHO) Running nasgen
jlaskey@16198 93 $(MKDIR) -p $(@D)
jlaskey@16198 94 $(RM) -rf $(@D)/jdk $(@D)/netscape
alanb@36517 95 $(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/* $(@D)/
erikj@41240 96 $(JAVA_SMALL) $(NASGEN_OPTIONS) \
ihse@20576 97 jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
jlaskey@16198 98 $(TOUCH) $@
jlaskey@16198 99
jlaskey@16198 100 # Version file needs to be processed with version numbers
ihse@34020 101 $(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
erikj@47217 102 SOURCE_FILES := $(TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
ihse@34020 103 OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
ihse@34020 104 REPLACEMENTS := \
ihse@34020 105 @@VERSION_STRING@@ => $(VERSION_STRING) ; \
ihse@34020 106 @@VERSION_SHORT@@ => $(VERSION_SHORT) , \
ihse@34020 107 ))
ihse@20576 108
ihse@34020 109 # Version processing needs to happen after nasgen run since nasgen run deletes it
ihse@34020 110 $(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
jlaskey@16198 111
ihse@43554 112 compile: $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE)
ihse@43554 113 all: compile
ihse@20576 114
chegar@25865 115 .PHONY: compile all