Search in sources :

Example 6 with N4jscBase

use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.

the class N4JSXTest method testCyclicReferencesWithN4JS_singleFile.

/**
 * Same as {@link #testCyclicReferencesWithN4JS()}, but the files are compiled individually using 'singlefile' mode.
 */
@Test
public void testCyclicReferencesWithN4JS_singleFile() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    String p3Root = wsRoot + "/" + "P3";
    new N4jscBase().doMain("--projectlocations", wsRoot, "--buildType", "singlefile", p3Root + "/src/foo.n4js");
    assertFilesCompiledToES(1, p3Root);
    new N4jscBase().doMain("--projectlocations", wsRoot, "--buildType", "singlefile", p3Root + "/src/bar.n4jsx");
    assertFilesCompiledToES(2, p3Root);
}
Also used : N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 7 with N4jscBase

use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.

the class N4JSXTest method testCyclicReferencesWithN4JS.

/**
 * Compile two n4js and n4jsx files, with cyclic cross-references.
 */
@Test
public void testCyclicReferencesWithN4JS() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    String p3Root = wsRoot + "/" + "P3";
    new N4jscBase().doMain("--projectlocations", wsRoot, "--buildType", "projects", p3Root);
    assertFilesCompiledToES(2, p3Root);
}
Also used : N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 8 with N4jscBase

use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.

the class N4JSXTest method testCombinedWithN4JS.

/**
 * Compile several n4js and n4jsx files, with cross-references between the files.
 */
@Test
public void testCombinedWithN4JS() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    String p2Root = wsRoot + "/" + "P2";
    String react = wsRoot + "/react";
    new N4jscBase().doMain("--projectlocations", wsRoot, "--buildType", "projects", p2Root, react);
    assertFilesCompiledToES(3, p2Root);
}
Also used : N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 9 with N4jscBase

use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.

the class N4jscDependentProjectDependenciesTest method testSuccessfulCompilationWithInterdependentProjects.

/**
 * Test failure when compiling without target platform file.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testSuccessfulCompilationWithInterdependentProjects() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    final String[] args = { "--systemLoader", COMMON_JS.getId(), "--installMissingDependencies", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, status.code);
    assertTrue("install location was not created", getTargetPlatformInstallLocation().exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 10 with N4jscBase

use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.

the class TargetPlatformConfigurationsTest method testCompileWithInstallPlusCompileSkipInstall.

/**
 * Test compiling with external libraries installation, then invoke compilation without installing. We expect second
 * invocation to re-use installed external libraries in first invocation.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testCompileWithInstallPlusCompileSkipInstall() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    final String[] argsInstall = { "--installMissingDependencies", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus statusInstall = new N4jscBase().doMain(argsInstall);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, statusInstall.code);
    assertTrue("install location was not created", getTargetPlatformInstallLocation().exists());
    final String[] argsSkipInstall = { // "--installMissingDependencies",
    "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus statusSkipInstall = new N4jscBase().doMain(argsSkipInstall);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, statusSkipInstall.code);
    assertTrue("install location still exists", getTargetPlatformInstallLocation().exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Aggregations

N4jscBase (org.eclipse.n4js.hlc.base.N4jscBase)34 Test (org.junit.Test)31 SuccessExitStatus (org.eclipse.n4js.hlc.base.SuccessExitStatus)9 File (java.io.File)6 IOException (java.io.IOException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Optional (com.google.common.base.Optional)1 Injector (com.google.inject.Injector)1 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileWriter (java.io.FileWriter)1 InputStreamReader (java.io.InputStreamReader)1 PrintStream (java.io.PrintStream)1 Reader (java.io.Reader)1 FileVisitResult (java.nio.file.FileVisitResult)1 FileVisitor (java.nio.file.FileVisitor)1