Use kotlin.modules.* instead of jet.modules.*
This commit is contained in:
@@ -20,7 +20,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Function;
|
||||
import jet.modules.Module;
|
||||
import kotlin.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.cli.common.CLIConfigurationKeys;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This interface duplicates {@link jet.modules.Module}, because cli-common should not depend on kotlin-runtime.jar
|
||||
* This interface duplicates {@link kotlin.modules.Module}, because cli-common should not depend on kotlin-runtime.jar
|
||||
*/
|
||||
public interface ModuleDescription {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.jetbrains.jet.cli.jvm.compiler
|
||||
|
||||
import jet.modules.Module
|
||||
import kotlin.modules.Module
|
||||
|
||||
class ChunkAsOneModule(private val chunk: ModuleChunk) : Module {
|
||||
override fun getModuleName(): String = "chunk" + chunk.getModules().map { it.getModuleName() }.toString()
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import jet.modules.AllModules;
|
||||
import jet.modules.Module;
|
||||
import kotlin.modules.AllModules;
|
||||
import kotlin.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.OutputFile;
|
||||
@@ -42,9 +42,9 @@ import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.utils.UtilsPackage;
|
||||
import org.jetbrains.jet.utils.KotlinPaths;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
import org.jetbrains.jet.utils.UtilsPackage;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -117,7 +117,7 @@ public class CompileEnvironmentUtil {
|
||||
loadModuleScriptText(moduleScriptFile));
|
||||
}
|
||||
|
||||
modules = runDefineModules(paths, moduleScriptFile, generationState.getFactory());
|
||||
modules = runDefineModules(paths, generationState.getFactory());
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(disposable);
|
||||
@@ -133,7 +133,7 @@ public class CompileEnvironmentUtil {
|
||||
return modules;
|
||||
}
|
||||
|
||||
private static List<Module> runDefineModules(KotlinPaths paths, String moduleFile, ClassFileFactory factory) {
|
||||
private static List<Module> runDefineModules(KotlinPaths paths, ClassFileFactory factory) {
|
||||
File stdlibJar = paths.getRuntimePath();
|
||||
GeneratedClassLoader loader;
|
||||
if (stdlibJar.exists()) {
|
||||
@@ -149,17 +149,14 @@ public class CompileEnvironmentUtil {
|
||||
loader = new GeneratedClassLoader(factory, KotlinToJVMBytecodeCompiler.class.getClassLoader());
|
||||
}
|
||||
try {
|
||||
Class packageClass = loader.loadClass(PackageClassUtils.getPackageClassName(FqName.ROOT));
|
||||
Class<?> packageClass = loader.loadClass(PackageClassUtils.getPackageClassName(FqName.ROOT));
|
||||
Method method = packageClass.getDeclaredMethod("project");
|
||||
if (method == null) {
|
||||
throw new CompileEnvironmentException("Module script " + moduleFile + " must define project() function");
|
||||
}
|
||||
|
||||
method.setAccessible(true);
|
||||
method.invoke(null);
|
||||
|
||||
ArrayList<Module> answer = new ArrayList<Module>(AllModules.modules.get());
|
||||
AllModules.modules.get().clear();
|
||||
ArrayList<Module> answer = new ArrayList<Module>(AllModules.instance$.get());
|
||||
AllModules.instance$.get().clear();
|
||||
return answer;
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -276,26 +273,31 @@ public class CompileEnvironmentUtil {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return description.getModuleName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getOutputDirectory() {
|
||||
return description.getOutputDir();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getSourceFiles() {
|
||||
return description.getSourceFiles();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getClasspathRoots() {
|
||||
return description.getClasspathRoots();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getAnnotationsRoots() {
|
||||
return description.getAnnotationsRoots();
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import jet.Function0;
|
||||
import jet.modules.AllModules;
|
||||
import jet.modules.Module;
|
||||
import kotlin.modules.AllModules;
|
||||
import kotlin.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.jet.cli.jvm.compiler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import jet.modules.Module;
|
||||
import kotlin.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
@@ -1,32 +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 jet.modules;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AllModules {
|
||||
|
||||
public static final ThreadLocal<ArrayList<Module>> modules = new ThreadLocal<ArrayList<Module>>() {
|
||||
@Override
|
||||
protected ArrayList<Module> initialValue() {
|
||||
return new ArrayList<Module>();
|
||||
}
|
||||
};
|
||||
|
||||
private AllModules() {
|
||||
}
|
||||
}
|
||||
@@ -1,38 +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 jet.modules;
|
||||
|
||||
import jet.runtime.typeinfo.KotlinSignature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Module {
|
||||
@KotlinSignature("fun getModuleName(): String")
|
||||
String getModuleName();
|
||||
|
||||
@KotlinSignature("fun getOutputDirectory(): String")
|
||||
String getOutputDirectory();
|
||||
|
||||
@KotlinSignature("fun getSourceFiles(): List<String>")
|
||||
List<String> getSourceFiles();
|
||||
|
||||
@KotlinSignature("fun getClasspathRoots(): List<String>")
|
||||
List<String> getClasspathRoots();
|
||||
|
||||
@KotlinSignature("fun getAnnotationsRoots(): List<String>")
|
||||
List<String> getAnnotationsRoots();
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import java.util.ArrayList
|
||||
public fun module(name: String, outputDir: String, callback: ModuleBuilder.() -> Unit) {
|
||||
val builder = ModuleBuilder(name, outputDir)
|
||||
builder.callback()
|
||||
jet.modules.AllModules.modules.get()?.add(builder)
|
||||
kotlin.modules.AllModules.get()?.add(builder)
|
||||
AllModules.get()?.add(builder)
|
||||
}
|
||||
|
||||
class SourcesBuilder(val parent: ModuleBuilder) {
|
||||
@@ -27,7 +26,7 @@ class AnnotationsPathBuilder(val parent: ModuleBuilder) {
|
||||
}
|
||||
}
|
||||
|
||||
open class ModuleBuilder(val name: String, val outputDir: String): jet.modules.Module, kotlin.modules.Module {
|
||||
open class ModuleBuilder(val name: String, val outputDir: String): Module {
|
||||
// http://youtrack.jetbrains.net/issue/KT-904
|
||||
private val sourceFiles0 = ArrayList<String>()
|
||||
private val classpathRoots0 = ArrayList<String>()
|
||||
|
||||
Reference in New Issue
Block a user