Revert "Suppress warning for mvn+kapt+jdk9"
This reverts commit 3fc91b01
This commit is contained in:
+7
-21
@@ -40,9 +40,7 @@ import java.util.stream.Collectors;
|
|||||||
import static org.jetbrains.kotlin.maven.Util.joinArrays;
|
import static org.jetbrains.kotlin.maven.Util.joinArrays;
|
||||||
import static org.jetbrains.kotlin.maven.kapt.AnnotationProcessingManager.*;
|
import static org.jetbrains.kotlin.maven.kapt.AnnotationProcessingManager.*;
|
||||||
|
|
||||||
/**
|
/** @noinspection UnusedDeclaration */
|
||||||
* @noinspection UnusedDeclaration
|
|
||||||
*/
|
|
||||||
@Mojo(name = "kapt", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE)
|
@Mojo(name = "kapt", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE)
|
||||||
public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
||||||
@Parameter
|
@Parameter
|
||||||
@@ -74,7 +72,7 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
@Component
|
@Component
|
||||||
private ArtifactHandlerManager artifactHandlerManager;
|
private ArtifactHandlerManager artifactHandlerManager;
|
||||||
|
|
||||||
@Parameter(defaultValue = "${session}", readonly = true, required = true)
|
@Parameter( defaultValue = "${session}", readonly = true, required = true )
|
||||||
private MavenSession session;
|
private MavenSession session;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -167,7 +165,7 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
.filter(path -> {
|
.filter(path -> {
|
||||||
File pathFile = new File(path);
|
File pathFile = new File(path);
|
||||||
return !pathFile.equals(generatedSourcesDirectory)
|
return !pathFile.equals(generatedSourcesDirectory)
|
||||||
&& !pathFile.equals(generatedKotlinSourcesDirectory);
|
&& !pathFile.equals(generatedKotlinSourcesDirectory);
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -189,8 +187,7 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureSpecificCompilerArguments(@NotNull K2JVMCompilerArguments arguments, @NotNull List<File> sourceRoots)
|
protected void configureSpecificCompilerArguments(@NotNull K2JVMCompilerArguments arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException {
|
||||||
throws MojoExecutionException {
|
|
||||||
super.configureSpecificCompilerArguments(arguments, sourceRoots);
|
super.configureSpecificCompilerArguments(arguments, sourceRoots);
|
||||||
|
|
||||||
AnnotationProcessingManager.ResolvedArtifacts resolvedArtifacts;
|
AnnotationProcessingManager.ResolvedArtifacts resolvedArtifacts;
|
||||||
@@ -210,8 +207,8 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
joinArrays(
|
joinArrays(
|
||||||
arguments.getPluginClasspaths(),
|
arguments.getPluginClasspaths(),
|
||||||
(jdkToolsJarPath == null)
|
(jdkToolsJarPath == null)
|
||||||
? new String[] {resolvedArtifacts.kaptCompilerPluginArtifact}
|
? new String[]{resolvedArtifacts.kaptCompilerPluginArtifact}
|
||||||
: new String[] {jdkToolsJarPath, resolvedArtifacts.kaptCompilerPluginArtifact}
|
: new String[]{jdkToolsJarPath, resolvedArtifacts.kaptCompilerPluginArtifact}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -223,16 +220,6 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
getLog().warn("Can't determine Java home, 'java.home' property does not exist");
|
getLog().warn("Can't determine Java home, 'java.home' property does not exist");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
val jdkVersion = try {
|
|
||||||
System.getProperty("java.specification.version") ?.toInt()
|
|
||||||
}
|
|
||||||
catch (e:NumberFormatException){
|
|
||||||
// we got 1.8 or 1.6
|
|
||||||
null
|
|
||||||
} ?:0
|
|
||||||
if (jdkVersion >= 9) return null
|
|
||||||
|
|
||||||
File javaHome = new File(javaHomePath);
|
File javaHome = new File(javaHomePath);
|
||||||
File toolsJar = new File(javaHome, "lib/tools.jar");
|
File toolsJar = new File(javaHome, "lib/tools.jar");
|
||||||
if (toolsJar.exists()) {
|
if (toolsJar.exists()) {
|
||||||
@@ -337,8 +324,7 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
|||||||
|
|
||||||
oos.flush();
|
oos.flush();
|
||||||
return Base64.getEncoder().encodeToString(os.toByteArray());
|
return Base64.getEncoder().encodeToString(os.toByteArray());
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
// Should not occur
|
// Should not occur
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user