common/makefiles/JavaCompilation.gmk

Print this page




 233                 $$($1_CAPTURE_DELETES) \
 234                 $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE)\
 235                 if [ -s $$($1_DELETESS_FILE) ]; then \
 236                         $(ECHO) "  deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
 237                                $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
 238                 fi $$(NEWLINE) \
 239                 $$($1_UPDATE_CONTENTS) true $$(NEWLINE) \
 240                 $$($1_JARINDEX) && true \
 241         ,\
 242                 $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
 243                 $$($1_SCAPTURE_CONTENTS) \
 244                 $$($1_SCAPTURE_METAINF) \
 245                 $$($1_SUPDATE_CONTENTS) \
 246                 $$($1_JARINDEX) && true ) 
 247 
 248 endef
 249 
 250 define SetupZipArchive
 251     # param 1 is for example ZIP_MYSOURCE
 252     # param 2,3,4,5,6,7,8,9 are named args.
 253     #    SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
 254     $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
 255     $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
 256     $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
 257 
 258     # Find all files in the source tree.
 259     $1_ALL_SRCS := $$(call not-containing,_the.,\
 260             $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind $$($1_SRC))))
 261 
 262     ifneq ($$($1_INCLUDES),)
 263         $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
 264         ifneq ($$($1_SUFFIXES),)
 265             $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\
 266                 $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
 267         else
 268             $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
 269         endif






 270         $1_ALL_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
 271     endif
 272     ifneq ($$($1_EXCLUDES),)
 273         $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
 274         $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
 275         $1_ALL_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
 276     endif
 277 
 278     # Use a slightly shorter name for logging, but with enough path to identify this zip.
 279     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
 280 
 281     # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
 282     # I.e. the zip -i and -x options should match the filtering done in the makefile.
 283     # Explicitly excluded files can be given with absolute path. The patsubst solution
 284     # isn't perfect but the likelyhood of an absolute path to match something in a src
 285     # dir is very small.
 286     # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
 287     # and only fail if it's not.
 288     $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 289                 $(MKDIR) -p $$(@D)




 233                 $$($1_CAPTURE_DELETES) \
 234                 $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) $$(NEWLINE)\
 235                 if [ -s $$($1_DELETESS_FILE) ]; then \
 236                         $(ECHO) "  deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
 237                                $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
 238                 fi $$(NEWLINE) \
 239                 $$($1_UPDATE_CONTENTS) true $$(NEWLINE) \
 240                 $$($1_JARINDEX) && true \
 241         ,\
 242                 $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
 243                 $$($1_SCAPTURE_CONTENTS) \
 244                 $$($1_SCAPTURE_METAINF) \
 245                 $$($1_SUPDATE_CONTENTS) \
 246                 $$($1_JARINDEX) && true ) 
 247 
 248 endef
 249 
 250 define SetupZipArchive
 251     # param 1 is for example ZIP_MYSOURCE
 252     # param 2,3,4,5,6,7,8,9 are named args.
 253     #    SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
 254     $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
 255     $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
 256     $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
 257 
 258     # Find all files in the source tree.
 259     $1_ALL_SRCS := $$(call not-containing,_the.,\
 260             $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind $$($1_SRC))))
 261 
 262     ifneq ($$($1_INCLUDES),)
 263         $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
 264         ifneq ($$($1_SUFFIXES),)
 265             $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\
 266                 $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
 267         else
 268             $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
 269         endif
 270     endif
 271     ifneq ($$($1_INCLUDE_FILES),)
 272         $1_SRC_INCLUDES += $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
 273         $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
 274     endif
 275     ifneq ($$($1_SRC_INCLUDES),)
 276         $1_ALL_SRCS     := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
 277     endif
 278     ifneq ($$($1_EXCLUDES),)
 279         $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
 280         $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
 281         $1_ALL_SRCS     := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
 282     endif
 283 
 284     # Use a slightly shorter name for logging, but with enough path to identify this zip.
 285     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
 286 
 287     # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
 288     # I.e. the zip -i and -x options should match the filtering done in the makefile.
 289     # Explicitly excluded files can be given with absolute path. The patsubst solution
 290     # isn't perfect but the likelyhood of an absolute path to match something in a src
 291     # dir is very small.
 292     # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
 293     # and only fail if it's not.
 294     $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 295                 $(MKDIR) -p $$(@D)