KT-10028 Support parallel builds in maven

Mark mojo's as thread safe as users confirmed that all related errors
seem to be fixed
This commit is contained in:
Sergey Mashkov
2017-05-04 14:33:47 +03:00
parent 3f5b8b3f68
commit fd0578b564
6 changed files with 6 additions and 6 deletions
@@ -75,7 +75,7 @@ import java.util.List;
* mojo.getLog().info("kotlin build script accessing build info of ${mojo.project.artifactId} project") * mojo.getLog().info("kotlin build script accessing build info of ${mojo.project.artifactId} project")
* </code></pre> * </code></pre>
*/ */
@Mojo(name = "script", requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = false) @Mojo(name = "script", requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class ExecuteKotlinScriptMojo extends AbstractMojo { public class ExecuteKotlinScriptMojo extends AbstractMojo {
/** /**
* The Kotlin script file to be executed. * The Kotlin script file to be executed.
@@ -47,7 +47,7 @@ import java.util.concurrent.locks.ReentrantLock;
* *
* @noinspection UnusedDeclaration * @noinspection UnusedDeclaration
*/ */
@Mojo(name = "js", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = false) @Mojo(name = "js", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArguments> { public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArguments> {
private static final String OUTPUT_DIRECTORIES_COLLECTOR_PROPERTY_NAME = "outputDirectoriesCollector"; private static final String OUTPUT_DIRECTORIES_COLLECTOR_PROPERTY_NAME = "outputDirectoriesCollector";
@@ -40,7 +40,7 @@ import static org.jetbrains.kotlin.maven.Util.filterClassPath;
* *
* @noinspection UnusedDeclaration * @noinspection UnusedDeclaration
*/ */
@Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = false) @Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class K2JVMCompileMojo extends KotlinCompileMojoBase<K2JVMCompilerArguments> { public class K2JVMCompileMojo extends KotlinCompileMojoBase<K2JVMCompilerArguments> {
/** /**
* Project classpath. * Project classpath.
@@ -42,7 +42,7 @@ import java.util.List;
@Mojo(name = "test-compile", @Mojo(name = "test-compile",
defaultPhase = LifecyclePhase.TEST_COMPILE, defaultPhase = LifecyclePhase.TEST_COMPILE,
requiresDependencyResolution = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = false threadSafe = true
) )
public class KotlinTestCompileMojo extends K2JVMCompileMojo { public class KotlinTestCompileMojo extends K2JVMCompileMojo {
/** /**
@@ -18,7 +18,7 @@ import java.util.List;
import static com.intellij.openapi.util.text.StringUtil.join; import static com.intellij.openapi.util.text.StringUtil.join;
import static org.jetbrains.kotlin.maven.Util.filterClassPath; import static org.jetbrains.kotlin.maven.Util.filterClassPath;
@Mojo(name = "metadata", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = false) @Mojo(name = "metadata", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class MetadataMojo extends KotlinCompileMojoBase<K2MetadataCompilerArguments> { public class MetadataMojo extends KotlinCompileMojoBase<K2MetadataCompilerArguments> {
@Parameter(defaultValue = "${project.compileClasspathElements}", required = true, readonly = true) @Parameter(defaultValue = "${project.compileClasspathElements}", required = true, readonly = true)
public List<String> classpath; public List<String> classpath;
@@ -13,7 +13,7 @@ import java.io.File;
import java.util.List; import java.util.List;
@Mojo(name = "test-metadata", defaultPhase = LifecyclePhase.PROCESS_TEST_SOURCES, requiresDependencyResolution = ResolutionScope.TEST, @Mojo(name = "test-metadata", defaultPhase = LifecyclePhase.PROCESS_TEST_SOURCES, requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = false threadSafe = true
) )
public class TestMetadataMojo extends MetadataMojo { public class TestMetadataMojo extends MetadataMojo {
@Parameter(property = "maven.test.skip", defaultValue = "false") @Parameter(property = "maven.test.skip", defaultValue = "false")