common/makefiles/JavaCompilation.gmk
Print this page
*** 500,555 ****
# Set the $1_REMOTE to spawn a background javac server.
$1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
$$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D)
! $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
$(ECHO) Compiling $1
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
-j $(JOBS) \
--permit-unidentified-artifacts \
--permit-sources-without-package \
! --compare-found-sources $$($1_BIN)/_the.batch.tmp \
--log=$(LOG_LEVEL) \
$$($1_SJAVAC_ARGS) \
$$($1_FLAGS) \
$$($1_HEADERS_ARG) \
-d $$($1_BIN) && \
! $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
else
# Using plain javac to batch compile everything.
! $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
# When buliding in batch, put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS).tmp
! $$($1_HEADERS)/_the.headers: $$($1_BIN)/_the.batch
$(MKDIR) -p $$(@D)
for f in `ls $$($1_HEADERS).tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).tmp/$$$$f $$($1_HEADERS)/$$$$f; \
fi; \
done
$(RM) -r $$($1_HEADERS).tmp
$(TOUCH) $$@
! $1 += $$($1_HEADERS)/_the.headers
endif
# When not using sjavac, pass along all sources to javac using an @file.
! $$($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 for $1
($$($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)
endif
# Check if a jar file was specified, then setup the rules for the jar.
ifneq (,$$($1_JAR))
--- 500,555 ----
# Set the $1_REMOTE to spawn a background javac server.
$1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
$$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D)
! $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
$(ECHO) Compiling $1
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
-j $(JOBS) \
--permit-unidentified-artifacts \
--permit-sources-without-package \
! --compare-found-sources $$($1_BIN)/_the.$1_batch.tmp \
--log=$(LOG_LEVEL) \
$$($1_SJAVAC_ARGS) \
$$($1_FLAGS) \
$$($1_HEADERS_ARG) \
-d $$($1_BIN) && \
! $(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
else
# Using plain javac to batch compile everything.
! $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.$1_batch
# When buliding in batch, put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS).tmp
! $$($1_HEADERS)/_the.$1_headers: $$($1_BIN)/_the.$1_batch
$(MKDIR) -p $$(@D)
for f in `ls $$($1_HEADERS).tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).tmp/$$$$f $$($1_HEADERS)/$$$$f; \
fi; \
done
$(RM) -r $$($1_HEADERS).tmp
$(TOUCH) $$@
! $1 += $$($1_HEADERS)/_the.$1_headers
endif
# When not using sjavac, pass along all sources to javac using an @file.
! $$($1_BIN)/_the.$1_batch: $$($1_SRCS) $$($1_DEPENDS)
$(MKDIR) -p $$(@D)
! $(RM) $$($1_BIN)/_the.$1_batch $$($1_BIN)/_the.$1_batch.tmp
! $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
! $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.$1_batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
-implicit:none -sourcepath "$$($1_SRCROOTSC)" \
! -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.$1_batch.tmp && \
! $(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
endif
# Check if a jar file was specified, then setup the rules for the jar.
ifneq (,$$($1_JAR))