use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CarGenerationTests method testCarResourceFilesSub.
private void testCarResourceFilesSub(boolean alternative) throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/files/source");
options.add("-res");
options.add(getPackagePath() + "resmodules/files/resource");
options.addAll(defaultOptions);
CeyloncTaskImpl task;
if (alternative) {
task = getCompilerTask(options, // "resmodules/files/source/test/files/module.ceylon",
"resmodules/files/resource/test/files/extrafile");
} else {
task = getCompilerTask(options, "resmodules/files/source/test/files/module.ceylon", "resmodules/files/resource/test/files/README.txt");
}
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.files", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("test/files/README.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/files/extrafile");
if (alternative) {
assertNotNull(moduleClass);
} else {
assertNull(moduleClass);
}
moduleClass = car.getEntry("test/files/$module_.class");
assertNotNull(moduleClass);
car.close();
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CarGenerationTests method testCarResourceSimple.
@Test
public void testCarResourceSimple() throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/simple/source");
options.add("-res");
options.add(getPackagePath() + "resmodules/simple/resource");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("test.simple"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.simple", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("test/simple/README.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/simple/subdir/SUBDIR.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/simple/$module_.class");
assertNotNull(moduleClass);
car.close();
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CarGenerationTests method testCarResourceRoot.
@Test
public void testCarResourceRoot() throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/rootdir/source");
options.add("-res");
options.add(getPackagePath() + "resmodules/rootdir/resource");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("test.rootdir"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.rootdir", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry carEntry = car.getEntry("test/rootdir/README.txt");
assertNotNull(carEntry);
carEntry = car.getEntry("rootfile");
assertNotNull(carEntry);
carEntry = car.getEntry("rootdir/rootsubdirfile");
assertNotNull(carEntry);
carEntry = car.getEntry("test/rootdir/$module_.class");
assertNotNull(carEntry);
car.close();
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CarGenerationTests method testCarResourceMultipleSub.
private long testCarResourceMultipleSub(boolean reverse) throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/multiple/source");
if (reverse) {
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource2");
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource");
} else {
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource");
options.add("-res");
options.add(getPackagePath() + "resmodules/multiple/resource2");
}
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, null, Arrays.asList("test.multiple"));
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("test.multiple", "1.0");
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("test/multiple/README.txt");
long result = moduleClass.getSize();
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/multiple/README2.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("test/multiple/$module_.class");
assertNotNull(moduleClass);
car.close();
return result;
}
use of com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl in project ceylon-compiler by ceylon.
the class CarGenerationTests method testCarResourceDefault.
@Test
public void testCarResourceDefault() throws IOException {
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(getPackagePath() + "resmodules/default/source");
options.add("-res");
options.add(getPackagePath() + "resmodules/default/resource");
options.addAll(defaultOptions);
CeyloncTaskImpl task = getCompilerTask(options, "resmodules/default/resource/README.txt", "resmodules/default/resource/subdir/SUBDIR.txt");
Boolean ret = task.call();
assertTrue(ret);
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("README.txt");
assertNotNull(moduleClass);
moduleClass = car.getEntry("subdir/SUBDIR.txt");
assertNotNull(moduleClass);
car.close();
}
Aggregations