JS backend: refactor Configs.
This commit is contained in:
@@ -24,131 +24,14 @@ import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Base class representing a configuration of translator.
|
||||
*/
|
||||
public abstract class Config {
|
||||
//NOTE: a hacky solution to be able to rerun code samples with lib loaded only once: used by tests and web demo
|
||||
@NotNull
|
||||
public static final String REWRITABLE_MODULE_NAME = "JS_TESTS";
|
||||
private boolean inlineEnabled;
|
||||
|
||||
@NotNull
|
||||
public static Config getEmptyConfig(@NotNull Project project, @NotNull EcmaVersion ecmaVersion) {
|
||||
return new Config(project, "main", ecmaVersion, false, true) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<JetFile> generateLibFiles() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//NOTE: used by mvn build
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public static Config getEmptyConfig(@NotNull Project project) {
|
||||
return getEmptyConfig(project, EcmaVersion.defaultVersion());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static final List<String> LIB_FILES_WITH_DECLARATIONS = Arrays.asList(
|
||||
"/core/annotations.kt",
|
||||
"/core/core.kt",
|
||||
"/core/date.kt",
|
||||
"/core/dom.kt",
|
||||
"/core/javaio.kt",
|
||||
"/core/javalang.kt",
|
||||
"/core/javautil.kt",
|
||||
"/core/javautilCollections.kt",
|
||||
"/core/json.kt",
|
||||
"/core/kotlin.kt",
|
||||
"/core/math.kt",
|
||||
"/core/string.kt",
|
||||
"/core/htmlDom.kt",
|
||||
"/html5/canvas.kt",
|
||||
"/jquery/common.kt",
|
||||
"/jquery/ui.kt",
|
||||
"/junit/core.kt",
|
||||
"/qunit/core.kt",
|
||||
"/stdlib/browser.kt"
|
||||
);
|
||||
|
||||
@NotNull
|
||||
public static final List<String> LIB_FILES_WITH_CODE = Arrays.asList(
|
||||
"/stdlib/TuplesCode.kt",
|
||||
"/core/javautilCollectionsCode.kt"
|
||||
);
|
||||
|
||||
@NotNull
|
||||
public static final List<String> LIB_FILE_NAMES = Lists.newArrayList();
|
||||
|
||||
static {
|
||||
LIB_FILE_NAMES.addAll(LIB_FILES_WITH_DECLARATIONS);
|
||||
LIB_FILE_NAMES.addAll(LIB_FILES_WITH_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* the library files which depend on the STDLIB files to be able to compile
|
||||
*/
|
||||
@NotNull
|
||||
public static final List<String> LIB_FILE_NAMES_DEPENDENT_ON_STDLIB = Arrays.asList(
|
||||
"/core/stringsCode.kt",
|
||||
"/stdlib/domCode.kt",
|
||||
"/core/javautilCode.kt",
|
||||
"/stdlib/jutilCode.kt",
|
||||
"/stdlib/testCode.kt"
|
||||
);
|
||||
|
||||
public static final String LIBRARIES_LOCATION = "js/js.libraries/src";
|
||||
public static final String REFLECTION_LIB_LOCATION = "core/reflection/src/kotlin/reflect";
|
||||
|
||||
/**
|
||||
* The file names in the standard library to compile
|
||||
*/
|
||||
@NotNull
|
||||
public static final List<String> STDLIB_FILE_NAMES = Arrays.asList(
|
||||
"/kotlin/Preconditions.kt",
|
||||
"/kotlin/Functions.kt",
|
||||
"/kotlin/collections/JUtil.kt",
|
||||
"/kotlin/collections/Iterators.kt",
|
||||
"/kotlin/collections/Arrays.kt",
|
||||
"/kotlin/collections/Maps.kt",
|
||||
"/kotlin/collections/Exceptions.kt",
|
||||
"/kotlin/collections/MutableCollections.kt",
|
||||
"/kotlin/collections/Stream.kt",
|
||||
"/kotlin/collections/AbstractIterator.kt",
|
||||
"/generated/_Aggregates.kt",
|
||||
"/generated/_Arrays.kt",
|
||||
"/generated/_DownTo.kt",
|
||||
"/generated/_Elements.kt",
|
||||
"/generated/_Filtering.kt",
|
||||
"/generated/_Generators.kt",
|
||||
"/generated/_Guards.kt",
|
||||
"/generated/_Mapping.kt",
|
||||
"/generated/_Numeric.kt",
|
||||
"/generated/_Ordering.kt",
|
||||
"/generated/_Snapshots.kt",
|
||||
"/generated/_Strings.kt",
|
||||
"/generated/_Streams.kt",
|
||||
"/kotlin/Standard.kt",
|
||||
"/kotlin/Ranges.kt",
|
||||
"/kotlin/Numbers.kt",
|
||||
"/kotlin/text/Strings.kt",
|
||||
"/kotlin/text/StringBuilder.kt",
|
||||
"/kotlin/dom/Dom.kt",
|
||||
"/kotlin/test/Test.kt"
|
||||
);
|
||||
|
||||
/**
|
||||
* The location of the stdlib sources
|
||||
*/
|
||||
public static final String STDLIB_LOCATION = "libraries/stdlib/src";
|
||||
private final boolean inlineEnabled;
|
||||
|
||||
@NotNull
|
||||
private final Project project;
|
||||
|
||||
Reference in New Issue
Block a user