use of org.eclipse.n4js.generator.headless.N4HeadlessCompiler in project n4js by eclipse.
the class ScenarioTest method testScenario01BuildAllProjects.
/**
* Testing compiling
*/
@Test
public void testScenario01BuildAllProjects() throws N4JSCompileException {
N4HeadlessCompiler hlc = HeadlessCompilerFactory.createCompilerWithDefaults();
File root = new File(workspace, "scenario01");
List<File> pProjectRoots = //
Arrays.asList(// A, NotAProject
new File(root, "wsp1"), // B,D
new File(root, "nest/wsp2"), // C
new File(root, "wsp3"), // E,H
new File(root, "nest/nest/wsp4"), // F
new File(root, "nest/wsp5"), // G
new File(root, "wsp6"));
hlc.compileAllProjects(pProjectRoots);
// expect source-files:
assertExists(root, "wsp1/A/src-gen/packA/A.js");
assertExists(root, "nest/wsp2/B/src-gen/packB/B.js");
assertExists(root, "wsp3/C/src-gen/packC/C.js");
assertExists(root, "nest/wsp2/D/src-gen/packD/D.js");
assertExists(root, "nest/wsp2/D/src-gen/packD/D2.js");
assertExists(root, "nest/nest/wsp4/E/src-gen/packE/E.js");
assertExists(root, "nest/nest/wsp4/E/src-gen/packE/E2.js");
assertExists(root, "nest/wsp5/F/src-gen/packF/F.js");
assertExists(root, "wsp6/G/src-gen/packG/G.js");
assertExists(root, "nest/nest/wsp4/H/src-gen/packH/H.js");
}
use of org.eclipse.n4js.generator.headless.N4HeadlessCompiler in project n4js by eclipse.
the class ScenarioTest method testScenario06bNoModuleWrapFilter.
/**
* Same as scenario 6, but now we have a project that ONLY contains external sources (i.e. *no* n4js file). This
* kind of project caused problems before.
*/
@Test
public void testScenario06bNoModuleWrapFilter() throws N4JSCompileException, IOException {
N4HeadlessCompiler hlc = HeadlessCompilerFactory.createCompilerWithDefaults();
File root = new File(workspace, "scenario06b");
List<File> toCompile = //
Arrays.asList(// requires nothing
new File(root, "wsp1/P1"));
hlc.compileProjects(toCompile);
// those should be available
assertExists(root, "wsp1/P1/outfolder/c/X.js");
assertExists(root, "wsp1/P1/outfolder/c/X2.js");
// there should be no src-gen folder:
assertNotExists(root, "wsp1/P1/src-gen");
assertFileSystemCallStartsWith(root, "wsp1/P1/outfolder/c/X.js", "System.registerDynamic([");
assertFileSystemCallStartsNotWith(root, "wsp1/P1/outfolder/c/X2.js", "System.register([");
}
use of org.eclipse.n4js.generator.headless.N4HeadlessCompiler in project n4js by eclipse.
the class ScenarioTest method testScenario09BuildSingleFilesWithoutProjectRoot.
/**
*/
@Test
public void testScenario09BuildSingleFilesWithoutProjectRoot() throws N4JSCompileException {
N4HeadlessCompiler hlc = HeadlessCompilerFactory.createCompilerWithDefaults();
File root = new File(workspace, "scenario09");
List<File> toCompile = //
Arrays.asList(// requires nothing
new File(root, "nest/wsp2/B/src/packB/B2.n4js"));
hlc.compileSingleFiles(toCompile);
assertExists(root, "nest/wsp2/B/src-gen/packB/B2.js");
// those should be available
assertNotExists(root, "wsp1/A/src-gen/packA/A.js");
assertNotExists(root, "nest/wsp2/B/src-gen/packB/B.js");
assertNotExists(root, "nest/wsp2/D/src-gen/packD/D.js");
assertNotExists(root, "nest/wsp2/D/src-gen/packD/D2.js");
}
use of org.eclipse.n4js.generator.headless.N4HeadlessCompiler in project n4js by eclipse.
the class ScenarioTest method testScenario06NoModuleWrapFilter.
/**
* Testing for different output-folder, configured in manifest. Testing for external source and configuration of
* noModuleWrapFilter
*/
@Test
public void testScenario06NoModuleWrapFilter() throws N4JSCompileException, IOException {
N4HeadlessCompiler hlc = HeadlessCompilerFactory.createCompilerWithDefaults();
File root = new File(workspace, "scenario06");
List<File> toCompile = //
Arrays.asList(// requires nothing
new File(root, "wsp1/P1"));
hlc.compileProjects(toCompile);
// those should be available
assertExists(root, "wsp1/P1/outfolder/c/Csrc1.js");
assertExists(root, "wsp1/P1/outfolder/c/X.js");
assertExists(root, "wsp1/P1/outfolder/c/X2.js");
// there should be no src-gen folder:
assertNotExists(root, "wsp1/P1/src-gen");
assertFileSystemCallStartsWith(root, "wsp1/P1/outfolder/c/X.js", "System.registerDynamic([");
assertFileSystemCallStartsNotWith(root, "wsp1/P1/outfolder/c/X2.js", "System.register([");
}
use of org.eclipse.n4js.generator.headless.N4HeadlessCompiler in project n4js by eclipse.
the class ScenarioTest method testScenario08NotTestCompilation.
/**
* Building a project but not the test-files.
*/
@Test
public void testScenario08NotTestCompilation() throws N4JSCompileException {
N4HeadlessCompiler hlc = HeadlessCompilerFactory.createCompilerWithDefaults();
File root = new File(workspace, "scenario08");
List<File> toCompile = //
Arrays.asList(// requires nothing
new File(root, "wsp1/P1"));
hlc.setCompileSourceCode(true);
hlc.setProcessTestCode(false);
hlc.compileProjects(toCompile);
// those should be available
assertExists(root, "wsp1/P1/outfolder/c/Csrc1.js");
assertExists(root, "wsp1/P1/outfolder/c/X.js");
assertExists(root, "wsp1/P1/outfolder/c/X2.js");
assertNotExists(root, "wsp1/P1/outfolder/t/T1.js");
assertNotExists(root, "wsp1/P1/outfolder/t/T2.js");
// there should be no src-gen folder:
assertNotExists(root, "wsp1/P1/src-gen");
}
Aggregations