Remove node to a separate plugin

This commit is contained in:
Alexander Nozik 2020-09-30 20:43:02 +03:00
parent 96bfd55219
commit 774596bbf6
8 changed files with 71 additions and 14 deletions

View File

@ -7,19 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Changelog plugin automatically applied to `project`
- Feature matrix and Readme generation task for a `project` plugin
- Changelog plugin automatically applied to `project`.
- Feature matrix and Readme generation task for a `project` plugin.
- Add `binary-compatibility-validator` to the `project` plugin.
### Changed
- Remove node plugin and make node binaries available by default
- Use default webpack distribution path
- `ru.mipt.npm.base` -> `ru.mipt.npm.project`
- Remove node plugin. Node binaries should be turned on manually.
- Use default webpack distribution path.
- `ru.mipt.npm.base` -> `ru.mipt.npm.project`.
- Move publishing out of general extension and apply it to project plugin instead.
### Deprecated
### Removed
- Node plugin
- Node plugin.
### Fixed
@ -28,14 +29,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- 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 `publish` to expose publishing configuration
- Add `publish` to expose publishing configuration.
### Changed
-Publishing in bintray now is automatic
-Publishing in bintray now is automatic.
## [0.5.2]
### 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-base:1.4.10")
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:0.5.0")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.2.3")
}
gradlePlugin {
@ -68,6 +69,12 @@ gradlePlugin {
description = "Additional native targets to be use alongside mpp"
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
import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.kotlin.dsl.findByType
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
@ -70,14 +71,17 @@ class KScienceExtension(val project: Project) {
project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
project.plugins.apply("org.gradle.application")
project.plugins.apply(ApplicationPlugin::class.java)
}
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
js {
binaries.executable()
}
}
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
js {
binaries.executable()
@ -86,7 +90,6 @@ class KScienceExtension(val project: Project) {
binaries.executable()
}
}
}
}

View File

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

View File

@ -27,7 +27,6 @@ open class KScienceMPPlugin : Plugin<Project> {
js(IR) {
browser()
nodejs()
}
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
import groovy.text.SimpleTemplateEngine
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
@ -101,6 +102,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = target.run {
apply<ChangelogPlugin>()
apply<DokkaPlugin>()
apply<BinaryCompatibilityValidatorPlugin>()
val rootReadmeExtension = KScienceReadmeExtension(this)
extensions.add("ksciencePublish", KSciencePublishingExtension(this))
extensions.add("readme", rootReadmeExtension)

View File

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