diff --git a/build.gradle.kts b/build.gradle.kts index 7b8bf3a..c18e67a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "ru.mipt.npm" -version = "0.9.7" +version = "0.9.8" description = "Build tools for DataForge and kscience projects" diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index bc059c6..0000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'gradle-tools' - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..666c23d --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "gradle-tools" \ No newline at end of file diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt index 33a9556..c4b280a 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt @@ -40,7 +40,6 @@ open class KScienceCommonPlugin : Plugin { } tasks.withType { kotlinOptions { - useIR = true jvmTarget = KScienceVersions.JVM_TARGET.toString() freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" } @@ -95,7 +94,6 @@ open class KScienceCommonPlugin : Plugin { jvm { compilations.all { kotlinOptions { - useIR = true jvmTarget = KScienceVersions.JVM_TARGET.toString() freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt index 0863f7a..a4cfef2 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -147,6 +147,7 @@ class KScienceExtension(val project: Project) { } } + @Deprecated("Replace by applying maven-publish plugin") fun publish() { project.plugins.apply(MavenPublishPlugin::class) } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index 14f38a3..22207d4 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -16,7 +16,7 @@ import ru.mipt.npm.gradle.internal.* class KSciencePublishingExtension(val project: Project) { private var initializedFlag = false - fun configurePublications(vcsUrl: String) { + fun vcs(vcsUrl: String) { if (!initializedFlag) { project.setupPublication(vcsUrl) initializedFlag = true @@ -25,21 +25,35 @@ class KSciencePublishingExtension(val project: Project) { /** * github publishing + * @param publish include github packages in release publishing. By default - false */ - fun github(githubProject: String, githubOrg: String = "mipt-npm") { + fun github(githubProject: String, githubOrg: String = "mipt-npm", publish: Boolean = false) { //automatically initialize vcs using github if (!initializedFlag) { - configurePublications("https://github.com/$githubOrg/$githubProject") + vcs("https://github.com/$githubOrg/$githubProject") } project.addGithubPublishing(githubOrg, githubProject) + + if (publish) { + val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToGithubRepository") + releaseTask?.dependsOn(publicationTask) + } + } + + private val releaseTask by lazy { + project.tasks.findByName("release") } /** * Space publishing */ - fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven") { - require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" } + fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", publish: Boolean = false) { + require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } project.addSpacePublishing(spaceRepo) + if (publish) { + val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSpaceRepository") + releaseTask?.dependsOn(publicationTask) + } } // // Bintray publishing @@ -51,9 +65,13 @@ class KSciencePublishingExtension(val project: Project) { /** * Sonatype publishing */ - fun sonatype() { - require(initializedFlag) { "The publishing is not set up use 'configurePublications' method to do so" } + fun sonatype(publish: Boolean = true) { + require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } project.addSonatypePublishing() + if (publish) { + val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSonatypeRepository") + releaseTask?.dependsOn(publicationTask) + } } } @@ -65,7 +83,7 @@ open class KScienceProjectPlugin : Plugin { override fun apply(target: Project): Unit = target.run { apply() - if(!isSnapshot()) { + if (!isSnapshot()) { configure { version = project.version.toString() } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index 5bd3499..76c2a9a 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -11,7 +11,7 @@ object KScienceVersions { const val coroutinesVersion = "1.5.0" const val serializationVersion = "1.2.1" const val atomicVersion = "0.16.1" - const val ktorVersion = "1.5.3" + const val ktorVersion = "1.5.4" const val htmlVersion = "0.7.3" const val dateTimeVersion = "0.2.0" diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt index 775dc2f..930ddb6 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt @@ -22,7 +22,6 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit { internal fun RepositoryHandler.applyRepos(): Unit { mavenCentral() maven("https://repo.kotlin.link") - maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers") } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt index d37ebeb..b8a3079 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/publishing.kt @@ -110,7 +110,7 @@ internal val Project.publicationTarget: String internal fun Project.addGithubPublishing( githubOrg: String, - githubProject: String + githubProject: String, ) { if (requestPropertyOrNull("publishing.enabled") != "true") { logger.info("Skipping github publishing because publishing is disabled") @@ -139,8 +139,6 @@ internal fun Project.addGithubPublishing( } } } - val publicationTask = tasks.getByName("publish${publicationTarget}ToGithubRepository") - rootProject.tasks.findByName("release")?.dependsOn(publicationTask) } } } @@ -174,8 +172,6 @@ internal fun Project.addSpacePublishing(spaceRepo: String) { } } } - val publicationTask = tasks.getByName("publish${publicationTarget}ToSpaceRepository") - rootProject.tasks.findByName("release")?.dependsOn(publicationTask) } } } @@ -229,8 +225,6 @@ internal fun Project.addSonatypePublishing() { } } } - val publicationTask = tasks.getByName("publish${publicationTarget}ToSonatypeRepository") - rootProject.tasks.findByName("release")?.dependsOn(publicationTask) } } }