Better work with libraries names
This commit is contained in:
@@ -43,7 +43,7 @@ public class KotlinPathsFromHomeDir implements KotlinPaths {
|
||||
@Override
|
||||
@NotNull
|
||||
public File getRuntimePath() {
|
||||
return getLibraryFile("kotlin-runtime.jar");
|
||||
return getLibraryFile(PathUtil.KOTLIN_JAVA_RUNTIME_JAR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@ public class PathUtil {
|
||||
public static final String JS_LIB_JAR_NAME = "kotlin-jslib.jar";
|
||||
public static final String JS_LIB_JS_NAME = "kotlinEcma3.js";
|
||||
public static final String JDK_ANNOTATIONS_JAR = "kotlin-jdk-annotations.jar";
|
||||
public static final String KOTLIN_JAVA_RUNTIME_JAR = "kotlin-runtime.jar";
|
||||
|
||||
private static final File NO_PATH = new File("<no_path>");
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.framework;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -107,9 +123,10 @@ public class FrameworkDetector {
|
||||
@Override
|
||||
public Library compute() {
|
||||
for (Library library : getJavaScriptHeadersLibraries(module)) {
|
||||
String libraryName = library.getName();
|
||||
if (libraryName != null && libraryName.contains(PathUtil.JS_LIB_JAR_NAME)) {
|
||||
return library;
|
||||
for (VirtualFile file : library.getFiles(OrderRootType.SOURCES)) {
|
||||
if (file.getName().equals(PathUtil.JS_LIB_JAR_NAME)) {
|
||||
return library;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.Set;
|
||||
|
||||
public class JSLibraryDescription extends CustomLibraryDescription {
|
||||
public static final LibraryKind KOTLIN_JAVASCRIPT_KIND = LibraryKind.create("kotlin-js-stdlib");
|
||||
public static final String LIBRARY_NAME = "KotlinJavaScript";
|
||||
|
||||
private static final String JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation";
|
||||
|
||||
@@ -78,7 +79,7 @@ public class JSLibraryDescription extends CustomLibraryDescription {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NewLibraryConfiguration(PathUtil.JS_LIB_JAR_NAME, getDownloadableLibraryType(), new LibraryVersionProperties()) {
|
||||
return new NewLibraryConfiguration(LIBRARY_NAME, getDownloadableLibraryType(), new LibraryVersionProperties()) {
|
||||
@Override
|
||||
public void addRoots(@NotNull LibraryEditor editor) {
|
||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(targetFile), OrderRootType.SOURCES);
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
|
||||
import org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryUtil;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -39,6 +38,7 @@ import java.util.Set;
|
||||
|
||||
public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
|
||||
public static final LibraryKind KOTLIN_JAVA_RUNTIME_KIND = LibraryKind.create("kotlin-java-runtime");
|
||||
public static final String LIBRARY_NAME = "KotlinJavaRuntime";
|
||||
|
||||
private static final String JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation";
|
||||
|
||||
@@ -79,8 +79,7 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NewLibraryConfiguration(
|
||||
KotlinRuntimeLibraryUtil.LIBRARY_NAME, getDownloadableLibraryType(), new LibraryVersionProperties()) {
|
||||
return new NewLibraryConfiguration(LIBRARY_NAME, getDownloadableLibraryType(), new LibraryVersionProperties()) {
|
||||
@Override
|
||||
public void addRoots(@NotNull LibraryEditor editor) {
|
||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(targetFile), OrderRootType.CLASSES);
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.JetIcons;
|
||||
import org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryUtil;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
@@ -46,7 +46,7 @@ public class JavaRuntimePresentationProvider extends LibraryPresentationProvider
|
||||
@Override
|
||||
public LibraryVersionProperties detect(@NotNull List<VirtualFile> classesRoots) {
|
||||
for (VirtualFile root : classesRoots) {
|
||||
if (root.getName().equals(KotlinRuntimeLibraryUtil.KOTLIN_RUNTIME_JAR)) {
|
||||
if (root.getName().equals(PathUtil.KOTLIN_JAVA_RUNTIME_JAR)) {
|
||||
// TODO: Detect library version
|
||||
return new LibraryVersionProperties("Unknown");
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@ import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class KotlinRuntimeLibraryUtil {
|
||||
public static final String LIBRARY_NAME = "KotlinRuntime";
|
||||
public static final String KOTLIN_RUNTIME_JAR = "kotlin-runtime.jar";
|
||||
public static final String UNKNOWN_VERSION = "UNKNOWN";
|
||||
|
||||
private KotlinRuntimeLibraryUtil() {}
|
||||
|
||||
Reference in New Issue
Block a user