use of org.eclipse.n4js.cli.helper.CliTools in project n4js by eclipse.
the class BuildN4jsLibs method installDependencies.
private static void installDependencies(Path n4jsLibsRootPath) {
CliTools cliTools = new CliTools();
cliTools.setInheritIO(true);
cliTools.setEnvironmentVariable("NPM_TOKEN", "dummy");
cliTools.yarnInstall(n4jsLibsRootPath);
}
use of org.eclipse.n4js.cli.helper.CliTools in project n4js by eclipse.
the class BuildN4jsLibs method compile.
private static void compile(Path n4jsLibsRootPath) {
CliCompileResult compileResult = new CliCompileResult();
try {
CliTools cliTools = new CliTools();
cliTools.setInheritIO(true);
// we want '--clean' but *not* '--noPersist'
N4jscTestOptions options = COMPILE(false, n4jsLibsRootPath.toFile()).clean();
Preconditions.checkState(options.isClean());
Preconditions.checkState(!options.isNoPersist());
cliTools.callN4jscInprocess(options, false, compileResult);
} catch (CliException e) {
if (compileResult.getException() != null) {
throw new RuntimeException(compileResult.getException());
} else if (compileResult.getErrs() > 0) {
// case to suppress further error reporting:
throw new RuntimeException("Errors while compiling n4js-libs");
} else {
throw new RuntimeException(e);
}
} catch (Exception e) {
println("EXCEPTION while compiling n4js-libs:");
e.printStackTrace();
Throwable root = Throwables.getRootCause(e);
if (root != e) {
println("Root cause:");
root.printStackTrace();
}
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
use of org.eclipse.n4js.cli.helper.CliTools in project n4js by eclipse.
the class N4jsLibsTest method testN4jsLibs.
/**
*/
@Test
public void testN4jsLibs() throws IOException {
final Path n4jsRootPath = UtilN4.findN4jsRepoRootPath();
final Path n4jsLibsRootPath = n4jsRootPath.resolve(N4JSGlobals.N4JS_LIBS_FOLDER_NAME);
final Path testReportPath = n4jsLibsRootPath.resolve("build").resolve("report.xml");
Files.deleteIfExists(testReportPath);
CliTools cliTools = new CliTools();
cliTools.setInheritIO(true);
ProcessResult result = cliTools.yarnRun(n4jsLibsRootPath, "run", "test");
assertEquals("non-zero exit code", 0, result.getExitCode());
assertTrue("test report not found", Files.isRegularFile(testReportPath));
}
use of org.eclipse.n4js.cli.helper.CliTools in project n4js by eclipse.
the class AbstractCliFrontendTest method doN4jsc.
@Override
protected void doN4jsc(String[] args, boolean ignoreFailure, boolean removeUsage, CliCompileResult result) {
CliTools cliTools = new CliTools();
cliTools.setIgnoreFailure(ignoreFailure);
cliTools.callN4jscFrontendInprocess(args, removeUsage, result);
}
Aggregations