0.10.2 #20

Merged
altavir merged 6 commits from dev into master 2021-07-21 13:15:48 +03:00
7 changed files with 88 additions and 37 deletions

View File

@ -17,6 +17,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
### Security ### Security
## [0.10.2]
### Added
- Experimental automatic JS project bundling in MPP
### Changed
### Deprecated
### Removed
### Fixed
-Release task (#19)
### Security
## [0.10.0] ## [0.10.0]
### Added ### Added
- Lazy readme properties - Lazy readme properties

View File

@ -8,9 +8,6 @@ A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform c
## ru.mipt.npm.gradle.project ## ru.mipt.npm.gradle.project
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool. 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 ## ru.mipt.npm.gradle.mpp
`= kotlin("multiplatform") + ru.mipt.npm.gradle.common` `= kotlin("multiplatform") + ru.mipt.npm.gradle.common`

View File

@ -3,17 +3,17 @@ plugins {
`kotlin-dsl` `kotlin-dsl`
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.changelog") version "1.1.2" id("org.jetbrains.changelog") version "1.2.0"
id("org.jetbrains.dokka") version "1.4.32" id("org.jetbrains.dokka") version "1.5.0"
} }
group = "ru.mipt.npm" group = "ru.mipt.npm"
version = "0.10.0" version = "0.10.2"
description = "Build tools for DataForge and kscience projects" description = "Build tools for DataForge and kscience projects"
changelog{ changelog{
version = project.version.toString() setVersion(project.version.toString())
} }
repositories { repositories {
@ -22,7 +22,7 @@ repositories {
maven("https://repo.kotlin.link") maven("https://repo.kotlin.link")
} }
val kotlinVersion = "1.5.10" val kotlinVersion = "1.5.21"
java { java {
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
@ -30,11 +30,11 @@ java {
dependencies { dependencies {
api("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") 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.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1") implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.2")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.5.0")
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2") implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.2.0")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.6.0")
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -5,6 +5,7 @@ import kotlinx.validation.ApiValidationExtension
import kotlinx.validation.BinaryCompatibilityValidatorPlugin import kotlinx.validation.BinaryCompatibilityValidatorPlugin
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.kotlin.dsl.* import org.gradle.kotlin.dsl.*
import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.changelog.ChangelogPluginExtension import org.jetbrains.changelog.ChangelogPluginExtension
@ -13,6 +14,8 @@ import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.dokka.gradle.DokkaTask
import ru.mipt.npm.gradle.internal.* import ru.mipt.npm.gradle.internal.*
private fun Project.allTasks(): Set<Task> = allprojects.flatMapTo(HashSet()) { it.tasks }
@Suppress("unused") @Suppress("unused")
class KSciencePublishingExtension(val project: Project) { class KSciencePublishingExtension(val project: Project) {
private var initializedFlag = false private var initializedFlag = false
@ -33,10 +36,14 @@ class KSciencePublishingExtension(val project: Project) {
if (!initializedFlag) { if (!initializedFlag) {
vcs("https://github.com/$githubOrg/$githubProject") vcs("https://github.com/$githubOrg/$githubProject")
} }
project.addGithubPublishing(githubOrg, githubProject) project.addGithubPublishing(githubOrg, githubProject)
if (publish) { if (publish)
project.tasks.findByName("publish${project.publicationTarget}ToGithubRepository")?.let {publicationTask-> project.afterEvaluate {
allTasks()
.find { it.name == "publish${publicationTarget}ToGithubRepository" }
?.let { publicationTask ->
releaseTask?.dependsOn(publicationTask) releaseTask?.dependsOn(publicationTask)
} }
} }
@ -52,10 +59,12 @@ class KSciencePublishingExtension(val project: Project) {
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", publish: Boolean = false) { 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" } require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
project.addSpacePublishing(spaceRepo) project.addSpacePublishing(spaceRepo)
if (publish) {
project.tasks.findByName("publish${project.publicationTarget}ToSpaceRepository")?.let { publicationTask -> if (publish)
releaseTask?.dependsOn(publicationTask) project.afterEvaluate {
} allTasks()
.find { it.name == "publish${publicationTarget}ToSpaceRepository" }
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
} }
} }
@ -71,16 +80,16 @@ class KSciencePublishingExtension(val project: Project) {
fun sonatype(publish: Boolean = true) { fun sonatype(publish: Boolean = true) {
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
project.addSonatypePublishing() project.addSonatypePublishing()
if (publish) {
project.tasks.findByName("publish${project.publicationTarget}ToSonatypeRepository") if (publish)
?.let { publicationTask -> project.afterEvaluate {
releaseTask?.dependsOn(publicationTask) allTasks()
} .find { it.name == "publish${publicationTarget}ToSonatypeRepository" }
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
} }
} }
} }
/** /**
* Apply extension and repositories * Apply extension and repositories
*/ */
@ -98,7 +107,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
} }
} else { } else {
configure<ChangelogPluginExtension> { configure<ChangelogPluginExtension> {
version = project.version.toString() version.set(project.version.toString())
} }
} }
} }

View File

@ -6,20 +6,20 @@ import org.gradle.api.JavaVersion
* Build constants * Build constants
*/ */
object KScienceVersions { object KScienceVersions {
const val kotlinVersion = "1.5.10" const val kotlinVersion = "1.5.21"
const val kotlinxNodeVersion = "0.0.7" 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 serializationVersion = "1.2.2"
const val atomicVersion = "0.16.1" const val atomicVersion = "0.16.2"
const val ktorVersion = "1.6.0" const val ktorVersion = "1.6.1"
const val htmlVersion = "0.7.3" const val htmlVersion = "0.7.3"
const val dateTimeVersion = "0.2.1" 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 val JVM_TARGET = JavaVersion.VERSION_11
object Serialization{ object Serialization{
const val xmlVersion = "0.82.0" const val xmlVersion = "0.82.0"
const val yamlKtVersion = "0.9.0" const val yamlKtVersion = "0.10.0"
} }
} }

View File

@ -2,9 +2,13 @@ package ru.mipt.npm.gradle.internal
import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.Copy import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.maven 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 import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
internal fun LanguageSettingsBuilder.applySettings(): Unit { 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<ProcessResources>(processResourcesTaskName) {
duplicatesStrategy = DuplicatesStrategy.WARN
dependsOn(jsBrowserDistribution)
from(jsBrowserDistribution)
}
}
}
// //
//internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate { //internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate {
// val projectDeps = configuration.allDependencies // val projectDeps = configuration.allDependencies