Drop usage of JS component
This commit is contained in:
@@ -38,7 +38,8 @@ public final class JsModuleDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isJsModule(@NotNull Module module) {
|
public static boolean isJsModule(@NotNull Module module) {
|
||||||
return K2JSModuleComponent.getInstance(module).isJavaScriptModule();
|
// TODO: fix
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isJsModule(@NotNull JetFile file) {
|
public static boolean isJsModule(@NotNull JetFile file) {
|
||||||
@@ -66,14 +67,15 @@ public final class JsModuleDetector {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static Pair<List<String>, String> getLibLocationAndTargetForProject(@NotNull Module module) {
|
public static Pair<List<String>, String> getLibLocationAndTargetForProject(@NotNull Module module) {
|
||||||
K2JSModuleComponent jsModuleComponent = K2JSModuleComponent.getInstance(module);
|
throw new IllegalStateException("Under construction");
|
||||||
String pathToJavaScriptLibrary = jsModuleComponent.getPathToJavaScriptLibrary();
|
//K2JSModuleComponent jsModuleComponent = K2JSModuleComponent.getInstance(module);
|
||||||
String basePath = ModuleRootManager.getInstance(module).getContentRoots()[0].getPath();
|
//String pathToJavaScriptLibrary = jsModuleComponent.getPathToJavaScriptLibrary();
|
||||||
List<String> pathsToJSLib = Lists.newArrayList();
|
//String basePath = ModuleRootManager.getInstance(module).getContentRoots()[0].getPath();
|
||||||
if (pathToJavaScriptLibrary != null) {
|
//List<String> pathsToJSLib = Lists.newArrayList();
|
||||||
pathsToJSLib.add(basePath + pathToJavaScriptLibrary);
|
//if (pathToJavaScriptLibrary != null) {
|
||||||
}
|
// pathsToJSLib.add(basePath + pathToJavaScriptLibrary);
|
||||||
return Pair.create(pathsToJSLib, jsModuleComponent.getEcmaVersion().toString());
|
//}
|
||||||
|
//return Pair.create(pathsToJSLib, jsModuleComponent.getEcmaVersion().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.k2js.config.EcmaVersion;
|
import org.jetbrains.k2js.config.EcmaVersion;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@State(
|
@State(
|
||||||
name = "K2JSModule",
|
name = "K2JSModule",
|
||||||
storages = @Storage(
|
storages = @Storage(
|
||||||
@@ -35,51 +36,12 @@ import org.jetbrains.k2js.config.EcmaVersion;
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
public final class K2JSModuleComponent implements ModuleComponent, PersistentStateComponent<K2JSModuleComponent> {
|
public final class K2JSModuleComponent implements ModuleComponent, PersistentStateComponent<K2JSModuleComponent> {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static K2JSModuleComponent getInstance(@NotNull Module module) {
|
public static K2JSModuleComponent getInstance(@NotNull Module module) {
|
||||||
return module.getComponent(K2JSModuleComponent.class);
|
return module.getComponent(K2JSModuleComponent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isJavaScriptModule;
|
public K2JSModuleComponent() {}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private String pathToJavaScriptLibrary;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private EcmaVersion ecmaVersion;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public EcmaVersion getEcmaVersion() {
|
|
||||||
return ecmaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public K2JSModuleComponent() {
|
|
||||||
this.isJavaScriptModule = false;
|
|
||||||
this.pathToJavaScriptLibrary = null;
|
|
||||||
this.ecmaVersion = EcmaVersion.defaultVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEcmaVersion(@NotNull EcmaVersion ecmaVersion) {
|
|
||||||
this.ecmaVersion = ecmaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isJavaScriptModule() {
|
|
||||||
return isJavaScriptModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJavaScriptModule(boolean javaScriptModule) {
|
|
||||||
isJavaScriptModule = javaScriptModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public String getPathToJavaScriptLibrary() {
|
|
||||||
return pathToJavaScriptLibrary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPathToJavaScriptLibrary(@Nullable String pathToJavaScriptLibrary) {
|
|
||||||
this.pathToJavaScriptLibrary = pathToJavaScriptLibrary;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void projectOpened() {
|
public void projectOpened() {
|
||||||
@@ -114,11 +76,12 @@ public final class K2JSModuleComponent implements ModuleComponent, PersistentSta
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public K2JSModuleComponent getState() {
|
public K2JSModuleComponent getState() {
|
||||||
return this;
|
// Don't store starting from this version
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadState(K2JSModuleComponent state) {
|
public void loadState(K2JSModuleComponent state) {
|
||||||
XmlSerializerUtil.copyBean(state, this);
|
// Don't restore - there could be another set of fields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import com.intellij.psi.PsiManager;
|
|||||||
import com.intellij.psi.impl.PsiModificationTrackerImpl;
|
import com.intellij.psi.impl.PsiModificationTrackerImpl;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.plugin.project.K2JSModuleComponent;
|
|
||||||
import org.jetbrains.jet.utils.KotlinPaths;
|
import org.jetbrains.jet.utils.KotlinPaths;
|
||||||
import org.jetbrains.jet.utils.PathUtil;
|
import org.jetbrains.jet.utils.PathUtil;
|
||||||
|
|
||||||
@@ -63,7 +62,6 @@ public final class JsModuleSetUp {
|
|||||||
|
|
||||||
if (!copyJsLibFiles(rootDir)) return;
|
if (!copyJsLibFiles(rootDir)) return;
|
||||||
|
|
||||||
setUpK2JSModuleComponent(module);
|
|
||||||
createJSLibrary(module, LibrariesContainer.LibraryLevel.MODULE, rootDir);
|
createJSLibrary(module, LibrariesContainer.LibraryLevel.MODULE, rootDir);
|
||||||
|
|
||||||
// FacetUtil.addFacet(module, JetFacetType.getInstance());
|
// FacetUtil.addFacet(module, JetFacetType.getInstance());
|
||||||
@@ -85,12 +83,6 @@ public final class JsModuleSetUp {
|
|||||||
return container.createLibrary(editor, level);
|
return container.createLibrary(editor, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setUpK2JSModuleComponent(@NotNull Module module) {
|
|
||||||
K2JSModuleComponent jsModuleComponent = K2JSModuleComponent.getInstance(module);
|
|
||||||
jsModuleComponent.setJavaScriptModule(true);
|
|
||||||
jsModuleComponent.setPathToJavaScriptLibrary("/lib/" + PathUtil.JS_LIB_JAR_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void restartHighlightingInTheWholeProject(@NotNull Module module) {
|
private static void restartHighlightingInTheWholeProject(@NotNull Module module) {
|
||||||
((PsiModificationTrackerImpl) PsiManager.getInstance(module.getProject()).getModificationTracker()).incCounter();
|
((PsiModificationTrackerImpl) PsiManager.getInstance(module.getProject()).getModificationTracker()).incCounter();
|
||||||
DaemonCodeAnalyzer.getInstance(module.getProject()).restart();
|
DaemonCodeAnalyzer.getInstance(module.getProject()).restart();
|
||||||
|
|||||||
+9
-14
@@ -20,11 +20,8 @@ import jet.Function1;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
import org.jetbrains.jet.plugin.compiler.K2JSCompiler;
|
import org.jetbrains.jet.plugin.compiler.K2JSCompiler;
|
||||||
import org.jetbrains.jet.plugin.project.K2JSModuleComponent;
|
|
||||||
|
|
||||||
import static org.jetbrains.jet.plugin.compilerMessages.Message.error;
|
import static org.jetbrains.jet.plugin.compilerMessages.Message.*;
|
||||||
import static org.jetbrains.jet.plugin.compilerMessages.Message.stats;
|
|
||||||
import static org.jetbrains.jet.plugin.compilerMessages.Message.warning;
|
|
||||||
|
|
||||||
public final class K2JSCompilerMessagingTest extends IDECompilerMessagingTest {
|
public final class K2JSCompilerMessagingTest extends IDECompilerMessagingTest {
|
||||||
|
|
||||||
@@ -63,16 +60,14 @@ public final class K2JSCompilerMessagingTest extends IDECompilerMessagingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testLib() {
|
public void testLib() {
|
||||||
K2JSModuleComponent component = myModule.getComponent(K2JSModuleComponent.class);
|
throw new UnsupportedOperationException("Under construction");
|
||||||
component.setJavaScriptModule(true);
|
//doTest(new Function1<MessageChecker, Void>() {
|
||||||
component.setPathToJavaScriptLibrary("/lib.zip");
|
// @Override
|
||||||
doTest(new Function1<MessageChecker, Void>() {
|
// public Void invoke(MessageChecker checker) {
|
||||||
@Override
|
// //nothing apart from header
|
||||||
public Void invoke(MessageChecker checker) {
|
// return null;
|
||||||
//nothing apart from header
|
// }
|
||||||
return null;
|
//});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doTest(@NotNull Function1<MessageChecker, Void> whatToExpect) {
|
private void doTest(@NotNull Function1<MessageChecker, Void> whatToExpect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user