Drop module "ktm" scripts and support java source roots in "xml" modules
Drop kotlin.modules package from runtime Move adapted classes into compiler Unsupport files with "ktm" extension Delete code for loading module scripts Drop tests for module scripts Separate section for java source roots in xml script generator/parser
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.cli.common.modules
|
||||
|
||||
public trait Module {
|
||||
public fun getModuleName(): String
|
||||
|
||||
public fun getOutputDirectory(): String
|
||||
|
||||
public fun getSourceFiles(): List<String>
|
||||
|
||||
public fun getClasspathRoots(): List<String>
|
||||
|
||||
public fun getAnnotationsRoots(): List<String>
|
||||
|
||||
public fun getJavaSourceRoots(): List<String>
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.cli.common.modules
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
public class ModuleBuilder(private val name: String, private val outputDir: String) : Module {
|
||||
private val sourceFiles = ArrayList<String>()
|
||||
private val classpathRoots = ArrayList<String>()
|
||||
private val javaSourceRoots = ArrayList<String>()
|
||||
private val annotationsRoots = ArrayList<String>()
|
||||
|
||||
public fun addSourceFiles(pattern: String) {
|
||||
sourceFiles.add(pattern)
|
||||
}
|
||||
|
||||
public fun addClasspathEntry(name: String) {
|
||||
classpathRoots.add(name)
|
||||
}
|
||||
|
||||
public fun addAnnotationsPathEntry(name: String) {
|
||||
annotationsRoots.add(name)
|
||||
}
|
||||
|
||||
public fun addJavaSourceRoot(name: String) {
|
||||
javaSourceRoots.add(name)
|
||||
}
|
||||
|
||||
override fun getOutputDirectory(): String = outputDir
|
||||
override fun getJavaSourceRoots(): List<String> = javaSourceRoots
|
||||
override fun getSourceFiles(): List<String> = sourceFiles
|
||||
override fun getClasspathRoots(): List<String> = classpathRoots
|
||||
override fun getAnnotationsRoots(): List<String> = annotationsRoots
|
||||
override fun getModuleName(): String = name
|
||||
}
|
||||
|
||||
-1
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.modules;
|
||||
|
||||
import kotlin.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
+5
-2
@@ -18,8 +18,6 @@ package org.jetbrains.kotlin.cli.common.modules;
|
||||
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import kotlin.modules.Module;
|
||||
import kotlin.modules.ModuleBuilder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollectorUtil;
|
||||
@@ -44,6 +42,7 @@ public class ModuleXmlParser {
|
||||
public static final String NAME = "name";
|
||||
public static final String OUTPUT_DIR = "outputDir";
|
||||
public static final String SOURCES = "sources";
|
||||
public static final String JAVA_SOURCE_ROOTS = "javaSourceRoots";
|
||||
public static final String PATH = "path";
|
||||
public static final String CLASSPATH = "classpath";
|
||||
public static final String EXTERNAL_ANNOTATIONS = "externalAnnotations";
|
||||
@@ -162,6 +161,10 @@ public class ModuleXmlParser {
|
||||
String path = getAttribute(attributes, PATH, qName);
|
||||
moduleBuilder.addAnnotationsPathEntry(path);
|
||||
}
|
||||
else if (JAVA_SOURCE_ROOTS.equalsIgnoreCase(qName)) {
|
||||
String path = getAttribute(attributes, PATH, qName);
|
||||
moduleBuilder.addJavaSourceRoot(path);
|
||||
}
|
||||
else {
|
||||
throw createError(qName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user