Dev #5

Merged
altavir merged 24 commits from dev into master 2020-12-28 09:44:15 +03:00
8 changed files with 71 additions and 14 deletions
Showing only changes of commit 774596bbf6 - Show all commits

View File

@ -7,19 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- Changelog plugin automatically applied to `project` - Changelog plugin automatically applied to `project`.
- Feature matrix and Readme generation task for a `project` plugin - Feature matrix and Readme generation task for a `project` plugin.
- Add `binary-compatibility-validator` to the `project` plugin.
### Changed ### Changed
- Remove node plugin and make node binaries available by default - Remove node plugin. Node binaries should be turned on manually.
- Use default webpack distribution path - Use default webpack distribution path.
- `ru.mipt.npm.base` -> `ru.mipt.npm.project` - `ru.mipt.npm.base` -> `ru.mipt.npm.project`.
- Move publishing out of general extension and apply it to project plugin instead. - Move publishing out of general extension and apply it to project plugin instead.
### Deprecated ### Deprecated
### Removed ### Removed
- Node plugin - Node plugin.
### Fixed ### Fixed
@ -28,14 +29,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Migrate to kotlin 1.4.0 - Migrate to kotlin 1.4.0
- Separate Native (current platform) and nodeJs plugins - Separate Native (current platform) and nodeJs plugins.
- Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm. - Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm.
- Add `publish` to expose publishing configuration - Add `publish` to expose publishing configuration.
### Changed ### Changed
-Publishing in bintray now is automatic -Publishing in bintray now is automatic.
## [0.5.2] ## [0.5.2]
### Added ### Added
- Copy resources for jvm modules and jvm source sets in mpp - Copy resources for jvm modules and jvm source sets in mpp.

View File

@ -30,6 +30,7 @@ dependencies {
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.10") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.10")
implementation("org.jetbrains.dokka:dokka-base:1.4.10") implementation("org.jetbrains.dokka:dokka-base:1.4.10")
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:0.5.0") implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:0.5.0")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.2.3")
} }
gradlePlugin { gradlePlugin {
@ -68,6 +69,12 @@ gradlePlugin {
description = "Additional native targets to be use alongside mpp" description = "Additional native targets to be use alongside mpp"
implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin" implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin"
} }
create("kscience.node") {
id = "ru.mipt.npm.node"
description = "Additional nodejs target to be use alongside mpp"
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin"
}
} }
} }

View File

@ -1,6 +1,7 @@
package ru.mipt.npm.gradle package ru.mipt.npm.gradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.findByType
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
@ -70,14 +71,17 @@ class KScienceExtension(val project: Project) {
project.extensions.findByType<KotlinProjectExtension>()?.apply { project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null explicitApi = null
} }
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
project.plugins.apply("org.gradle.application") project.plugins.apply(ApplicationPlugin::class.java)
} }
project.extensions.findByType<KotlinJsProjectExtension>()?.apply { project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
js { js {
binaries.executable() binaries.executable()
} }
} }
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply { project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
js { js {
binaries.executable() binaries.executable()
@ -86,7 +90,6 @@ class KScienceExtension(val project: Project) {
binaries.executable() binaries.executable()
} }
} }
} }
} }

View File

@ -18,10 +18,11 @@ open class KScienceJSPlugin : Plugin<Project> {
configure<KotlinJsProjectExtension> { configure<KotlinJsProjectExtension> {
explicitApiWarning() explicitApiWarning()
js(IR) { js(IR) {
browser() browser()
nodejs()
} }
sourceSets["main"].apply { sourceSets["main"].apply {
languageSettings.applySettings() languageSettings.applySettings()

View File

@ -27,7 +27,6 @@ open class KScienceMPPlugin : Plugin<Project> {
js(IR) { js(IR) {
browser() browser()
nodejs()
} }
sourceSets.invoke { sourceSets.invoke {

View File

@ -0,0 +1,42 @@
package ru.mipt.npm.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
/**
* Create a separate target for node
*/
class KScienceNodePlugin : Plugin<Project> {
override fun apply(target: Project) = target.run {
//Apply multiplatform plugin is not applied, apply it
if (plugins.findPlugin(KScienceMPPlugin::class) == null) {
logger.info("Multiplatform KScience plugin is not resolved. Adding it automatically")
pluginManager.apply(KScienceMPPlugin::class)
}
configure<KotlinMultiplatformExtension> {
js(name = "node", compiler = IR) {
nodejs()
}
sourceSets {
val commonMain by getting
val nodeMain by creating {
dependsOn(commonMain)
dependencies{
api("org.jetbrains.kotlinx:kotlinx-nodejs:${KScienceVersions.kotlinxNodeVersion}")
}
}
val commonTest by getting
val nodeTest by creating {
dependsOn(nodeMain)
dependsOn(commonTest)
}
}
}
}
}

View File

@ -1,6 +1,7 @@
package ru.mipt.npm.gradle package ru.mipt.npm.gradle
import groovy.text.SimpleTemplateEngine import groovy.text.SimpleTemplateEngine
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.kotlin.dsl.* import org.gradle.kotlin.dsl.*
@ -101,6 +102,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = target.run { override fun apply(target: Project): Unit = target.run {
apply<ChangelogPlugin>() apply<ChangelogPlugin>()
apply<DokkaPlugin>() apply<DokkaPlugin>()
apply<BinaryCompatibilityValidatorPlugin>()
val rootReadmeExtension = KScienceReadmeExtension(this) val rootReadmeExtension = KScienceReadmeExtension(this)
extensions.add("ksciencePublish", KSciencePublishingExtension(this)) extensions.add("ksciencePublish", KSciencePublishingExtension(this))
extensions.add("readme", rootReadmeExtension) extensions.add("readme", rootReadmeExtension)

View File

@ -7,6 +7,7 @@ import org.gradle.api.JavaVersion
*/ */
object KScienceVersions { object KScienceVersions {
const val kotlinVersion = "1.4.20-M1" const val kotlinVersion = "1.4.20-M1"
const val kotlinxNodeVersion = "0.0.7"
const val coroutinesVersion = "1.3.9" const val coroutinesVersion = "1.3.9"
const val serializationVersion = "1.0.0-RC2" const val serializationVersion = "1.0.0-RC2"
const val atomicVersion = "0.14.4" const val atomicVersion = "0.14.4"