diff options
author | Daniel Moody <dmoody256@gmail.com> | 2017-11-19 04:55:58 (GMT) |
---|---|---|
committer | Daniel Moody <dmoody256@gmail.com> | 2017-11-19 04:55:58 (GMT) |
commit | 6aa8d3ab277d5f02d39e680e5d06618b3b089085 (patch) | |
tree | 995bb2ed0bbeea0332e728d2a3dbd73cf5a53d3f /test/Java | |
parent | 0b8a2ac3b7f2eea24a374600ac617a76c6c1cae1 (diff) | |
download | SCons-6aa8d3ab277d5f02d39e680e5d06618b3b089085.zip SCons-6aa8d3ab277d5f02d39e680e5d06618b3b089085.tar.gz SCons-6aa8d3ab277d5f02d39e680e5d06618b3b089085.tar.bz2 |
updated Jar builder to flatten source list, and added test for embedded sources
Diffstat (limited to 'test/Java')
-rw-r--r-- | test/Java/JAR.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/Java/JAR.py b/test/Java/JAR.py index b9a5191..2353c10 100644 --- a/test/Java/JAR.py +++ b/test/Java/JAR.py @@ -330,6 +330,93 @@ test.must_exist(['testdir2','bar.jar']) test.must_exist(['testdir2', 'barTest', 'com', 'javasource', 'JavaFile1.class']) test.must_exist(['testdir2', 'barTest', 'com', 'javasource', 'JavaFile2.class']) test.must_exist(['testdir2', 'barTest', 'com', 'javasource', 'JavaFile3.class']) + + +####### +# test list of lists + +# make some directories to test in +test.subdir('listOfLists', + ['listOfLists', 'src'], + ['listOfLists', 'src', 'com'], + ['listOfLists', 'src', 'com', 'javasource'], + ['listOfLists', 'src', 'com', 'resource']) + +# simple SConstruct which passes the 3 .java as source +# and extracts the jars back to classes +test.write(['listOfLists', 'SConstruct'], """ +foo = Environment() +list_of_class_files = foo.Java('src', source=['src']) +resources = ['src/com/resource/resource1.txt', 'src/com/resource/resource2.txt'] +contents = [list_of_class_files, resources] +foo.Jar(target = 'lists', source = contents + ['MANIFEST.mf'], JARCHDIR='src') +foo.Command("listsTest", [], Mkdir("listsTest") ) +foo.Command('listsTest/src/com/javasource/JavaFile3.java', 'lists.jar', foo['JAR'] + ' xvf ../lists.jar', chdir='listsTest') +""") + +test.write(['listOfLists', 'src', 'com', 'javasource', 'JavaFile1.java'], """\ +package com.javasource; + +public class JavaFile1 +{ + public static void main(String[] args) + { + + } +} +""") + +test.write(['listOfLists', 'src', 'com', 'javasource', 'JavaFile2.java'], """\ +package com.javasource; + +public class JavaFile2 +{ + public static void main(String[] args) + { + + } +} +""") + +test.write(['listOfLists', 'src', 'com', 'javasource', 'JavaFile3.java'], """\ +package com.javasource; + +public class JavaFile3 +{ + public static void main(String[] args) + { + + } +} +""") + +test.write(['listOfLists', 'MANIFEST.mf'], +"""Manifest-Version: 1.0 +MyManifestTest: Test +""") + +test.write(['listOfLists', 'src', 'com', 'resource', 'resource1.txt'], """\ +this is a resource file +""") + +test.write(['listOfLists', 'src', 'com', 'resource', 'resource2.txt'], """\ +this is another resource file +""") + + +test.run(chdir='listOfLists') + +#test single target jar +test.must_exist(['listOfLists','lists.jar']) + +# make sure there are class in the jar +test.must_exist(['listOfLists', 'listsTest', 'com', 'javasource', 'JavaFile1.class']) +test.must_exist(['listOfLists', 'listsTest', 'com', 'javasource', 'JavaFile2.class']) +test.must_exist(['listOfLists', 'listsTest', 'com', 'javasource', 'JavaFile3.class']) +test.must_exist(['listOfLists', 'listsTest', 'com', 'resource', 'resource1.txt']) +test.must_exist(['listOfLists', 'listsTest', 'com', 'resource', 'resource2.txt']) +test.must_exist(['listOfLists', 'listsTest', 'META-INF', 'MANIFEST.MF']) +test.must_contain(['listOfLists', 'listsTest', 'META-INF', 'MANIFEST.MF'], b"MyManifestTest: Test" ) test.pass_test() |