@@ -402,8 +402,10 @@ define SetupJavaCompilationBody
402
402
403
403
$1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
404
404
$1_FILELIST := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch.filelist
405
+ $1_MODFILELIST := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch.modfiles
405
406
406
407
$1_API_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi
408
+ $1_API_INTERNAL := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_internalapi
407
409
408
410
# Put headers in a temp dir to filter out those that actually
409
411
# changed before copying them to the real header dir.
@@ -437,6 +439,8 @@ define SetupJavaCompilationBody
437
439
$1_API_DIGEST_FLAGS := \
438
440
-classpath $$(BUILDTOOLS_OUTPUTDIR)/depend \
439
441
-Xplugin:"depend $$($1_API_TARGET)" \
442
+ "-XDinternalAPIPath=$$($1_API_INTERNAL)" \
443
+ "-XDLOG_LEVEL=$(LOG_LEVEL)" \
440
444
#
441
445
442
446
$1_EXTRA_DEPS := $$(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
@@ -447,16 +451,33 @@ define SetupJavaCompilationBody
447
451
# list of files.
448
452
$$($1_FILELIST): $$($1_SRCS) $$($1_VARDEPS_FILE)
449
453
$$(call MakeDir, $$(@D))
450
- $$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
454
+ $$(call LogWarn, Compiling up to $$(words $$($1_SRCS)) files for $1)
451
455
$$(eval $$(call ListPathsSafely, $1_SRCS, $$($1_FILELIST)))
452
456
457
+ # Create a $$($1_MODFILELIST) file with significant modified dependencies
458
+ # (either sources files or the other mark dependencies).
459
+ # It is then sent using a side-channel
460
+ # to the custom Depend plugin. The Depend plugin will check the provided list
461
+ # of modified files, and if none of the Java source files is changed in a way
462
+ # observable from outside of the file, and the list of modified files does
463
+ # not include a non-Java source file, it will only compile the modified files.
464
+ # Otherwise, all module's sources will be compiled. If a non-Java file is included,
465
+ # it will be considered to be a significant change, and all module source will
466
+ # be recompiled
467
+ $$($1_MODFILELIST): $$($1_SRCS) $$($1_DEPENDS) \
468
+ $$($1_VARDEPS_FILE) $$($1_EXTRA_DEPS) $$($1_JAVAC_SERVER_CONFIG)
469
+ $$(eval $1_MODFILES := $$?)
470
+ $$(eval $$(call ListPathsSafely, $1_MODFILES, $$($1_MODFILELIST)))
471
+
453
472
# Do the actual compilation
454
473
$$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_FILELIST) $$($1_DEPENDS) \
455
- $$($1_VARDEPS_FILE) $$($1_EXTRA_DEPS) $$($1_JAVAC_SERVER_CONFIG)
474
+ $$($1_VARDEPS_FILE) $$($1_EXTRA_DEPS) $$($1_JAVAC_SERVER_CONFIG) \
475
+ $$($1_MODFILELIST)
456
476
$$(call MakeDir, $$(@D))
457
477
$$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
458
478
$$($1_JAVAC_CMD) $$($1_FLAGS) \
459
479
$$($1_API_DIGEST_FLAGS) \
480
+ -XDmodifiedInputs=$$($1_MODFILELIST) \
460
481
-d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_FILELIST)) && \
461
482
$(TOUCH) $$@
462
483
0 commit comments