javaw: add possibility to enable recurse use also globally via env variable

This commit is contained in:
fedepell 2018-12-14 05:50:27 +01:00
parent ce8d103cf4
commit 9cd14427c1
2 changed files with 12 additions and 4 deletions

View File

@ -10,13 +10,16 @@
# a project with many java artifacts and complex dependencies a manual # a project with many java artifacts and complex dependencies a manual
# management may be expensive. # management may be expensive.
# #
# By setting recurse_use to True the recursive behaviour is enabled. # By setting recurse_use to True (or build wise by setting RECURSE_JAVA env
# variable to True) the recursive behaviour is enabled.
# #
# Directory d tests the case when recursion stops earlier since # Directory d tests the case when recursion stops earlier since
# a dependency is already explicitly defined # a dependency is already explicitly defined
def configure(conf): def configure(conf):
conf.load('java') conf.load('java')
# For build wide enabling:
# conf.env.RECURSE_JAVA = True
def build(bld): def build(bld):
bld.recurse('a b c d') bld.recurse('a b c d')

View File

@ -99,9 +99,14 @@ and then NNN can be freely used in rules as:
In the java tool the dependencies via use are not transitive by default, as In the java tool the dependencies via use are not transitive by default, as
this necessity depends on the code. To enable recursive dependency scanning this necessity depends on the code. To enable recursive dependency scanning
use: use on a specific rule:
recurse_use = True recurse_use = True
Or build wise by setting the RECURSE_JAVA environment variable to True:
bld.env.RECURSE_JAVA = True
Unit tests can be integrated in the waf unit test environment using the Unit tests can be integrated in the waf unit test environment using the
javatest extra. javatest extra.
@ -240,8 +245,8 @@ def use_javac_files(self):
for tsk in y.tasks: for tsk in y.tasks:
self.javac_task.set_run_after(tsk) self.javac_task.set_run_after(tsk)
# If recurse_use then recursively add use attribute for each used one # If recurse use scan is enabled recursively add use attribute for each used one
if getattr(self, 'recurse_use', False): if getattr(self, 'recurse_use', False) or self.bld.env.RECURSE_JAVA:
self.java_use_rec(x) self.java_use_rec(x)
self.env.append_value('CLASSPATH', self.use_lst) self.env.append_value('CLASSPATH', self.use_lst)