Skip to content

Commit 080e616

Browse files
Aleksei.CherepanovSpace Team
Aleksei.Cherepanov
authored and
Space Team
committed
[JPS] Add "installJps" task and update module exclusions
Introduce an "installJps" task to enhance the local publishing process. Update maven project configuration to exclude specific test modules for local JPS publication. Also, add documentation in jps/README.md on how to publish JPS locally for use in IntelliJ IDEA. #KT-73688 Fixed Merge-request: KT-MR-19228 Merged-by: Aleksei Cherepanov <[email protected]>
1 parent 00fa8a0 commit 080e616

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

build.gradle.kts

+17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import org.gradle.crypto.checksum.Checksum
22
import org.gradle.plugins.ide.idea.model.IdeaModel
33
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
44
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
5+
import plugins.KotlinBuildPublishingPlugin
56

67
buildscript {
78
// a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes
@@ -1082,6 +1083,22 @@ tasks {
10821083
environment("JDK_1_8", getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8).get())
10831084
}
10841085
}
1086+
1087+
register<Exec>("installJps") {
1088+
val installTask = this
1089+
allprojects {
1090+
plugins.withType<MavenPublishPlugin> {
1091+
installTask.dependsOn(tasks.named("publishToMavenLocal"))
1092+
}
1093+
}
1094+
group = "publishing"
1095+
workingDir = rootProject.projectDir.resolve("libraries")
1096+
commandLine = getMvnwCmd() + listOf("clean", "install", "-DskipTests", "-DexcludeTestModules=true")
1097+
val jdk8Home = getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8)
1098+
doFirst {
1099+
environment("JDK_1_8", jdk8Home.get())
1100+
}
1101+
}
10851102
}
10861103

10871104
val zipCompiler by tasks.registering(Zip::class) {

jps/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# How to publish JPS locally to consume it in Intellij Idea
2+
3+
You can use `installJps` task or run:
4+
```shell
5+
cd ..
6+
./gradlew installJps && \
7+
echo Finished successfully
8+
```

libraries/pom.xml

+12-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@
9595

9696
<module>tools/kotlin-bom</module>
9797
<module>tools/kotlin-dist-for-jps-meta</module>
98-
99-
<module>tools/kotlin-maven-plugin-test</module>
100-
101-
<module>examples/kotlin-java-example</module>
10298
</modules>
10399

104100
<dependencies>
@@ -425,5 +421,17 @@
425421
</plugins>
426422
</build>
427423
</profile>
424+
<profile>
425+
<id>exclude-test-modules</id>
426+
<activation>
427+
<property>
428+
<name>!excludeTestModules</name>
429+
</property>
430+
</activation>
431+
<modules>
432+
<module>tools/kotlin-maven-plugin-test</module>
433+
<module>examples/kotlin-java-example</module>
434+
</modules>
435+
</profile>
428436
</profiles>
429437
</project>

repo/artifacts-tests/src/test/resources/org/jetbrains/kotlin/kotlin-project/kotlin-project.pom

+12-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@
9595

9696
<module>tools/kotlin-bom</module>
9797
<module>tools/kotlin-dist-for-jps-meta</module>
98-
99-
<module>tools/kotlin-maven-plugin-test</module>
100-
101-
<module>examples/kotlin-java-example</module>
10298
</modules>
10399

104100
<dependencies>
@@ -425,5 +421,17 @@
425421
</plugins>
426422
</build>
427423
</profile>
424+
<profile>
425+
<id>exclude-test-modules</id>
426+
<activation>
427+
<property>
428+
<name>!excludeTestModules</name>
429+
</property>
430+
</activation>
431+
<modules>
432+
<module>tools/kotlin-maven-plugin-test</module>
433+
<module>examples/kotlin-java-example</module>
434+
</modules>
435+
</profile>
428436
</profiles>
429437
</project>

0 commit comments

Comments
 (0)