Drop IDEAConfig

This commit is contained in:
Pavel V. Talanov
2014-07-23 17:40:16 +04:00
parent e3e83fdee5
commit 4982e22ec7
2 changed files with 4 additions and 79 deletions
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.plugin.project;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.k2js.config.EcmaVersion;
import org.jetbrains.k2js.config.LibrarySourcesConfig;
public final class IDEAConfig extends LibrarySourcesConfig {
public IDEAConfig(@NotNull Project project) {
super(project, "default", ProjectStructureUtil.getLibLocationForProject(project), EcmaVersion.defaultVersion(), false);
}
}
@@ -16,8 +16,6 @@
package org.jetbrains.jet.plugin.project;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -36,17 +34,18 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.util.PathUtil;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.plugin.framework.JsHeaderLibraryDetectionUtil;
import org.jetbrains.jet.plugin.framework.JsLibraryStdDetectionUtil;
import org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryCoreUtil;
import java.util.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ProjectStructureUtil {
private static final Key<CachedValue<Boolean>> IS_KOTLIN_JS_MODULE = Key.create("IS_KOTLIN_JS_MODULE");
@@ -137,52 +136,6 @@ public class ProjectStructureUtil {
return result.getValue();
}
@NotNull
public static List<String> getLibLocationForProject(@NotNull Project project) {
Module[] modules = ModuleManager.getInstance(project).getModules();
for (Module module : modules) {
if (isJsKotlinModule(module)) {
return getLibLocationForProject(module);
}
}
return Collections.emptyList();
}
@NotNull
public static List<String> getLibLocationForProject(@NotNull final Module module) {
final Set<String> pathsToJSLib = Sets.newHashSet();
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
ModuleRootManager.getInstance(module).orderEntries().librariesOnly().forEachLibrary(new Processor<Library>() {
@Override
public boolean process(Library library) {
boolean detected = JsHeaderLibraryDetectionUtil.isJsHeaderLibraryDetected(Arrays.asList(
library.getFiles(OrderRootType.CLASSES)));
if (detected) {
for (VirtualFile file : library.getRootProvider().getFiles(OrderRootType.SOURCES)) {
String path = PathUtil.getLocalPath(PathUtil.getLocalFile(file));
if (path != null) {
pathsToJSLib.add(path);
}
else {
assert !file.isValid() : "Path is expected to be null only for invalid file: " + file;
}
}
}
return true;
}
});
}
});
return Lists.newArrayList(pathsToJSLib);
}
@Nullable
private static Library getJSStandardLibrary(final Module module) {
return ApplicationManager.getApplication().runReadAction(new Computable<Library>() {