Drop external annotations support in build tools
External annotations will only be considered in the IDE for additional inspections based on more precise types in Java libraries
This commit is contained in:
committed by
Dmitry Jemerov
parent
f2efd30a5d
commit
13c54a2678
@@ -33,14 +33,6 @@ import org.jetbrains.jps.builders.logging.ProjectBuilderLogger;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
import org.jetbrains.jps.incremental.ModuleBuildTarget;
|
||||
import org.jetbrains.jps.incremental.ProjectBuildException;
|
||||
import org.jetbrains.jps.model.java.JpsAnnotationRootType;
|
||||
import org.jetbrains.jps.model.java.JpsJavaSdkType;
|
||||
import org.jetbrains.jps.model.library.JpsLibrary;
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdk;
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdkType;
|
||||
import org.jetbrains.jps.model.module.JpsDependencyElement;
|
||||
import org.jetbrains.jps.model.module.JpsModule;
|
||||
import org.jetbrains.jps.model.module.JpsSdkDependency;
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation;
|
||||
import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder;
|
||||
|
||||
@@ -92,7 +84,6 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
moduleSources,
|
||||
findSourceRoots(context, target),
|
||||
findClassPathRoots(target),
|
||||
findAnnotationRoots(target),
|
||||
(JavaModuleBuildTargetType) targetType,
|
||||
// this excludes the output directories from the class path, to be removed for true incremental compilation
|
||||
outputDirs
|
||||
@@ -149,33 +140,6 @@ public class KotlinBuilderModuleScriptGenerator {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<File> findAnnotationRoots(@NotNull ModuleBuildTarget target) {
|
||||
LinkedHashSet<File> annotationRootFiles = new LinkedHashSet<File>();
|
||||
|
||||
JpsModule module = target.getModule();
|
||||
JpsSdk sdk = module.getSdk(getSdkType(module));
|
||||
if (sdk != null) {
|
||||
annotationRootFiles.addAll(sdk.getParent().getFiles(JpsAnnotationRootType.INSTANCE));
|
||||
}
|
||||
|
||||
for (JpsLibrary library : getAllDependencies(target).getLibraries()) {
|
||||
annotationRootFiles.addAll(library.getFiles(JpsAnnotationRootType.INSTANCE));
|
||||
}
|
||||
|
||||
// JDK is stored locally on user's machine, so its configuration, including external annotation paths
|
||||
// is not available on TeamCity. When running on TeamCity, one has to provide extra path to JDK annotations
|
||||
String extraAnnotationsPaths = System.getProperty("jps.kotlin.extra.annotation.paths");
|
||||
if (extraAnnotationsPaths != null) {
|
||||
String[] paths = extraAnnotationsPaths.split(";");
|
||||
for (String path : paths) {
|
||||
annotationRootFiles.add(new File(path));
|
||||
}
|
||||
}
|
||||
|
||||
return CollectionsKt.toList(annotationRootFiles);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static JpsSdkType getSdkType(@NotNull JpsModule module) {
|
||||
for (JpsDependencyElement dependency : module.getDependenciesList().getDependencies()) {
|
||||
|
||||
@@ -45,7 +45,6 @@ public class KotlinModuleXmlBuilder {
|
||||
List<File> sourceFiles,
|
||||
List<File> javaSourceRoots,
|
||||
Collection<File> classpathRoots,
|
||||
List<File> annotationRoots,
|
||||
JavaModuleBuildTargetType targetType,
|
||||
Set<File> directoriesToFilterOut
|
||||
) {
|
||||
@@ -71,7 +70,6 @@ public class KotlinModuleXmlBuilder {
|
||||
|
||||
processJavaSourceRoots(javaSourceRoots);
|
||||
processClasspath(classpathRoots, directoriesToFilterOut);
|
||||
processAnnotationRoots(annotationRoots);
|
||||
|
||||
closeTag(p, MODULE);
|
||||
return this;
|
||||
@@ -102,13 +100,6 @@ public class KotlinModuleXmlBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private void processAnnotationRoots(@NotNull List<File> files) {
|
||||
p.println("<!-- External annotations -->");
|
||||
for (File file : files) {
|
||||
p.println("<", EXTERNAL_ANNOTATIONS, " ", PATH, "=\"", getEscapedPath(file), "\"/>");
|
||||
}
|
||||
}
|
||||
|
||||
private void processJavaSourceRoots(@NotNull List<File> files) {
|
||||
p.println("<!-- Java source roots -->");
|
||||
for (File file : files) {
|
||||
|
||||
Reference in New Issue
Block a user