5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test that the $JAVACCOMSTR construction variable allows you to configure
36 _python_ = TestSCons._python_
38 test = TestSCons.TestSCons()
44 test.write('myjavac.py', r"""
46 outfile = open(sys.argv[1], 'wb')
47 for f in sys.argv[2:]:
48 infile = open(f, 'rb')
49 for l in filter(lambda l: l != '/*javac*/\n', infile.readlines()):
54 test.write('SConstruct', """
55 env = Environment(TOOLS = ['default', 'javac'],
56 JAVACCOM = r'%(_python_)s myjavac.py $TARGET $SOURCES',
57 JAVACCOMSTR = "Compiling class(es) $TARGET from $SOURCES")
58 env.Java(target = 'classes', source = 'src')
61 test.write(['src', 'file1.java'], "file1.java\n/*javac*/\n")
62 test.write(['src', 'file2.java'], "file2.java\n/*javac*/\n")
63 test.write(['src', 'file3.java'], "file3.java\n/*javac*/\n")
65 classes_src_file1_class = os.path.join('classes', 'src', 'file1.class')
66 src_file1_java= os.path.join('src', 'file1.java')
67 src_file2_java= os.path.join('src', 'file2.java')
68 src_file3_java= os.path.join('src', 'file3.java')
70 test.run(stdout = test.wrap_stdout("""\
71 Compiling class(es) %(classes_src_file1_class)s from %(src_file1_java)s %(src_file2_java)s %(src_file3_java)s
74 test.must_match(['classes', 'src', 'file1.class'],
75 "file1.java\nfile2.java\nfile3.java\n")