From 4f957eaf6984594fe2b687ba11920a78b76c4e97 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 3 Oct 2013 20:22:27 +0400 Subject: [PATCH] Extracted manifest values to `manifest.properties` file. --- .idea/artifacts/KotlinPlugin.xml | 1 + Kotlin.iml | 1 + build.xml | 78 ++++++++++--------- .../org/jetbrains/jet/utils/LibraryUtils.java | 36 +++++++-- compiler/util/util.iml | 1 + resources/manifest.properties | 19 +++++ 6 files changed, 93 insertions(+), 43 deletions(-) create mode 100644 resources/manifest.properties diff --git a/.idea/artifacts/KotlinPlugin.xml b/.idea/artifacts/KotlinPlugin.xml index a1364ea92f6..c069f6bbdfa 100644 --- a/.idea/artifacts/KotlinPlugin.xml +++ b/.idea/artifacts/KotlinPlugin.xml @@ -38,6 +38,7 @@ + diff --git a/Kotlin.iml b/Kotlin.iml index ec6b3774361..13783466741 100644 --- a/Kotlin.iml +++ b/Kotlin.iml @@ -3,6 +3,7 @@ + diff --git a/build.xml b/build.xml index 9bb6876caa5..36f7a7ac5c9 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,7 @@ + + @@ -146,10 +148,10 @@ - + - - + + @@ -163,16 +165,16 @@ sourcepathref="compilerSources.path" classpathref="classpath" linksource="yes" - windowtitle="Kotlin Compiler"/> + windowtitle="${manifest.impl.title.kotlin.compiler}"/> - + - - + + @@ -181,10 +183,10 @@ - + - - + + @@ -204,10 +206,10 @@ - + - - + + @@ -242,10 +244,10 @@ - + - - + + @@ -273,10 +275,10 @@ - + - - + + @@ -430,10 +432,10 @@ - + - - + + @@ -444,13 +446,13 @@ + title="${manifest.impl.title.kotlin.compiler.annotations.jdk}"/> + title="${manifest.impl.title.kotlin.compiler.annotations.android.sdk}"/> @@ -464,9 +466,9 @@ - + - + @@ -486,10 +488,10 @@ - + - - + + @@ -522,10 +524,10 @@ - + - - + + @@ -538,10 +540,10 @@ - + - - + + @@ -561,10 +563,10 @@ - + - - + + diff --git a/compiler/util/src/org/jetbrains/jet/utils/LibraryUtils.java b/compiler/util/src/org/jetbrains/jet/utils/LibraryUtils.java index 971c5ed6221..6f6613746bb 100644 --- a/compiler/util/src/org/jetbrains/jet/utils/LibraryUtils.java +++ b/compiler/util/src/org/jetbrains/jet/utils/LibraryUtils.java @@ -16,21 +16,47 @@ package org.jetbrains.jet.utils; +import com.intellij.openapi.diagnostic.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; public class LibraryUtils { - public static final String VENDOR_JETBRAINS = "JetBrains"; + private static final Logger LOG = Logger.getInstance(LibraryUtils.class); - public static final String TITLE_KOTLIN_RUNTIME_AND_STDLIB = "Kotlin Compiler Runtime + StdLib"; - public static final String TITLE_KOTLIN_RUNTIME_AND_STDLIB_SOURCES = "Kotlin Compiler Runtime + StdLib Sources"; - public static final String TITLE_KOTLIN_JAVASCRIPT_STDLIB = "Kotlin JavaScript StdLib"; + public static final String TITLE_KOTLIN_JVM_RUNTIME_AND_STDLIB; + public static final String TITLE_KOTLIN_JAVASCRIPT_STDLIB; + + static { + String jsStdLib = ""; + String jvmStdLib = ""; + + InputStream manifestProperties = LibraryUtils.class.getResourceAsStream("/manifest.properties"); + if (manifestProperties != null) { + try { + Properties properties = new Properties(); + properties.load(manifestProperties); + jvmStdLib = properties.getProperty("manifest.impl.title.kotlin.jvm.runtime.and.stdlib"); + jsStdLib = properties.getProperty("manifest.impl.title.kotlin.javascript.stdlib"); + } + catch (IOException e) { + LOG.error(e); + } + } + else { + LOG.error("Resource 'manifest.properties' not found."); + } + + TITLE_KOTLIN_JVM_RUNTIME_AND_STDLIB = jvmStdLib; + TITLE_KOTLIN_JAVASCRIPT_STDLIB = jsStdLib; + } private LibraryUtils() {} @@ -71,6 +97,6 @@ public class LibraryUtils { } public static boolean isJvmRuntimeLibrary(@NotNull File library) { - return checkImplTitle(library, TITLE_KOTLIN_RUNTIME_AND_STDLIB); + return checkImplTitle(library, TITLE_KOTLIN_JVM_RUNTIME_AND_STDLIB); } } diff --git a/compiler/util/util.iml b/compiler/util/util.iml index dac3c15c169..e0712740581 100644 --- a/compiler/util/util.iml +++ b/compiler/util/util.iml @@ -9,6 +9,7 @@ + diff --git a/resources/manifest.properties b/resources/manifest.properties new file mode 100644 index 00000000000..1f462e67720 --- /dev/null +++ b/resources/manifest.properties @@ -0,0 +1,19 @@ +manifest.impl.vendor=JetBrains + +manifest.impl.title.kotlin.compiler=Kotlin Compiler +manifest.impl.title.kotlin.compiler.javadoc=Kotlin Compiler Javadoc +manifest.impl.title.kotlin.compiler.sources=Kotlin Compiler Sources + +manifest.impl.title.kotlin.compiler.ant.task=Kotlin Compiler Ant Tasks + +manifest.impl.title.kotlin.compiler.annotations.jdk=Kotlin Compiler JDK Annotations +manifest.impl.title.kotlin.compiler.annotations.android.sdk=Kotlin Compiler Android SDK Annotations +manifest.impl.title.kotlin.compiler.annotations.extended=Kotlin Extended Annotations + +manifest.impl.title.kotlin.jvm.runtime.and.stdlib=Kotlin Compiler Runtime + StdLib +manifest.impl.title.kotlin.runtime.and.stdlib.sources=Kotlin Compiler Runtime + StdLib Sources +manifest.impl.title.kotlin.javascript.stdlib=Kotlin JavaScript StdLib + +manifest.impl.title.kotlin.preloader=Kotlin Preloader + +manifest.impl.title.java2kotlin.converter=Java to Kotlin Converter