diff options
author | Steven Knight <knight@baldmt.com> | 2005-09-29 07:54:29 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-09-29 07:54:29 (GMT) |
commit | 6eccd4f877951395160ff171db5d52b31da0174e (patch) | |
tree | fa12d99dfce54651222419d19bf345f49177c5ea /test/Java | |
parent | 0d2cb0988d25be7125e27d4a7fa965c8ba04c585 (diff) | |
download | SCons-6eccd4f877951395160ff171db5d52b31da0174e.zip SCons-6eccd4f877951395160ff171db5d52b31da0174e.tar.gz SCons-6eccd4f877951395160ff171db5d52b31da0174e.tar.bz2 |
When building a .jar file and $JARCHDIR is set, prefix each .class file with the -C flag. (Kian Win Ong)
Diffstat (limited to 'test/Java')
-rw-r--r-- | test/Java/JARCHDIR.py | 68 | ||||
-rw-r--r-- | test/Java/JAVAH.py | 33 |
2 files changed, 82 insertions, 19 deletions
diff --git a/test/Java/JARCHDIR.py b/test/Java/JARCHDIR.py new file mode 100644 index 0000000..dedcf4a --- /dev/null +++ b/test/Java/JARCHDIR.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that when JARCHDIR that our command to create .jar files +correctly finds all the .class files (by putting -C in front +of each class file argument). +""" + +import TestSCons + +test = TestSCons.TestSCons() + +ENV = test.java_ENV() + +if test.detect_tool('javac', ENV=ENV): + where_javac = test.detect('JAVAC', 'javac', ENV=ENV) +else: + where_javac = test.where_is('javac') +if not where_javac: + test.skip_test("Could not find Java javac, skipping test(s).\n") + +test.write('SConstruct', """ +dir = 'dist' +env = Environment(tools = ['javac', 'jar'], + JAVAC = '%(where_javac)s', + JARCHDIR = dir) +bin = env.Java(dir, Dir('./')) +jar = env.Jar(File('c.jar', dir), bin) +Default(bin, jar) +""" % locals()) + +test.write('a.java', """\ +package foo.bar; +public class a {} +""") + +test.write('b.java', """\ +package foo.bar; +public class b {} +""") + +test.run(arguments = '.') + +test.pass_test() diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py index f9a052e..d125a06 100644 --- a/test/Java/JAVAH.py +++ b/test/Java/JAVAH.py @@ -94,27 +94,22 @@ line 3 test.must_match('test2.h', "test2.JAVA\nline 3\n") -if test.detect_tool('javac'): - where_javac = test.detect('JAVAC', 'javac') + +ENV = test.java_ENV() + +if test.detect_tool('javac', ENV=ENV): + where_javac = test.detect('JAVAC', 'javac', ENV=ENV) else: - import SCons.Environment - env = SCons.Environment.Environment() - where_javac = env.WhereIs('javac', os.environ['PATH']) - if not where_javac: - where_javac = env.WhereIs('javac', '/usr/local/j2sdk1.3.1/bin') - if not where_javac: - test.skip_test("Could not find Java javac, skipping test(s).\n") - -if test.detect_tool('javah'): - where_javah = test.detect('JAVAH', 'javah') + where_javac = test.where_is('javac') +if not where_javac: + test.skip_test("Could not find Java javac, skipping test(s).\n") + +if test.detect_tool('javah', ENV=ENV): + where_javah = test.detect('JAVAH', 'javah', ENV=ENV) else: - import SCons.Environment - env = SCons.Environment.Environment() - where_javah = env.WhereIs('javah', os.environ['PATH']) - if not where_javah: - where_javah = env.WhereIs('javah', '/usr/local/j2sdk1.3.1/bin') - if not where_javah: - test.skip_test("Could not find Java javah, skipping test(s).\n") + where_javah = test.where_is('javah') +if not where_javah: + test.skip_test("Could not find Java javah, skipping test(s).\n") |