common/makefiles/JavaCompilation.gmk

Print this page

        

@@ -92,10 +92,11 @@
     $(if $5,$1_$(strip $5))
     $(if $6,$1_$(strip $6))
     $(if $7,$1_$(strip $7))
     $(if $8,$1_$(strip $8))
     $(if $9,$1_$(strip $9))
+    $(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
 
     ifeq ($$($1_MODE),MULTI_CORE_CONCURRENT)
         ifneq (,$$($1_SERVER_DIR))
             # A javac server has been requested.
             # The port file contains the tcp/ip on which the server listens

@@ -128,10 +129,11 @@
     #    JARMAIN:=Optional main class to add to manifest
     #    JARINDEX := 
     #    SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically 
     #                  added to the archive.
     #    EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
+    #    CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
     $(if $3,$1_$(strip $3))
     $(if $4,$1_$(strip $4))
     $(if $5,$1_$(strip $5))
     $(if $6,$1_$(strip $6))
     $(if $7,$1_$(strip $7))

@@ -141,10 +143,11 @@
     $(if $(11),$1_$(strip $(11)))
     $(if $(12),$1_$(strip $(12)))
     $(if $(13),$1_$(strip $(13)))
     $(if $(14),$1_$(strip $(14)))
     $(if $(15),$1_$(strip $(15)))
+    $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
 
     $1_JARMAIN:=$(strip $$($1_JARMAIN))
     $1_JARNAME:=$$(notdir $$($1_JAR))
     $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
     $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess

@@ -241,10 +244,20 @@
     $1_TOUCH_API_FILES=$$(foreach src,$$($1_SRCS),\
                     ($(FIND) $$(src) -name _the.package.api -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) && \
                     ($(FIND) $$(src) -name _the.package -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) &&)
     # Use a slightly shorter name for logging, but with enough path to identify this jar.
     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
+
+    ifneq (,$$($1_CHECK_COMPRESS_JAR))
+        $1_JAR_CREATE_OPTIONS := c0fm
+        ifeq ($(COMPRESS_JARS), true)
+            $1_JAR_CREATE_OPTIONS := cfm
+        endif
+    else
+        $1_JAR_CREATE_OPTIONS := cfm
+    endif
+
     # Here is the rule that creates/updates the jar file.
     $$($1_JAR) : $2 $$($1_ALL_SRC)
         $(MKDIR) -p $$($1_BIN)
         if [ -n "$$($1_MANIFEST)" ]; then \
                 $(SED) -e "s#@@RELEASE@@#$(RELEASE)#"           \

@@ -281,11 +294,11 @@
                         $$($1_JARINDEX) && \
                         $$($1_TOUCH_API_FILES) true && \
                         $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
                 fi ; \
         else \
-                $(ECHO) Creating $$($1_NAME) && $(JAR) cfm $$@ $$($1_MANIFEST_FILE) && \
+                $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \
                 $$($1_SCAPTURE_CONTENTS) \
                 $$($1_SCAPTURE_METAINF) \
                 $$($1_SUPDATE_CONTENTS) \
                 $$($1_JARINDEX) && \
                 $$($1_TOUCH_API_FILES) true && \

@@ -309,10 +322,11 @@
     $(if $5,$1_$(strip $5))
     $(if $6,$1_$(strip $6))
     $(if $7,$1_$(strip $7))
     $(if $8,$1_$(strip $8))
     $(if $9,$1_$(strip $9))
+    $(if $(10),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
 
     # Find all files in the source tree.
     $1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES))
     $1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*" \( -name FALSE_DUMMY  $$($1_SUFFIX_FILTER) \) ))
 

@@ -646,10 +660,11 @@
     $(if $(10),$1_$(strip $(10)))
     $(if $(11),$1_$(strip $(11)))
     $(if $(12),$1_$(strip $(12)))
     $(if $(13),$1_$(strip $(13)))
     $(if $(14),$1_$(strip $(14)))
+    $(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
 
 # Extract the info from the java compiler setup.
 $1_MODE := $$($$($1_SETUP)_MODE)
 ifneq (SINGLE_THREADED_BATCH,$$($1_MODE))
     ifneq (MULTI_CORE_CONCURRENT,$$($1_MODE))

@@ -686,10 +701,16 @@
 $1_BINS     := $$(shell $(FIND) $$($1_BIN) -name "*.class")
 
 # Now we have a list of all java files to compile: $$($1_SRCS)
 # and we have a list of all existing class files: $$($1_BINS)
 
+# Create the corresponding smart javac wrapper command line.
+$1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \
+$$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \
+$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \
+$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) -src $$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))
+
 # Prepend the source/bin path to the filter expressions.
 ifneq ($$($1_INCLUDES),)
   $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
   $1_PKG_INCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_INCLUDES)))
   $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_INCLUDES)))

@@ -797,10 +818,16 @@
     $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
         $(MKDIR) -p $$(@D)
         $(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
         $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
         $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1
+ifeq ($$($1_NOSJAVAC),)
+ifeq ($$(ENABLE_SJAVAC),yes)
+        mkdir -p $$($1_BIN)_sjavac
+        $$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.javac.smart.Main $$($1_SJAVAC_ARGS) -mfl $$($1_BIN)/_the.batch.tmp -d $$($1_BIN)_sjavac
+endif
+endif
         ($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
          $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
 else
     # Ok, we have a modern javac server running!
     # Since a single Java file can generate zero to an infinity number of .class files

@@ -888,7 +915,5 @@
                 EXCLUDES:=$$($1_EXCLUDES),\
                 EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
 endif
 
 endef
-
-