modified the JS compiler so that it can have definitions and library sources specified or discovered on the classpath; so for example we can then discover the kotlin standard library kotlin that needs to be compiled; plus the JS library definitions (which map to the kotlin-lib.js file)
This commit is contained in:
@@ -17,26 +17,17 @@
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.cli.js.K2JSCompiler;
|
||||
import org.jetbrains.jet.cli.js.K2JSCompilerArguments;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.k2js.config.Config;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.facade.MainCallParameters;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.k2js.test.rhino.RhinoFunctionNativeObjectResultChecker;
|
||||
import org.jetbrains.k2js.utils.JetFileUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -60,23 +51,18 @@ public final class StdLibToJSTest extends SingleFileTranslationTest {
|
||||
String... stdLibFiles) throws Exception {
|
||||
List<String> files = Lists.newArrayList();
|
||||
|
||||
|
||||
File stdlibDir = new File("libraries/stdlib/src");
|
||||
assertTrue("Cannot find stdlib source: " + stdlibDir, stdlibDir.exists());
|
||||
for (String file : stdLibFiles) {
|
||||
files.add(new File(stdlibDir, file).getPath());
|
||||
}
|
||||
generateJavaScriptFiles(files, getTestName(false) + ".kt", mainCallParameters, ecmaVersions);
|
||||
|
||||
/*
|
||||
runRhinoTests(getOutputFilePaths(kotlinFilename, ecmaVersions),
|
||||
new RhinoFunctionNativeObjectResultChecker("test.browser", "foo", "Some Dynamically Created Content!!!"));
|
||||
*/
|
||||
|
||||
// lets add the standard JS library files
|
||||
for (String libFileName : Config.LIB_FILE_NAMES) {
|
||||
System.out.println("Compiling " + libFileName);
|
||||
files.add(Config.LIBRARIES_LOCATION + libFileName);
|
||||
}
|
||||
|
||||
// now lets try invoke the compiler
|
||||
for (EcmaVersion version : ecmaVersions) {
|
||||
System.out.println("Compiling with version: " + version);
|
||||
|
||||
Reference in New Issue
Block a user