From 2ad0630b7b3f5bfedbd612120d3db345f9651369 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 14 Jul 2021 12:05:49 +0300 Subject: [PATCH 1/5] versions update --- build.gradle.kts | 16 ++++++++-------- .../ru/mipt/npm/gradle/KScienceVersions.kt | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6f24dd6..dbbd7d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,12 +3,12 @@ plugins { `kotlin-dsl` `maven-publish` signing - id("org.jetbrains.changelog") version "1.1.2" - id("org.jetbrains.dokka") version "1.4.32" + id("org.jetbrains.changelog") version "1.2.0" + id("org.jetbrains.dokka") version "1.5.0" } group = "ru.mipt.npm" -version = "0.10.0" +version = "0.10.1" description = "Build tools for DataForge and kscience projects" @@ -22,7 +22,7 @@ repositories { maven("https://repo.kotlin.link") } -val kotlinVersion = "1.5.10" +val kotlinVersion = "1.5.21" java { targetCompatibility = JavaVersion.VERSION_11 @@ -30,11 +30,11 @@ java { dependencies { api("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - implementation("org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin:0.10.0-53") + implementation("org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin:0.10.0-126-1") implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") - implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32") - implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2") + implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.2") + implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.5.0") + implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.2.0") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0") } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index 06ada3c..4baae5e 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -6,20 +6,20 @@ import org.gradle.api.JavaVersion * Build constants */ object KScienceVersions { - const val kotlinVersion = "1.5.10" + const val kotlinVersion = "1.5.21" const val kotlinxNodeVersion = "0.0.7" - const val coroutinesVersion = "1.5.0" + const val coroutinesVersion = "1.5.1" const val serializationVersion = "1.2.1" - const val atomicVersion = "0.16.1" - const val ktorVersion = "1.6.0" + const val atomicVersion = "0.16.2" + const val ktorVersion = "1.6.1" const val htmlVersion = "0.7.3" const val dateTimeVersion = "0.2.1" - const val jsBom = "0.0.1-pre.213-kotlin-1.5.10" + const val jsBom = "0.0.1-pre.216-kotlin-1.5.20" val JVM_TARGET = JavaVersion.VERSION_11 object Serialization{ const val xmlVersion = "0.82.0" - const val yamlKtVersion = "0.9.0" + const val yamlKtVersion = "0.10.0" } } -- 2.34.1 From 4eeb81cdbbda72bda2ebf442d7e1e10a02bbfe12 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 14 Jul 2021 12:25:20 +0300 Subject: [PATCH 2/5] versions update --- build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index dbbd7d6..bb08d99 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ version = "0.10.1" description = "Build tools for DataForge and kscience projects" changelog{ - version = project.version.toString() + setVersion(project.version.toString()) } repositories { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf..05679dc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index 16862e9..a56fcbc 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -98,7 +98,7 @@ open class KScienceProjectPlugin : Plugin { } } else { configure { - version = project.version.toString() + setVersion(project.version.toString()) } } } -- 2.34.1 From f11d47aee5c33844fdab3ca4a31a403be045a5f9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 15 Jul 2021 12:14:42 +0300 Subject: [PATCH 3/5] versions update --- src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt index 4baae5e..b8acdb4 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -9,7 +9,7 @@ object KScienceVersions { const val kotlinVersion = "1.5.21" const val kotlinxNodeVersion = "0.0.7" const val coroutinesVersion = "1.5.1" - const val serializationVersion = "1.2.1" + const val serializationVersion = "1.2.2" const val atomicVersion = "0.16.2" const val ktorVersion = "1.6.1" const val htmlVersion = "0.7.3" -- 2.34.1 From b70037385c3579ab062bfab92b38f62e02488bd6 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 21 Jul 2021 01:47:04 +0700 Subject: [PATCH 4/5] Fix dependencies of release task --- .../mipt/npm/gradle/KScienceProjectPlugin.kt | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index a56fcbc..c163c3d 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -5,6 +5,7 @@ import kotlinx.validation.ApiValidationExtension import kotlinx.validation.BinaryCompatibilityValidatorPlugin import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.Task import org.gradle.kotlin.dsl.* import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.changelog.ChangelogPluginExtension @@ -13,6 +14,8 @@ import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaTask import ru.mipt.npm.gradle.internal.* +private fun Project.allTasks(): Set = allprojects.flatMapTo(HashSet()) { it.tasks } + @Suppress("unused") class KSciencePublishingExtension(val project: Project) { private var initializedFlag = false @@ -33,13 +36,17 @@ class KSciencePublishingExtension(val project: Project) { if (!initializedFlag) { vcs("https://github.com/$githubOrg/$githubProject") } + project.addGithubPublishing(githubOrg, githubProject) - if (publish) { - project.tasks.findByName("publish${project.publicationTarget}ToGithubRepository")?.let {publicationTask-> - releaseTask?.dependsOn(publicationTask) + if (publish) + project.afterEvaluate { + allTasks() + .find { it.name == "publish${publicationTarget}ToGithubRepository" } + ?.let { publicationTask -> + releaseTask?.dependsOn(publicationTask) + } } - } } private val releaseTask by lazy { @@ -52,11 +59,13 @@ class KSciencePublishingExtension(val project: Project) { 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) { - project.tasks.findByName("publish${project.publicationTarget}ToSpaceRepository")?.let { publicationTask -> - releaseTask?.dependsOn(publicationTask) + + if (publish) + project.afterEvaluate { + allTasks() + .find { it.name == "publish${publicationTarget}ToSpaceRepository" } + ?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) } } - } } // // Bintray publishing @@ -71,16 +80,16 @@ class KSciencePublishingExtension(val project: Project) { fun sonatype(publish: Boolean = true) { require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } project.addSonatypePublishing() - if (publish) { - project.tasks.findByName("publish${project.publicationTarget}ToSonatypeRepository") - ?.let { publicationTask -> - releaseTask?.dependsOn(publicationTask) - } - } + + if (publish) + project.afterEvaluate { + allTasks() + .find { it.name == "publish${publicationTarget}ToSonatypeRepository" } + ?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) } + } } } - /** * Apply extension and repositories */ @@ -98,7 +107,7 @@ open class KScienceProjectPlugin : Plugin { } } else { configure { - setVersion(project.version.toString()) + version.set(project.version.toString()) } } } @@ -225,4 +234,4 @@ open class KScienceProjectPlugin : Plugin { companion object { const val RELEASE_GROUP = "release" } -} \ No newline at end of file +} -- 2.34.1 From 100f7cd55ff04b540caa7260078bb68fa76b8afe Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 21 Jul 2021 13:01:29 +0300 Subject: [PATCH 5/5] 0.10.2 --- CHANGELOG.md | 15 ++++++++++ README.md | 3 -- build.gradle.kts | 2 +- .../ru/mipt/npm/gradle/internal/common.kt | 30 +++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee5ca99..426e500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security +## [0.10.2] +### Added +- Experimental automatic JS project bundling in MPP + +### Changed + +### Deprecated + +### Removed + +### Fixed +-Release task (#19) + +### Security + ## [0.10.0] ### Added - Lazy readme properties diff --git a/README.md b/README.md index d313dda..0a5f396 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,6 @@ A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform c ## ru.mipt.npm.gradle.project Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool. -## ru.mipt.npm.gradle.publish -Enables publishing to maven-central, bintray, Space and github. - ## ru.mipt.npm.gradle.mpp `= kotlin("multiplatform") + ru.mipt.npm.gradle.common` diff --git a/build.gradle.kts b/build.gradle.kts index bb08d99..8aa1a85 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "ru.mipt.npm" -version = "0.10.1" +version = "0.10.2" description = "Build tools for DataForge and kscience projects" 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 9b8b60e..07b01e8 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/internal/common.kt @@ -2,9 +2,13 @@ package ru.mipt.npm.gradle.internal import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.artifacts.dsl.RepositoryHandler +import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.tasks.Copy import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.getByName import org.gradle.kotlin.dsl.maven +import org.gradle.language.jvm.tasks.ProcessResources +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder internal fun LanguageSettingsBuilder.applySettings(): Unit { @@ -47,6 +51,32 @@ internal fun Copy.fromJsDependencies(configurationName: String) = project.run { } +fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){ + js { + binaries.executable() + browser { + webpackTask { + outputFileName = bundleName + } + } + } + + jvm { + val processResourcesTaskName = + compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME] + .processResourcesTaskName + + val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution") + + project.tasks.getByName(processResourcesTaskName) { + duplicatesStrategy = DuplicatesStrategy.WARN + dependsOn(jsBrowserDistribution) + from(jsBrowserDistribution) + } + } + +} + // //internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate { // val projectDeps = configuration.allDependencies -- 2.34.1