5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Test of javac.py when building java code from derived sources.
29 Original issue definition:
30 Java emitter for derived sources outputs bogus class files.
32 Repeatable with any N-tier, with N > 1, Java derived-source builds where
33 any of the following conditions are meet:
34 1. The java class does not belong to the root package.
35 2. A java source (*.java) creates N targets (*.class) where N > 1.
43 SCons
.Defaults
.DefaultEnvironment(tools
= [])
45 test
= TestSCons
.TestSCons()
47 # This test is known to fail as of July 2014; see Tigris issue 1771 and issue 2931.
48 # Once the underlying issue is corrected, this test should be re-enabled.
49 test
.skip_test('Skipping derived-source test until issue 1771 is fixed.\n')
51 # No result if tools not available
52 test
.no_result( condition
=(test
.where_is( 'javac' ) is None) )
53 test
.no_result( condition
=(test
.where_is( 'jar' ) is None) )
58 // Condition 1: class does not exist in the root package.
62 // Condition 2: inner class definition causes javac to create
63 // a second class file.
78 DefaultEnvironment(tools=[])
87 os.path.join( 'org', 'sample', 'Sample.java' ),
95 # Copy operation makes the *.java file(s) under org derived-source.
103 expected
= test
.wrap_stdout(
106 Copy("org/sample/Sample.java", "Sample.java")
107 javac -d build -sourcepath org/sample org/sample/Sample.java
112 | +-build/org/sample/Sample$InnerEnum.class
113 | +-org/sample/Sample.java
114 | +-build/org/sample/Sample.class
115 | +-org/sample/Sample.java
118 +-org/sample/Sample.java
119 '''.replace( '/', os
.sep
)
122 test
.run( arguments
= '--tree=derived', stdout
= expected
)
123 test
.up_to_date(arguments
= '.')
129 # indent-tabs-mode:nil
131 # vim: set expandtab tabstop=4 shiftwidth=4: