Skip to content

Commit

Permalink
[JPS] Add "installJps" task and update module exclusions
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Aleksei.Cherepanov authored and Space Team committed Dec 17, 2024
1 parent 00fa8a0 commit 080e616
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
17 changes: 17 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.gradle.crypto.checksum.Checksum
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import plugins.KotlinBuildPublishingPlugin

buildscript {
// a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes
Expand Down Expand Up @@ -1082,6 +1083,22 @@ tasks {
environment("JDK_1_8", getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8).get())
}
}

register<Exec>("installJps") {
val installTask = this
allprojects {
plugins.withType<MavenPublishPlugin> {
installTask.dependsOn(tasks.named("publishToMavenLocal"))
}
}
group = "publishing"
workingDir = rootProject.projectDir.resolve("libraries")
commandLine = getMvnwCmd() + listOf("clean", "install", "-DskipTests", "-DexcludeTestModules=true")
val jdk8Home = getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8)
doFirst {
environment("JDK_1_8", jdk8Home.get())
}
}
}

val zipCompiler by tasks.registering(Zip::class) {
Expand Down
8 changes: 8 additions & 0 deletions jps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# How to publish JPS locally to consume it in Intellij Idea

You can use `installJps` task or run:
```shell
cd ..
./gradlew installJps && \
echo Finished successfully
```
16 changes: 12 additions & 4 deletions libraries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@

<module>tools/kotlin-bom</module>
<module>tools/kotlin-dist-for-jps-meta</module>

<module>tools/kotlin-maven-plugin-test</module>

<module>examples/kotlin-java-example</module>
</modules>

<dependencies>
Expand Down Expand Up @@ -425,5 +421,17 @@
</plugins>
</build>
</profile>
<profile>
<id>exclude-test-modules</id>
<activation>
<property>
<name>!excludeTestModules</name>
</property>
</activation>
<modules>
<module>tools/kotlin-maven-plugin-test</module>
<module>examples/kotlin-java-example</module>
</modules>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@

<module>tools/kotlin-bom</module>
<module>tools/kotlin-dist-for-jps-meta</module>

<module>tools/kotlin-maven-plugin-test</module>

<module>examples/kotlin-java-example</module>
</modules>

<dependencies>
Expand Down Expand Up @@ -425,5 +421,17 @@
</plugins>
</build>
</profile>
<profile>
<id>exclude-test-modules</id>
<activation>
<property>
<name>!excludeTestModules</name>
</property>
</activation>
<modules>
<module>tools/kotlin-maven-plugin-test</module>
<module>examples/kotlin-java-example</module>
</modules>
</profile>
</profiles>
</project>

0 comments on commit 080e616

Please sign in to comment.