Add support for Visual Studio 2005 Professional. Windows portability fixes for vario...
[scons.git] / test / Java / RMICCOM.py
1 #!/usr/bin/env python
2 #
3 # __COPYRIGHT__
4 #
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:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
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.
23 #
24
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26
27 """
28 Test the ability to configure the $RMICCOM construction variable.
29 """
30
31 import os.path
32
33 import TestSCons
34
35 python = TestSCons.python
36
37 test = TestSCons.TestSCons()
38
39 test.subdir('src')
40
41
42
43 out_file1 = os.path.join('out', 'file1', 'class_Skel.class')
44 out_file2 = os.path.join('out', 'file2', 'class_Skel.class')
45 out_file3 = os.path.join('out', 'file3', 'class_Skel.class')
46
47
48
49 test.write('myrmic.py', r"""
50 import sys
51 outfile = open(sys.argv[1], 'wb')
52 for f in sys.argv[2:]:
53     infile = open(f, 'rb')
54     for l in filter(lambda l: l != '/*rmic*/\n', infile.readlines()):
55         outfile.write(l)
56 sys.exit(0)
57 """)
58
59 test.write('SConstruct', """
60 env = Environment(TOOLS = ['default', 'rmic'],
61                   RMICCOM = r'%(python)s myrmic.py $TARGET $SOURCES')
62 env.RMIC(target = 'out', source = 'file1.class')
63 env.RMIC(target = 'out', source = 'file2.class')
64 env.RMIC(target = 'out', source = 'file3.class')
65 """ % locals())
66
67 test.write('file1.class', "file1.class\n/*rmic*/\n")
68 test.write('file2.class', "file2.class\n/*rmic*/\n")
69 test.write('file3.class', "file3.class\n/*rmic*/\n")
70
71 test.run()
72
73 test.must_match(out_file1, "file1.class\n")
74 test.must_match(out_file2, "file2.class\n")
75 test.must_match(out_file3, "file3.class\n")
76
77
78
79 test.pass_test()