jdk/makefiles/CompileJavaClasses.gmk

Print this page

        

@@ -275,10 +275,21 @@
      # EXCLUDES+= tests/java/com/apple/jobjc
 
      EXCLUDES+= com/apple/jobjc
 endif
 
+# The security classes should not end up in the classes directory as that will prevent them
+# from working when running the exploded jdk image. Compile them separately to a different
+# directory from where the jars can be created.
+SECURITY_PKGS := sun/security/pkcs11 \
+                 com/sun/crypto/provider \
+                 javax/crypto \
+                 sun/security/internal \
+                 sun/security/mscapi \
+                 com/oracle/security/ucrypto \
+                 sun/security/ec
+
 # The exception handling of swing beaninfo
 # These resources violates the convention of having code and resources together under
 # $(JDK_TOPDIR)/src/.../classes directories
 $(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/tools/swing-beans/beaninfo/images/%.gif
         $(call install-file)

@@ -287,26 +298,50 @@
 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 # be recompiled. If multiple paths are separated by comma, convert that into a
 # space separated list.
 JDK_USER_DEFINED_FILTER:=$(strip $(subst $(COMMA),$(SPACE),$(JDK_FILTER)))
 
+ifeq ($(ENABLE_SJAVAC),yes)
+    # With sjavac enabled, excluded sources are not even considered for linking. 
+    # Explicitly add the security sources to sourcepath for linking.
+    BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
+                        -sourcepath $(JDK_TOPDIR)/src/share/classes
+endif
+
 $(eval $(call SetupJavaCompilation,BUILD_JDK,\
                 SETUP:=GENERATE_JDKBYTECODE,\
                 SRC:=$(JDK_TOPDIR)/src/share/classes \
                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
                      $(MACOSX_SRC_DIRS) \
                      $(JDK_OUTPUTDIR)/gensrc \
                      $(JDK_OUTPUTDIR)/gensrc_no_srczip \
                      $(CLOSED_SRC_DIRS),\
                 INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
-                EXCLUDES:=$(EXCLUDES),\
+                EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
                 EXCLUDE_FILES:=$(EXFILES),\
                 BIN:=$(JDK_OUTPUTDIR)/classes,\
                 COPY:=$(COPY_PATTERNS),\
                 COPY_FILES:=$(COPY_FILES),\
+                HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
+                ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
+
+##########################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_SECURITY,\
+                SETUP:=GENERATE_JDKBYTECODE,\
+                SRC:=$(JDK_TOPDIR)/src/share/classes \
+                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
+                     $(MACOSX_SRC_DIRS) \
+                     $(CLOSED_SRC_DIRS),\
+                INCLUDES:=$(SECURITY_PKGS),\
+                EXCLUDES:=$(EXCLUDES),\
+                EXCLUDE_FILES:=$(EXFILES),\
+                BIN:=$(JDK_OUTPUTDIR)/classes_security,\
                 HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers))
 
+$(BUILD_SECURITY): $(BUILD_JDK)
+
 ##########################################################################################
 
 ifndef OPENJDK
 
     $(eval $(call SetupJavaCompilation,BUILD_ALTCLASSES,\

@@ -400,11 +435,12 @@
 endif
 endif
 
 ##########################################################################################
 
-all: $(BUILD_JDK) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
+all: $(BUILD_JDK) $(BUILD_SECURITY) $(BUILD_ALTCLASSES) $(BUILD_JOBJC) \
+        $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
         $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
         $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
         $(BUILD_ACCESSBRIDGE_LEGACY)
 
 .PHONY: all