Dev #5
@ -10,14 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Changelog plugin automatically applied to `project`.
|
||||
- Feature matrix and Readme generation task for a `project` plugin.
|
||||
- Add `binary-compatibility-validator` to the `project` plugin.
|
||||
- Separate `yamlKt` serialization target
|
||||
- Separate `ain` plugin
|
||||
|
||||
### Changed
|
||||
- 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.
|
||||
- Platform plugins are now simple references to common plugin
|
||||
|
||||
### Deprecated
|
||||
- Support of `kaml` and `snake-yaml` in favor of `yamlKt`
|
||||
|
||||
### Removed
|
||||
- Node plugin.
|
||||
|
@ -6,7 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
version = "0.6.4-dev-1.4.20-M2"
|
||||
version = "0.7.0"
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
@ -16,7 +16,7 @@ repositories {
|
||||
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||
}
|
||||
|
||||
val kotlinVersion = "1.4.20-M2"
|
||||
val kotlinVersion = "1.4.20"
|
||||
|
||||
java {
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
@ -27,14 +27,19 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.4")
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.10")
|
||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2")
|
||||
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")
|
||||
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:0.6.2")
|
||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("kscience.common"){
|
||||
id = "ru.mipt.npm.kscience"
|
||||
description = "The generalized kscience plugin that works in conjunction with any kotlin plugin"
|
||||
implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin"
|
||||
}
|
||||
create("kscience.project"){
|
||||
id = "ru.mipt.npm.project"
|
||||
description = "The root plugin for multimodule project infrastructure"
|
||||
|
138
src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt
Normal file
138
src/main/kotlin/ru/mipt/npm/gradle/KScienceCommonPlugin.kt
Normal file
@ -0,0 +1,138 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
|
||||
open class KScienceCommonPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
//Common configuration
|
||||
registerKScienceExtension()
|
||||
repositories.applyRepos()
|
||||
|
||||
//Configuration for K-JVM plugin
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
sourceSets["main"].apply {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-junit5"))
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||
configure<KotlinJsProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets["main"].apply {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
// useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets.invoke {
|
||||
val commonMain by getting
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-junit5"))
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||
}
|
||||
}
|
||||
val jsMain by getting
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
targets.all {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
extensions.findByType<JavaPluginExtension>()?.apply {
|
||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||
withSourcesJar()
|
||||
//withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
withType<KotlinJvmCompile> {
|
||||
kotlinOptions {
|
||||
// useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
}
|
||||
}
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
(findByName("processResources") as? Copy)?.apply {
|
||||
fromDependencies("runtimeClasspath")
|
||||
}
|
||||
|
||||
(findByName("jsProcessResources") as? Copy)?.apply {
|
||||
fromDependencies("jsRuntimeClasspath")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,48 +2,15 @@ package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.getValue
|
||||
import org.gradle.kotlin.dsl.getting
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
|
||||
open class KScienceJSPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
plugins.apply("org.jetbrains.kotlin.js")
|
||||
registerKScienceExtension()
|
||||
|
||||
repositories.applyRepos()
|
||||
|
||||
configure<KotlinJsProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
js(IR) {
|
||||
browser()
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.js") == null) {
|
||||
pluginManager.apply("org.jetbrains.kotlin.js")
|
||||
} else {
|
||||
logger.info("Kotlin JS plugin is already present")
|
||||
}
|
||||
|
||||
sourceSets["main"].apply {
|
||||
languageSettings.applySettings()
|
||||
|
||||
dependencies {
|
||||
api(kotlin("stdlib-js"))
|
||||
plugins.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
val processResources by getting(Copy::class) {
|
||||
fromDependencies("runtimeClasspath")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -2,58 +2,16 @@ package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.findByType
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
|
||||
open class KScienceJVMPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||
registerKScienceExtension()
|
||||
|
||||
repositories.applyRepos()
|
||||
|
||||
extensions.findByType<JavaPluginExtension>()?.apply {
|
||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||
withSourcesJar()
|
||||
//withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
// useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
}
|
||||
}
|
||||
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
explicitApiWarning()
|
||||
val sourceSet = sourceSets["main"].apply {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-junit5"))
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
withType<Test>() {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
//
|
||||
// val processResources by getting(Copy::class)
|
||||
// processResources.copyJVMResources(configurations["runtimeClasspath"])
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.jvm") == null) {
|
||||
pluginManager.apply("org.jetbrains.kotlin.jvm")
|
||||
} else {
|
||||
logger.info("Kotlin JVM plugin is already present")
|
||||
}
|
||||
plugins.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,99 +2,16 @@ package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.findPlugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
open class KScienceMPPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||
registerKScienceExtension()
|
||||
repositories.applyRepos()
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
// useIR = true
|
||||
jvmTarget = KScienceVersions.JVM_TARGET.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets.invoke {
|
||||
val commonMain by getting
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-junit5"))
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||
}
|
||||
}
|
||||
val jsMain by getting
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
targets.all {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pluginManager.withPlugin("org.jetbrains.dokka") {
|
||||
// logger.info("Adding dokka functionality to project ${this@run.name}")
|
||||
//
|
||||
// val dokkaHtml by tasks.getting(DokkaTask::class) {
|
||||
// dokkaSourceSets {
|
||||
// register("commonMain") {
|
||||
// displayName = "common"
|
||||
// platform = "common"
|
||||
// }
|
||||
// register("jvmMain") {
|
||||
// displayName = "jvm"
|
||||
// platform = "jvm"
|
||||
// }
|
||||
// register("jsMain") {
|
||||
// displayName = "js"
|
||||
// platform = "js"
|
||||
// }
|
||||
// configureEach {
|
||||
// jdkVersion = 11
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
tasks.apply {
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
val jsProcessResources by getting(Copy::class) {
|
||||
fromDependencies("jsRuntimeClasspath")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
}
|
||||
plugins.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,18 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
class KScienceNativePlugin : 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)
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
}
|
||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
|
@ -4,6 +4,7 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||
|
||||
/**
|
||||
* Create a separate target for node
|
||||
@ -11,9 +12,13 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
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)
|
||||
if (plugins.findPlugin(KotlinMultiplatformPlugin::class) == null) {
|
||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KotlinMultiplatformPlugin::class)
|
||||
}
|
||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KScienceCommonPlugin::class)
|
||||
}
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
|
@ -6,17 +6,19 @@ import org.gradle.api.JavaVersion
|
||||
* Build constants
|
||||
*/
|
||||
object KScienceVersions {
|
||||
const val kotlinVersion = "1.4.20-M2"
|
||||
const val kotlinVersion = "1.4.20"
|
||||
const val kotlinxNodeVersion = "0.0.7"
|
||||
const val coroutinesVersion = "1.3.9"
|
||||
const val serializationVersion = "1.0.0"
|
||||
const val coroutinesVersion = "1.4.1"
|
||||
const val serializationVersion = "1.0.1"
|
||||
const val atomicVersion = "0.14.4"
|
||||
|
||||
val JVM_TARGET = JavaVersion.VERSION_11
|
||||
|
||||
object Serialization{
|
||||
const val xmlVersion = "0.80.1"
|
||||
@Deprecated("Use yamlKt instead")
|
||||
const val yamlVersion = "0.21.0"
|
||||
const val bsonVersion = "0.4.2"
|
||||
const val yamlKtVersion = "0.7.4"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.maven
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
|
||||
class SerializationTargets(
|
||||
val sourceSet: DependencySourceSet,
|
||||
@ -40,6 +42,9 @@ class SerializationTargets(
|
||||
fun Project.xml(
|
||||
version: String = KScienceVersions.Serialization.xmlVersion
|
||||
) {
|
||||
repositories {
|
||||
maven("https://dl.bintray.com/pdvrieze/maven")
|
||||
}
|
||||
useCommonDependency(
|
||||
"net.devrieze:xmlutil-serialization:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
@ -47,6 +52,7 @@ class SerializationTargets(
|
||||
)
|
||||
}
|
||||
|
||||
@Deprecated("Use multiplatform yamlKt instead")
|
||||
fun Project.yaml(
|
||||
version: String = KScienceVersions.Serialization.yamlVersion
|
||||
) {
|
||||
@ -57,6 +63,16 @@ class SerializationTargets(
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.yamlKt(
|
||||
version: String = KScienceVersions.Serialization.yamlVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
"net.mamoe.yamlkt:yamlkt:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.bson(
|
||||
version: String = KScienceVersions.Serialization.bsonVersion
|
||||
) {
|
@ -15,6 +15,7 @@ internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
||||
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
|
||||
useExperimentalAnnotation("kotlin.time.ExperimentalTime")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlin.js.ExperimentalJsExport")
|
||||
}
|
||||
|
||||
internal fun RepositoryHandler.applyRepos(): Unit {
|
||||
|
Loading…
Reference in New Issue
Block a user