Merge pull request #30 from mipt-npm/dev
Dev
This commit is contained in:
commit
a915d2256d
61
CHANGELOG.md
61
CHANGELOG.md
@ -17,105 +17,111 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
## [0.10.2]
|
|
||||||
|
## [0.10.4]
|
||||||
### Added
|
### Added
|
||||||
- Experimental automatic JS project bundling in MPP
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Kotlin 1.6
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
-Release task (#19)
|
- Some issues with opt-ins
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
## [0.10.2]
|
||||||
|
### Added
|
||||||
|
- Experimental automatic JS project bundling in MPP
|
||||||
|
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Remove vcs requirement for Space publication
|
||||||
|
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
-Release task (#19)
|
||||||
|
|
||||||
## [0.10.0]
|
## [0.10.0]
|
||||||
### Added
|
### Added
|
||||||
- Lazy readme properties
|
- Lazy readme properties
|
||||||
- BOM for kotlin-wrappers on JS
|
- BOM for kotlin-wrappers on JS
|
||||||
- Jupyter loader
|
- Jupyter loader
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- API validation disabled for dev versions
|
- API validation disabled for dev versions
|
||||||
- Kotlin plugins are propagated downstream
|
- Kotlin plugins are propagated downstream
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- bson support
|
- bson support
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [0.9.5]
|
## [0.9.5]
|
||||||
### Added
|
### Added
|
||||||
- Disable API validation for snapshots
|
- Disable API validation for snapshots
|
||||||
- `-Xjvm-default=all` on JVM
|
- `-Xjvm-default=all` on JVM
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- `publication.platform` changed to `publishing.platform`
|
- `publication.platform` changed to `publishing.platform`
|
||||||
- Dokka version to `1.4.30`
|
- Dokka version to `1.4.30`
|
||||||
- `useDateTime` in extension
|
- `useDateTime` in extension
|
||||||
- Kotlin 1.5
|
- Kotlin 1.5
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Publish plugin. Use MavenPublish instead
|
- Publish plugin. Use MavenPublish instead
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
|
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [0.9.0]
|
## [0.9.0]
|
||||||
### Added
|
### Added
|
||||||
- Skip sonatype publishing for dev versions
|
- Skip sonatype publishing for dev versions
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Publishing repositories are explicit and defined in the top level project
|
- Publishing repositories are explicit and defined in the top level project
|
||||||
- Paths to publishing properties now use dot notation like `publishing.github.user`
|
- Paths to publishing properties now use dot notation like `publishing.github.user`
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
- Publishing plugin
|
- Publishing plugin
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Bintray publishing
|
- Bintray publishing
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [0.8.4]
|
## [0.8.4]
|
||||||
### Added
|
### Added
|
||||||
- Adaptive support for host OS in native
|
- Adaptive support for host OS in native
|
||||||
- CSS support for JS targets
|
- CSS support for JS targets
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Kotlin 1.4.31
|
- Kotlin 1.4.31
|
||||||
- Coroutines 1.4.3
|
- Coroutines 1.4.3
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Plugin loading order for publishing
|
- Plugin loading order for publishing
|
||||||
- Release task
|
- Release task
|
||||||
- Readme generation for multi-module project
|
- Readme generation for multi-module project
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [0.8.1]
|
## [0.8.1]
|
||||||
### Added
|
### Added
|
||||||
- Ktor version to versions
|
- Ktor version to versions
|
||||||
- Add sonatype publishing
|
- Add sonatype publishing
|
||||||
- Per-platform release publishing
|
- Per-platform release publishing
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Kotlin to 1.4.30 stable.
|
- Kotlin to 1.4.30 stable.
|
||||||
- Added intermediate jsCommon main/test sourcesSet for node plugin.
|
- Added intermediate jsCommon main/test sourcesSet for node plugin.
|
||||||
@ -123,19 +129,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Common plugin id changed to `common`
|
- Common plugin id changed to `common`
|
||||||
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix
|
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- kaml
|
- kaml
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix publishing load order for sonatype
|
- Fix publishing load order for sonatype
|
||||||
- Fix root project readme
|
- Fix root project readme
|
||||||
|
|
||||||
### Security
|
|
||||||
|
|
||||||
## [0.7.4]
|
## [0.7.4]
|
||||||
|
|
||||||
### 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.
|
||||||
@ -144,6 +147,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Moved all logic to a common plugin, leaving only proxies for platform plugins
|
- Moved all logic to a common plugin, leaving only proxies for platform plugins
|
||||||
- Suppress API validation for modules with maturity below DEVELOPMENT
|
- Suppress API validation for modules with maturity below DEVELOPMENT
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Remove node plugin. Node binaries should be turned on manually.
|
- Remove node plugin. Node binaries should be turned on manually.
|
||||||
- Use default webpack distribution path.
|
- Use default webpack distribution path.
|
||||||
@ -154,29 +158,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Moved internals to internals
|
- Moved internals to internals
|
||||||
- Kotlin 1.4.30-RC
|
- Kotlin 1.4.30-RC
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
- Support of `kaml` and `snake-yaml` in favor of `yamlKt`
|
- Support of `kaml` and `snake-yaml` in favor of `yamlKt`
|
||||||
- Publish plugin
|
- Publish plugin
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- `useDokka` method. Documentation jar should be added manually if needed.
|
- `useDokka` method. Documentation jar should be added manually if needed.
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
### Security
|
|
||||||
## [0.6.0]
|
## [0.6.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.
|
@ -1,14 +1,15 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
alias(libs.plugins.changelog)
|
||||||
|
alias(libs.plugins.dokka)
|
||||||
`java-gradle-plugin`
|
`java-gradle-plugin`
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
alias(libs.plugins.changelog)
|
`version-catalog`
|
||||||
alias(libs.plugins.dokka)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.mipt.npm"
|
group = "ru.mipt.npm"
|
||||||
version = "0.10.2"
|
version = libs.versions.tools.get()
|
||||||
|
|
||||||
description = "Build tools for DataForge and kscience projects"
|
description = "Build tools for DataForge and kscience projects"
|
||||||
|
|
||||||
@ -22,6 +23,8 @@ repositories {
|
|||||||
|
|
||||||
java.targetCompatibility = JavaVersion.VERSION_11
|
java.targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
kotlin.explicitApiWarning()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.kotlin.gradle)
|
api(libs.kotlin.gradle)
|
||||||
implementation(libs.atomicfu.gradle)
|
implementation(libs.atomicfu.gradle)
|
||||||
@ -30,8 +33,19 @@ dependencies {
|
|||||||
implementation(libs.dokka.gradle)
|
implementation(libs.dokka.gradle)
|
||||||
implementation(libs.kotlin.jupyter.gradle)
|
implementation(libs.kotlin.jupyter.gradle)
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
|
implementation("org.tomlj:tomlj:1.0.0")
|
||||||
|
// // nexus publishing plugin
|
||||||
|
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
|
||||||
|
|
||||||
|
testImplementation(kotlin("test"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
//declaring exported plugins
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
plugins {
|
plugins {
|
||||||
create("common") {
|
create("common") {
|
||||||
@ -78,29 +92,45 @@ gradlePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//publishing version catalog
|
||||||
|
|
||||||
|
catalog.versionCatalog {
|
||||||
|
from(files("gradle/libs.versions.toml"))
|
||||||
|
}
|
||||||
|
|
||||||
|
//publishing the artifact
|
||||||
|
|
||||||
|
val sourcesJar by tasks.creating(Jar::class) {
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
from(sourceSets.named("main").get().allSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
val javadocsJar by tasks.creating(Jar::class) {
|
||||||
|
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
from(tasks.dokkaHtml)
|
||||||
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
publishing {
|
publishing {
|
||||||
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
||||||
|
|
||||||
val sourcesJar by tasks.creating(Jar::class) {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
from(sourceSets.named("main").get().allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
val javadocsJar by tasks.creating(Jar::class) {
|
|
||||||
group = "documentation"
|
|
||||||
archiveClassifier.set("javadoc")
|
|
||||||
from(tasks.dokkaHtml)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
publications {
|
||||||
publication.apply {
|
create<MavenPublication>("catalog") {
|
||||||
|
from(components["versionCatalog"])
|
||||||
|
this.artifactId = "version-catalog"
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name.set("version-catalog")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<MavenPublication> {
|
||||||
artifact(sourcesJar)
|
artifact(sourcesJar)
|
||||||
artifact(javadocsJar)
|
artifact(javadocsJar)
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
name.set(project.name)
|
|
||||||
description.set(project.description)
|
description.set(project.description)
|
||||||
url.set(vcs)
|
url.set(vcs)
|
||||||
|
|
||||||
@ -157,10 +187,6 @@ afterEvaluate {
|
|||||||
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugins.findPlugin("signing") == null) {
|
|
||||||
plugins.apply("signing")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri(sonatypeRepo)
|
url = uri(sonatypeRepo)
|
||||||
@ -171,6 +197,10 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plugins.findPlugin("signing") == null) {
|
||||||
|
apply<SigningPlugin>()
|
||||||
|
}
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
//useGpgCmd()
|
//useGpgCmd()
|
||||||
sign(publications)
|
sign(publications)
|
||||||
@ -178,3 +208,8 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.processResources.configure {
|
||||||
|
duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.INCLUDE
|
||||||
|
from("gradle/libs.versions.toml")
|
||||||
|
}
|
@ -1,26 +1,167 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
tools = "0.10.4"
|
||||||
|
kotlin = "1.6.0-M1"
|
||||||
atomicfu = "0.16.2"
|
atomicfu = "0.16.2"
|
||||||
binary-compatibility-validator = "0.6.0"
|
binary-compatibility-validator = "0.7.1"
|
||||||
changelog = "1.2.1"
|
changelog = "1.3.0"
|
||||||
dokka = "1.5.0"
|
dokka = "1.5.0"
|
||||||
kotlin = "1.5.21"
|
kotlin-jupyter = "0.10.0-227"
|
||||||
kotlin-jupyter = "0.10.0-173"
|
kotlinx-benchmark = "0.3.1"
|
||||||
|
kotlinx-cli = "0.3.2"
|
||||||
|
kotlinx-collections-immutable = "0.3.4"
|
||||||
|
kotlinx-coroutines = "1.5.2"
|
||||||
|
kotlinx-datetime = "0.2.1"
|
||||||
|
kotlinx-html = "0.7.3"
|
||||||
|
kotlinx-knit = "0.2.3"
|
||||||
|
kotlinx-nodejs = "0.0.7"
|
||||||
|
kotlinx-serialization = "1.3.0"
|
||||||
|
ktor = "1.6.3"
|
||||||
|
xmlutil = "0.83.0"
|
||||||
|
yamlkt = "0.10.2"
|
||||||
|
jsBom = "0.0.1-pre.248-kotlin-1.5.31"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
|
||||||
|
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
|
||||||
|
|
||||||
|
binary-compatibility-validator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
|
||||||
|
|
||||||
changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
|
changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
|
||||||
|
|
||||||
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
||||||
|
|
||||||
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||||
|
|
||||||
[kotlin-jupyter-gradle]
|
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
|
||||||
module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin"
|
|
||||||
version.ref = "kotlin-jupyter"
|
|
||||||
|
|
||||||
[libraries.binary-compatibility-validator]
|
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
|
||||||
module = "org.jetbrains.kotlinx:binary-compatibility-validator"
|
|
||||||
version.ref = "binary-compatibility-validator"
|
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" }
|
||||||
|
|
||||||
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-reactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-javafx = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-javafx", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-slf4j = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" }
|
||||||
|
|
||||||
|
kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" }
|
||||||
|
|
||||||
|
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
|
||||||
|
|
||||||
|
kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" }
|
||||||
|
|
||||||
|
kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "kotlinx-knit" }
|
||||||
|
|
||||||
|
kotlinx-nodejs = { module = "org.jetbrains.kotlinx:kotlinx-nodejs", version.ref = "kotlinx-nodejs" }
|
||||||
|
|
||||||
|
kotlinx-serialization-cbor = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cbor", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serialization-hocon", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
|
||||||
|
kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" }
|
||||||
|
|
||||||
|
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
|
||||||
|
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
|
||||||
|
ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" }
|
||||||
|
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
||||||
|
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||||
|
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
||||||
|
ktor-client-auth-basic = { module = "io.ktor:ktor-client-auth-basic", version.ref = "ktor" }
|
||||||
|
ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
|
||||||
|
ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" }
|
||||||
|
ktor-client-json = { module = "io.ktor:ktor-client-json", version.ref = "ktor" }
|
||||||
|
ktor-client-gson = { module = "io.ktor:ktor-client-gson", version.ref = "ktor" }
|
||||||
|
ktor-client-jackson = { module = "io.ktor:ktor-client-jackson", version.ref = "ktor" }
|
||||||
|
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
|
||||||
|
ktor-client-logging = { module = "io.ktor:ktor-client-loggin", version.ref = "ktor" }
|
||||||
|
ktor-client-tracing = { module = "io.ktor:ktor-client-tracing", version.ref = "ktor" }
|
||||||
|
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
|
||||||
|
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
|
||||||
|
ktor-client-jetty = { module = "io.ktor:ktor-client-jetty", version.ref = "ktor" }
|
||||||
|
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
|
||||||
|
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
|
||||||
|
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||||
|
ktor-auth-jwt = { module = "io.ktor:ktor-auth-jwt", version.ref = "ktor" }
|
||||||
|
ktor-auth-ldap = { module = "io.ktor:ktor-auth-ldap", version.ref = "ktor" }
|
||||||
|
ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" }
|
||||||
|
ktor-freemaker = { module = "io.ktor:ktor-freemaker", version.ref = "ktor" }
|
||||||
|
ktor-gson = { module = "io.ktor:ktor-gson", version.ref = "ktor" }
|
||||||
|
ktor-html-builder = { module = "io.ktor:ktor-html-builder", version.ref = "ktor" }
|
||||||
|
ktor-jackson = { module = "io.ktor:ktor-jackson", version.ref = "ktor" }
|
||||||
|
ktor-locations = { module = "io.ktor:ktor-locations", version.ref = "ktor" }
|
||||||
|
ktor-metrics-micrometer = { module = "io.ktor:ktor-metrics-micrometer", version.ref = "ktor" }
|
||||||
|
ktor-metrics = { module = "io.ktor:ktor-metrics", version.ref = "ktor" }
|
||||||
|
ktor-mustache = { module = "io.ktor:ktor-mustache", version.ref = "ktor" }
|
||||||
|
ktor-pebble = { module = "io.ktor:ktor-pebble", version.ref = "ktor" }
|
||||||
|
ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" }
|
||||||
|
ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" }
|
||||||
|
ktor-thymeleaf = { module = "io.ktor:ktor-thymeleaf", version.ref = "ktor" }
|
||||||
|
ktor-velocity = { module = "io.ktor:ktor-velocity", version.ref = "ktor" }
|
||||||
|
ktor-webjars = { module = "io.ktor:ktor-webjars", version.ref = "ktor" }
|
||||||
|
ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" }
|
||||||
|
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
|
||||||
|
ktor-http-cio = { module = "io.ktor:ktor-http-cio", version.ref = "ktor" }
|
||||||
|
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
|
||||||
|
ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" }
|
||||||
|
ktor-network-tls = { module = "io.ktor:ktor-network-tls", version.ref = "ktor" }
|
||||||
|
ktor-network-tls-certificates = { module = "io.ktor:ktor-network-tls-certificates", version.ref = "ktor" }
|
||||||
|
ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" }
|
||||||
|
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
|
||||||
|
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
|
||||||
|
ktor-server-jetty = { module = "io.ktor:ktor-server-jetty", version.ref = "ktor" }
|
||||||
|
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
|
||||||
|
ktor-server-servlet = { module = "io.ktor:ktor-server-servlet", version.ref = "ktor" }
|
||||||
|
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
|
||||||
|
ktor-server-tomcat = { module = "io.ktor:ktor-server-tomcat", version.ref = "ktor" }
|
||||||
|
ktor-test-dispatcher = { module = "io.ktor:ktor-test-dispatcher", version.ref = "ktor" }
|
||||||
|
ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" }
|
||||||
|
|
||||||
|
xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" }
|
||||||
|
xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" }
|
||||||
|
xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" }
|
||||||
|
|
||||||
|
yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||||
|
|
||||||
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
|
|
||||||
|
gradle-common = { id = "ru.mipt.npm.gradle.common", version.ref = "tools" }
|
||||||
|
gradle-project = { id = "ru.mipt.npm.gradle.project", version.ref = "tools" }
|
||||||
|
gradle-mpp = { id = "ru.mipt.npm.gradle.mpp", version.ref = "tools" }
|
||||||
|
gradle-jvm = { id = "ru.mipt.npm.gradle.jvm", version.ref = "tools" }
|
||||||
|
gradle-js = { id = "ru.mipt.npm.gradle.js", version.ref = "tools" }
|
||||||
|
gradle-native = { id = "ru.mipt.npm.gradle.native", version.ref = "tools" }
|
||||||
|
gradle-node = { id = "ru.mipt.npm.gradle.node", version.ref = "tools" }
|
||||||
|
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
|
||||||
|
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
||||||
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
|
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
|
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
|
||||||
|
|
||||||
|
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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.2-rc-2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
rootProject.name = "gradle-tools"
|
rootProject.name = "gradle-tools"
|
||||||
|
|
||||||
enableFeaturePreview("VERSION_CATALOGS")
|
enableFeaturePreview("VERSION_CATALOGS")
|
||||||
|
@ -6,6 +6,7 @@ import org.gradle.api.plugins.JavaPluginExtension
|
|||||||
import org.gradle.api.tasks.Copy
|
import org.gradle.api.tasks.Copy
|
||||||
import org.gradle.api.tasks.testing.Test
|
import org.gradle.api.tasks.testing.Test
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
@ -15,7 +16,7 @@ import ru.mipt.npm.gradle.internal.applySettings
|
|||||||
import ru.mipt.npm.gradle.internal.fromJsDependencies
|
import ru.mipt.npm.gradle.internal.fromJsDependencies
|
||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
@Suppress("UNUSED_VARIABLE")
|
||||||
open class KScienceCommonPlugin : Plugin<Project> {
|
public open class KScienceCommonPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
//Common configuration
|
//Common configuration
|
||||||
registerKScienceExtension()
|
registerKScienceExtension()
|
||||||
@ -27,12 +28,11 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
configure<KotlinJvmProjectExtension> {
|
configure<KotlinJvmProjectExtension> {
|
||||||
explicitApiWarning()
|
explicitApiWarning()
|
||||||
|
|
||||||
sourceSets["main"].apply {
|
sourceSets.all {
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
sourceSets["test"].apply {
|
||||||
languageSettings.applySettings()
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-junit5"))
|
implementation(kotlin("test-junit5"))
|
||||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||||
@ -50,10 +50,8 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.apply {
|
tasks.withType<Test> {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,15 +68,17 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["main"].apply {
|
sourceSets.all {
|
||||||
languageSettings.applySettings()
|
languageSettings.applySettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets["main"].apply {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["test"].apply {
|
sourceSets["test"].apply {
|
||||||
languageSettings.applySettings()
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-js"))
|
implementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.invoke {
|
sourceSets {
|
||||||
val commonMain by getting {
|
val commonMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||||
@ -128,7 +128,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
val jvmTest by getting {
|
val jvmTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-junit5"))
|
implementation(kotlin("test-junit5"))
|
||||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
implementation("org.junit.jupiter:junit-jupiter:5.7.2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsMain by getting
|
val jsMain by getting
|
||||||
@ -139,12 +139,8 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
sourceSets.all {
|
||||||
targets.all {
|
languageSettings.applySettings()
|
||||||
sourceSets.all {
|
|
||||||
languageSettings.applySettings()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(tasks.findByName("jsProcessResources") as? Copy)?.apply {
|
(tasks.findByName("jsProcessResources") as? Copy)?.apply {
|
||||||
@ -155,18 +151,15 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
|||||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.apply {
|
tasks.withType<Test> {
|
||||||
withType<Test> {
|
useJUnitPlatform()
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply dokka for all projects
|
// apply dokka for all projects
|
||||||
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
|
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
|
||||||
plugins.apply("org.jetbrains.dokka")
|
apply<DokkaPlugin>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
|
import kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.ApplicationPlugin
|
import org.gradle.api.plugins.ApplicationPlugin
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
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
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
|
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
|
||||||
import ru.mipt.npm.gradle.internal.defaultPlatform
|
import ru.mipt.npm.gradle.internal.defaultPlatform
|
||||||
import ru.mipt.npm.gradle.internal.useCommonDependency
|
import ru.mipt.npm.gradle.internal.useCommonDependency
|
||||||
import ru.mipt.npm.gradle.internal.useFx
|
import ru.mipt.npm.gradle.internal.useFx
|
||||||
|
|
||||||
enum class FXModule(val artifact: String, vararg val dependencies: FXModule) {
|
public enum class FXModule(public val artifact: String, public vararg val dependencies: FXModule) {
|
||||||
BASE("javafx-base"),
|
BASE("javafx-base"),
|
||||||
GRAPHICS("javafx-graphics", BASE),
|
GRAPHICS("javafx-graphics", BASE),
|
||||||
CONTROLS("javafx-controls", GRAPHICS, BASE),
|
CONTROLS("javafx-controls", GRAPHICS, BASE),
|
||||||
@ -21,30 +25,29 @@ enum class FXModule(val artifact: String, vararg val dependencies: FXModule) {
|
|||||||
WEB("javafx-web", CONTROLS, GRAPHICS, BASE)
|
WEB("javafx-web", CONTROLS, GRAPHICS, BASE)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class FXPlatform(val id: String) {
|
public enum class FXPlatform(public val id: String) {
|
||||||
WINDOWS("win"),
|
WINDOWS("win"),
|
||||||
LINUX("linux"),
|
LINUX("linux"),
|
||||||
MAC("mac")
|
MAC("mac")
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class DependencyConfiguration {
|
public enum class DependencyConfiguration {
|
||||||
API,
|
API,
|
||||||
IMPLEMENTATION,
|
IMPLEMENTATION,
|
||||||
COMPILE_ONLY
|
COMPILE_ONLY,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class DependencySourceSet(val setName: String, val suffix: String) {
|
public enum class DependencySourceSet(public val setName: String, public val suffix: String) {
|
||||||
MAIN("main", "Main"),
|
MAIN("main", "Main"),
|
||||||
TEST("test", "Test")
|
TEST("test", "Test")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class KScienceExtension(val project: Project) {
|
public class KScienceExtension(public val project: Project) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use coroutines-core with default version or [version]
|
* Use coroutines-core with default version or [version]
|
||||||
*/
|
*/
|
||||||
fun useCoroutines(
|
public fun useCoroutines(
|
||||||
version: String = KScienceVersions.coroutinesVersion,
|
version: String = KScienceVersions.coroutinesVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
@ -55,14 +58,14 @@ class KScienceExtension(val project: Project) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use kotlinx-atmicfu plugin and library
|
* Use kotlinx-atomicfu plugin and library
|
||||||
*/
|
*/
|
||||||
fun useAtomic(
|
public fun useAtomic(
|
||||||
version: String = KScienceVersions.atomicVersion,
|
version: String = KScienceVersions.atomicVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION,
|
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION,
|
||||||
): Unit = project.run {
|
): Unit = project.run {
|
||||||
plugins.apply("kotlinx-atomicfu")
|
apply<AtomicFUGradlePlugin>()
|
||||||
useCommonDependency(
|
useCommonDependency(
|
||||||
"org.jetbrains.kotlinx:atomicfu:$version",
|
"org.jetbrains.kotlinx:atomicfu:$version",
|
||||||
dependencySourceSet = sourceSet,
|
dependencySourceSet = sourceSet,
|
||||||
@ -73,7 +76,7 @@ class KScienceExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Use core serialization library and configure targets
|
* Use core serialization library and configure targets
|
||||||
*/
|
*/
|
||||||
fun useSerialization(
|
public fun useSerialization(
|
||||||
version: String = KScienceVersions.serializationVersion,
|
version: String = KScienceVersions.serializationVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
@ -90,23 +93,23 @@ class KScienceExtension(val project: Project) {
|
|||||||
dependencySourceSet = sourceSet,
|
dependencySourceSet = sourceSet,
|
||||||
dependencyConfiguration = configuration
|
dependencyConfiguration = configuration
|
||||||
)
|
)
|
||||||
SerializationTargets(sourceSet, configuration).apply(block)
|
SerializationTargets(sourceSet, configuration).block()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add platform-specific JavaFX dependencies with given list of [FXModule]s
|
* Add platform-specific JavaFX dependencies with given list of [FXModule]s
|
||||||
*/
|
*/
|
||||||
fun useFx(
|
public fun useFx(
|
||||||
vararg modules: FXModule,
|
vararg modules: FXModule,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
||||||
version: String = "11",
|
version: String = "11",
|
||||||
platform: FXPlatform = defaultPlatform,
|
platform: FXPlatform = defaultPlatform,
|
||||||
) = project.useFx(modules.toList(), configuration, version, platform)
|
): Unit = project.useFx(modules.toList(), configuration, version, platform)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add dependency on kotlinx-html library
|
* Add dependency on kotlinx-html library
|
||||||
*/
|
*/
|
||||||
fun useHtml(
|
public fun useHtml(
|
||||||
version: String = KScienceVersions.htmlVersion,
|
version: String = KScienceVersions.htmlVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
@ -119,35 +122,44 @@ class KScienceExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Use kotlinx-datetime library with default version or [version]
|
* Use kotlinx-datetime library with default version or [version]
|
||||||
*/
|
*/
|
||||||
fun useDateTime(
|
public fun useDateTime(
|
||||||
version: String = KScienceVersions.dateTimeVersion,
|
version: String = KScienceVersions.dateTimeVersion,
|
||||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||||
) {
|
): Unit = project.useCommonDependency(
|
||||||
project.useCommonDependency(
|
"org.jetbrains.kotlinx:kotlinx-datetime:$version",
|
||||||
"org.jetbrains.kotlinx:kotlinx-datetime:$version",
|
dependencySourceSet = sourceSet,
|
||||||
dependencySourceSet = sourceSet,
|
dependencyConfiguration = configuration
|
||||||
dependencyConfiguration = configuration
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply jupyter plugin
|
* Apply jupyter plugin
|
||||||
*/
|
*/
|
||||||
fun useJupyter() {
|
@Deprecated("Use jupyterLibrary")
|
||||||
|
public fun useJupyter() {
|
||||||
project.plugins.apply("org.jetbrains.kotlin.jupyter.api")
|
project.plugins.apply("org.jetbrains.kotlin.jupyter.api")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply jupyter plugin and add entry point for the jupyter library
|
||||||
|
*/
|
||||||
|
public fun jupyterLibrary(pluginClass: String, vararg additionalPluginClasses: String) {
|
||||||
|
project.plugins.apply("org.jetbrains.kotlin.jupyter.api")
|
||||||
|
project.tasks.named("processJupyterApiResources", JupyterApiResourcesTask::class.java) {
|
||||||
|
libraryProducers = listOf(pluginClass, *additionalPluginClasses)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark this module as an application module. JVM application should be enabled separately
|
* Mark this module as an application module. JVM application should be enabled separately
|
||||||
*/
|
*/
|
||||||
fun application() {
|
public fun application() {
|
||||||
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(ApplicationPlugin::class.java)
|
project.apply<ApplicationPlugin>()
|
||||||
}
|
}
|
||||||
|
|
||||||
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
|
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
|
||||||
@ -160,8 +172,9 @@ class KScienceExtension(val project: Project) {
|
|||||||
js {
|
js {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
targets.filterIsInstance<KotlinNativeTarget>().forEach {
|
|
||||||
it.binaries.executable()
|
targets.withType<KotlinNativeTarget> {
|
||||||
|
binaries.executable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,4 +184,4 @@ internal fun Project.registerKScienceExtension() {
|
|||||||
if (extensions.findByType<KScienceExtension>() == null) {
|
if (extensions.findByType<KScienceExtension>() == null) {
|
||||||
extensions.add("kscience", KScienceExtension(this))
|
extensions.add("kscience", KScienceExtension(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,14 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
|
||||||
open class KScienceJSPlugin : Plugin<Project> {
|
public open class KScienceJSPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.js") == null) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) {
|
||||||
pluginManager.apply("org.jetbrains.kotlin.js")
|
plugins.apply("org.jetbrains.kotlin.js")
|
||||||
} else {
|
} else {
|
||||||
logger.info("Kotlin JS plugin is already present")
|
logger.info("Kotlin JS plugin is already present")
|
||||||
}
|
}
|
||||||
plugins.apply(KScienceCommonPlugin::class)
|
|
||||||
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
|
||||||
open class KScienceJVMPlugin : Plugin<Project> {
|
public open class KScienceJVMPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.jvm") == null) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm"))
|
||||||
pluginManager.apply("org.jetbrains.kotlin.jvm")
|
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||||
} else {
|
else
|
||||||
logger.info("Kotlin JVM plugin is already present")
|
logger.info("Kotlin JVM plugin is already present")
|
||||||
}
|
|
||||||
plugins.apply(KScienceCommonPlugin::class)
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,18 @@ package ru.mipt.npm.gradle
|
|||||||
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.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.hasPlugin
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
|
||||||
|
|
||||||
open class KScienceMPPlugin : Plugin<Project> {
|
public open class KScienceMPPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project): Unit = project.run {
|
override fun apply(project: Project): Unit = project.run {
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
if (!plugins.hasPlugin(KotlinMultiplatformPlugin::class)) {
|
||||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
//apply<KotlinMultiplatformPlugin>() for some reason it does not work
|
||||||
|
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
} else {
|
} else {
|
||||||
logger.info("Kotlin MPP plugin is already present")
|
logger.info("Kotlin MPP plugin is already present")
|
||||||
}
|
}
|
||||||
plugins.apply(KScienceCommonPlugin::class)
|
|
||||||
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,68 +1,57 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
import org.gradle.api.Action
|
|
||||||
import org.gradle.api.NamedDomainObjectContainer
|
|
||||||
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.apply
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.kotlin.dsl.configure
|
|
||||||
import org.gradle.kotlin.dsl.findPlugin
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
|
||||||
|
|
||||||
private fun KotlinMultiplatformExtension.sourceSets(configure: Action<NamedDomainObjectContainer<KotlinSourceSet>>): Unit =
|
public class KScienceNativePlugin : Plugin<Project> {
|
||||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("sourceSets", configure)
|
override fun apply(project: Project): Unit = project.run {
|
||||||
|
|
||||||
class KScienceNativePlugin : Plugin<Project> {
|
|
||||||
override fun apply(project: Project) = project.run {
|
|
||||||
//Apply multiplatform plugin is not applied, apply it
|
//Apply multiplatform plugin is not applied, apply it
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
||||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
}
|
}
|
||||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
|
||||||
|
if (!plugins.hasPlugin(KScienceCommonPlugin::class)) {
|
||||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||||
pluginManager.apply(KScienceCommonPlugin::class)
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
|
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
val hostOs = System.getProperty("os.name")
|
val nativeTargets = setOf(
|
||||||
|
linuxX64(),
|
||||||
val isLinux = hostOs == "Linux"
|
mingwX64(),
|
||||||
val isMinGw = hostOs.startsWith("Windows")
|
macosX64(),
|
||||||
val isMacOs = hostOs == "Mac OS X"
|
)
|
||||||
|
|
||||||
if (isLinux || isMinGw) {
|
|
||||||
linuxX64()
|
|
||||||
}
|
|
||||||
if (isMinGw) {
|
|
||||||
mingwX64()
|
|
||||||
}
|
|
||||||
if (isMacOs) {
|
|
||||||
macosX64()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain = findByName("commonMain")!!
|
val commonMain = findByName("commonMain")!!
|
||||||
val commonTest = findByName("commonTest")!!
|
val commonTest = findByName("commonTest")!!
|
||||||
|
|
||||||
val nativeMain = create("nativeMain").apply {
|
val nativeMain by creating {
|
||||||
dependsOn(commonMain)
|
dependsOn(commonMain)
|
||||||
}
|
}
|
||||||
|
|
||||||
val nativeTest = create("nativeTest").apply {
|
val nativeTest by creating {
|
||||||
|
dependsOn(nativeMain)
|
||||||
dependsOn(commonTest)
|
dependsOn(commonTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
findByName("linuxX64Main")?.dependsOn(nativeMain)
|
configure(nativeTargets) {
|
||||||
findByName("linuxX64Test")?.dependsOn(nativeTest)
|
compilations["main"]?.apply {
|
||||||
|
configure(kotlinSourceSets) {
|
||||||
|
dependsOn(nativeMain)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
findByName("mingwX64Main")?.dependsOn(nativeMain)
|
compilations["test"]?.apply {
|
||||||
findByName("mingwX64Test")?.dependsOn(nativeTest)
|
configure(kotlinSourceSets) {
|
||||||
|
dependsOn(nativeTest)
|
||||||
findByName("macosX64Main")?.dependsOn(nativeMain)
|
}
|
||||||
findByName("macosX64Test")?.dependsOn(nativeTest)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,24 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
import org.gradle.api.Action
|
|
||||||
import org.gradle.api.NamedDomainObjectContainer
|
|
||||||
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.apply
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.kotlin.dsl.configure
|
|
||||||
import org.gradle.kotlin.dsl.findPlugin
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
|
||||||
|
|
||||||
private fun KotlinMultiplatformExtension.sourceSets(configure: Action<NamedDomainObjectContainer<KotlinSourceSet>>): Unit =
|
|
||||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("sourceSets", configure)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a separate target for node
|
* Create a separate target for node
|
||||||
*/
|
*/
|
||||||
class KScienceNodePlugin : Plugin<Project> {
|
public class KScienceNodePlugin : Plugin<Project> {
|
||||||
override fun apply(target: Project) = target.run {
|
override fun apply(target: Project): Unit = target.run {
|
||||||
//Apply multiplatform plugin is not applied, apply it
|
//Apply multiplatform plugin is not applied, apply it
|
||||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||||
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
logger.info("Kotlin multiplatform plugin is not resolved. Adding it automatically")
|
||||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
if (plugins.findPlugin(KScienceCommonPlugin::class) == null) {
|
||||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||||
pluginManager.apply(KScienceCommonPlugin::class)
|
apply<KScienceCommonPlugin>()
|
||||||
}
|
}
|
||||||
|
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
@ -58,4 +51,4 @@ class KScienceNodePlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,42 +11,70 @@ import org.jetbrains.changelog.ChangelogPlugin
|
|||||||
import org.jetbrains.changelog.ChangelogPluginExtension
|
import org.jetbrains.changelog.ChangelogPluginExtension
|
||||||
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
||||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||||
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 }
|
private fun Project.allTasks(): Set<Task> = allprojects.flatMapTo(HashSet()) { it.tasks }
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class KSciencePublishingExtension(val project: Project) {
|
public class KSciencePublishingExtension(public val project: Project) {
|
||||||
private var initializedFlag = false
|
private var isVcsInitialized = false
|
||||||
|
|
||||||
fun vcs(vcsUrl: String) {
|
@Deprecated("Use git function and report an issue if other VCS is used.")
|
||||||
if (!initializedFlag) {
|
public fun vcs(vcsUrl: String) {
|
||||||
project.setupPublication(vcsUrl)
|
if (!isVcsInitialized) {
|
||||||
initializedFlag = true
|
project.setupPublication {
|
||||||
|
url.set(vcsUrl)
|
||||||
|
scm { url.set(vcsUrl) }
|
||||||
|
}
|
||||||
|
|
||||||
|
isVcsInitialized = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* github publishing
|
* Configures Git repository (sources) for the publication.
|
||||||
* @param publish include github packages in release publishing. By default - false
|
*
|
||||||
|
* @param vcsUrl URL of the repository's web interface.
|
||||||
|
* @param connectionUrl URL of the Git repository.
|
||||||
|
* @param developerConnectionUrl URL of the Git repository for developers.
|
||||||
*/
|
*/
|
||||||
fun github(githubProject: String, githubOrg: String = "mipt-npm", publish: Boolean = false) {
|
public fun git(vcsUrl: String, connectionUrl: String? = null, developerConnectionUrl: String? = connectionUrl) {
|
||||||
//automatically initialize vcs using github
|
if (!isVcsInitialized) {
|
||||||
if (!initializedFlag) {
|
project.setupPublication {
|
||||||
vcs("https://github.com/$githubOrg/$githubProject")
|
url.set(vcsUrl)
|
||||||
|
|
||||||
|
scm {
|
||||||
|
url.set(vcsUrl)
|
||||||
|
connectionUrl?.let { connection.set("scm:git:$it") }
|
||||||
|
developerConnectionUrl?.let { developerConnection.set("scm:git:$it") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isVcsInitialized = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun linkPublicationsToReleaseTask(name: String) = project.afterEvaluate {
|
||||||
|
allTasks()
|
||||||
|
.filter { it.name == "publish${publicationTarget}To${name.capitalize()}Repository" }
|
||||||
|
.forEach { releaseTask?.dependsOn(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds GitHub as VCS and adds GitHub Packages Maven repository to publishing.
|
||||||
|
*
|
||||||
|
* @param githubProject the GitHub project.
|
||||||
|
* @param githubOrg the GitHub user or organization.
|
||||||
|
* @param release whether publish packages in the `release` task to the GitHub repository.
|
||||||
|
*/
|
||||||
|
public fun github(githubProject: String, githubOrg: String = "mipt-npm", release: Boolean = false, publish: Boolean = true) {
|
||||||
|
// Automatically initialize VCS using GitHub
|
||||||
|
if (!isVcsInitialized) {
|
||||||
|
git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git")
|
||||||
}
|
}
|
||||||
|
|
||||||
project.addGithubPublishing(githubOrg, githubProject)
|
if (publish) project.addGithubPublishing(githubOrg, githubProject)
|
||||||
|
if (release) linkPublicationsToReleaseTask("github")
|
||||||
if (publish)
|
|
||||||
project.afterEvaluate {
|
|
||||||
allTasks()
|
|
||||||
.find { it.name == "publish${publicationTarget}ToGithubRepository" }
|
|
||||||
?.let { publicationTask ->
|
|
||||||
releaseTask?.dependsOn(publicationTask)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val releaseTask by lazy {
|
private val releaseTask by lazy {
|
||||||
@ -54,18 +82,15 @@ class KSciencePublishingExtension(val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Space publishing
|
* Adds Space Packages Maven repository to publishing.
|
||||||
|
*
|
||||||
|
* @param spaceRepo the repository URL.
|
||||||
|
* @param release whether publish packages in the `release` task to the Space repository.
|
||||||
*/
|
*/
|
||||||
fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", publish: Boolean = false) {
|
public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) {
|
||||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
|
||||||
project.addSpacePublishing(spaceRepo)
|
project.addSpacePublishing(spaceRepo)
|
||||||
|
|
||||||
if (publish)
|
if (release) linkPublicationsToReleaseTask("space")
|
||||||
project.afterEvaluate {
|
|
||||||
allTasks()
|
|
||||||
.find { it.name == "publish${publicationTarget}ToSpaceRepository" }
|
|
||||||
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Bintray publishing
|
// // Bintray publishing
|
||||||
@ -75,25 +100,23 @@ class KSciencePublishingExtension(val project: Project) {
|
|||||||
// var bintrayRepo: String? by project.extra
|
// var bintrayRepo: String? by project.extra
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sonatype publishing
|
* Adds Sonatype Maven repository to publishing.
|
||||||
|
*
|
||||||
|
* @param release whether publish packages in the `release` task to the Sonatype repository.
|
||||||
*/
|
*/
|
||||||
fun sonatype(publish: Boolean = true) {
|
public fun sonatype(release: Boolean = true) {
|
||||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
require(isVcsInitialized) { "The project vcs is not set up use 'git' method to do so" }
|
||||||
project.addSonatypePublishing()
|
project.addSonatypePublishing()
|
||||||
|
|
||||||
if (publish)
|
if (release) linkPublicationsToReleaseTask("sonatype")
|
||||||
project.afterEvaluate {
|
|
||||||
allTasks()
|
|
||||||
.find { it.name == "publish${publicationTarget}ToSonatypeRepository" }
|
|
||||||
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply extension and repositories
|
* Applies third-party plugins (Dokka, Changelog, binary compatibility validator); configures Maven publishing, README
|
||||||
|
* generation.
|
||||||
*/
|
*/
|
||||||
open class KScienceProjectPlugin : Plugin<Project> {
|
public 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>()
|
||||||
|
|
||||||
@ -143,7 +166,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tasks.withType<DokkaTask> {
|
|
||||||
|
tasks.withType<AbstractDokkaTask> {
|
||||||
dependsOn(generateReadme)
|
dependsOn(generateReadme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +255,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
public companion object {
|
||||||
const val RELEASE_GROUP = "release"
|
public const val RELEASE_GROUP: String = "release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ package ru.mipt.npm.gradle
|
|||||||
import groovy.text.SimpleTemplateEngine
|
import groovy.text.SimpleTemplateEngine
|
||||||
import kotlinx.validation.ApiValidationExtension
|
import kotlinx.validation.ApiValidationExtension
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.getByType
|
import org.gradle.kotlin.dsl.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
enum class Maturity {
|
public enum class Maturity {
|
||||||
PROTOTYPE,
|
PROTOTYPE,
|
||||||
EXPERIMENTAL,
|
EXPERIMENTAL,
|
||||||
DEVELOPMENT,
|
DEVELOPMENT,
|
||||||
@ -14,16 +14,17 @@ enum class Maturity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class KScienceReadmeExtension(val project: Project) {
|
public class KScienceReadmeExtension(public val project: Project) {
|
||||||
var description: String = project.description ?: ""
|
public var description: String = project.description ?: ""
|
||||||
var maturity: Maturity = Maturity.EXPERIMENTAL
|
|
||||||
|
public var maturity: Maturity = Maturity.EXPERIMENTAL
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
val projectName = project.name
|
val projectName = project.name
|
||||||
if (value == Maturity.EXPERIMENTAL || value == Maturity.PROTOTYPE) {
|
if (value == Maturity.EXPERIMENTAL || value == Maturity.PROTOTYPE) {
|
||||||
project.rootProject.run {
|
project.rootProject.run {
|
||||||
plugins.withId("org.jetbrains.kotlinx.binary-compatibility-validator") {
|
plugins.withId("org.jetbrains.kotlinx.binary-compatibility-validator") {
|
||||||
extensions.getByType<ApiValidationExtension>().apply {
|
extensions.findByType<ApiValidationExtension>()?.apply {
|
||||||
project.logger.warn("$value project $projectName is excluded from API validation")
|
project.logger.warn("$value project $projectName is excluded from API validation")
|
||||||
ignoredProjects.add(projectName)
|
ignoredProjects.add(projectName)
|
||||||
}
|
}
|
||||||
@ -32,18 +33,18 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var readmeTemplate: File = project.file("docs/README-TEMPLATE.md")
|
public var readmeTemplate: File = project.file("docs/README-TEMPLATE.md")
|
||||||
|
|
||||||
data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
|
||||||
|
|
||||||
val features: MutableList<Feature> = ArrayList()
|
public val features: MutableList<Feature> = ArrayList()
|
||||||
|
|
||||||
@Deprecated("Use lambda builder instead")
|
@Deprecated("Use lambda builder instead.")
|
||||||
fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
public fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
||||||
features += Feature(id, description, ref, name)
|
features += Feature(id, description, ref, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
|
public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
|
||||||
features += Feature(id, description(), ref, name)
|
features += Feature(id, description(), ref, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,25 +55,25 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
"features" to { featuresString() }
|
"features" to { featuresString() }
|
||||||
)
|
)
|
||||||
|
|
||||||
val actualizedProperties
|
public val actualizedProperties: Map<String, Any?>
|
||||||
get() = properties.mapValues { (_, value) -> value() }
|
get() = properties.mapValues { (_, value) -> value() }
|
||||||
|
|
||||||
fun property(key: String, value: Any?) {
|
public fun property(key: String, value: Any?) {
|
||||||
properties[key] = { value }
|
properties[key] = { value }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun property(key: String, value: () -> Any?) {
|
public fun property(key: String, value: () -> Any?) {
|
||||||
properties[key] = value
|
properties[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun propertyByTemplate(key: String, template: String) {
|
public fun propertyByTemplate(key: String, template: String) {
|
||||||
val actual = actualizedProperties
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val additionalFiles = ArrayList<File>()
|
internal val additionalFiles = ArrayList<File>()
|
||||||
|
|
||||||
fun propertyByTemplate(key: String, template: File) {
|
public fun propertyByTemplate(key: String, template: File) {
|
||||||
val actual = actualizedProperties
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
additionalFiles += template
|
additionalFiles += template
|
||||||
@ -81,7 +82,7 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Generate a markdown string listing features
|
* Generate a markdown string listing features
|
||||||
*/
|
*/
|
||||||
fun featuresString(itemPrefix: String = " - ", pathPrefix: String = "") = buildString {
|
public fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
|
||||||
features.forEach {
|
features.forEach {
|
||||||
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
|
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
|
||||||
}
|
}
|
||||||
@ -90,12 +91,10 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
/**
|
/**
|
||||||
* Generate a readme string from the stub
|
* Generate a readme string from the stub
|
||||||
*/
|
*/
|
||||||
fun readmeString(): String? {
|
public fun readmeString(): String? = if (readmeTemplate.exists()) {
|
||||||
return if (readmeTemplate.exists()) {
|
val actual = actualizedProperties
|
||||||
val actual = actualizedProperties
|
SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString()
|
||||||
SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString()
|
} else {
|
||||||
} else {
|
null
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,32 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
|
|
||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.tomlj.Toml
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build constants
|
* Build constants
|
||||||
*/
|
*/
|
||||||
object KScienceVersions {
|
public 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.2"
|
|
||||||
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.216-kotlin-1.5.20"
|
|
||||||
|
|
||||||
val JVM_TARGET = JavaVersion.VERSION_11
|
private val toml by lazy {
|
||||||
|
Toml.parse(javaClass.getResource("/libs.versions.toml")!!.readText())
|
||||||
|
}
|
||||||
|
|
||||||
object Serialization{
|
public val kotlinVersion: String get() = toml.getString("versions.kotlin")!!
|
||||||
const val xmlVersion = "0.82.0"
|
public val kotlinxNodeVersion: String get() = toml.getString("versions.kotlinx-nodejs")!!
|
||||||
const val yamlKtVersion = "0.10.0"
|
public val coroutinesVersion: String get() = toml.getString("versions.kotlinx-coroutines")!!
|
||||||
|
public val serializationVersion: String get() = toml.getString("versions.kotlinx-serialization")!!
|
||||||
|
public val atomicVersion: String get() = toml.getString("versions.atomicfu")!!
|
||||||
|
public val ktorVersion: String get() = toml.getString("versions.ktor")!!
|
||||||
|
public val htmlVersion: String get() = toml.getString("versions.kotlinx-html")!!
|
||||||
|
public val dateTimeVersion: String get() = toml.getString("versions.kotlinx-datetime")!!
|
||||||
|
public val jsBom: String get() = toml.getString("versions.jsBom")!!
|
||||||
|
|
||||||
|
public val JVM_TARGET: JavaVersion = JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
public object Serialization {
|
||||||
|
public val xmlVersion: String get() = toml.getString("versions.xmlutil")!!
|
||||||
|
public val yamlKtVersion: String get() = toml.getString("versions.yamlkt")!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,58 +3,47 @@ package ru.mipt.npm.gradle
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import ru.mipt.npm.gradle.internal.useCommonDependency
|
import ru.mipt.npm.gradle.internal.useCommonDependency
|
||||||
|
|
||||||
class SerializationTargets(
|
public class SerializationTargets(
|
||||||
val sourceSet: DependencySourceSet,
|
public val sourceSet: DependencySourceSet,
|
||||||
val configuration: DependencyConfiguration
|
public val configuration: DependencyConfiguration,
|
||||||
) {
|
) {
|
||||||
|
public fun Project.json(
|
||||||
|
version: String = KScienceVersions.serializationVersion,
|
||||||
|
): Unit = useCommonDependency(
|
||||||
|
"org.jetbrains.kotlinx:kotlinx-serialization-json:$version",
|
||||||
|
dependencySourceSet = sourceSet,
|
||||||
|
dependencyConfiguration = configuration,
|
||||||
|
)
|
||||||
|
|
||||||
fun Project.json(
|
public fun Project.cbor(
|
||||||
version: String = KScienceVersions.serializationVersion
|
version: String = KScienceVersions.serializationVersion,
|
||||||
) {
|
): Unit = useCommonDependency(
|
||||||
useCommonDependency(
|
"org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version",
|
||||||
"org.jetbrains.kotlinx:kotlinx-serialization-json:$version",
|
dependencySourceSet = sourceSet,
|
||||||
dependencySourceSet = sourceSet,
|
dependencyConfiguration = configuration,
|
||||||
dependencyConfiguration = configuration
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.cbor(
|
public fun Project.protobuf(
|
||||||
version: String = KScienceVersions.serializationVersion
|
version: String = KScienceVersions.serializationVersion,
|
||||||
) {
|
): Unit = useCommonDependency(
|
||||||
useCommonDependency(
|
"org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version",
|
||||||
"org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version",
|
dependencySourceSet = sourceSet,
|
||||||
dependencySourceSet = sourceSet,
|
dependencyConfiguration = configuration,
|
||||||
dependencyConfiguration = configuration
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.protobuf(
|
public fun Project.xml(
|
||||||
version: String = KScienceVersions.serializationVersion
|
version: String = KScienceVersions.Serialization.xmlVersion,
|
||||||
) {
|
): Unit = useCommonDependency(
|
||||||
useCommonDependency(
|
"io.github.pdvrieze.xmlutil:serialization:$version",
|
||||||
"org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version",
|
dependencySourceSet = sourceSet,
|
||||||
dependencySourceSet = sourceSet,
|
dependencyConfiguration = configuration,
|
||||||
dependencyConfiguration = configuration
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.xml(
|
public fun Project.yamlKt(
|
||||||
version: String = KScienceVersions.Serialization.xmlVersion
|
version: String = KScienceVersions.Serialization.yamlKtVersion,
|
||||||
) {
|
): Unit = useCommonDependency(
|
||||||
useCommonDependency(
|
"net.mamoe.yamlkt:yamlkt:$version",
|
||||||
"io.github.pdvrieze.xmlutil:serialization:$version",
|
dependencySourceSet = sourceSet,
|
||||||
dependencySourceSet = sourceSet,
|
dependencyConfiguration = configuration,
|
||||||
dependencyConfiguration = configuration
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.yamlKt(
|
|
||||||
version: String = KScienceVersions.Serialization.yamlKtVersion
|
|
||||||
) {
|
|
||||||
useCommonDependency(
|
|
||||||
"net.mamoe.yamlkt:yamlkt:$version",
|
|
||||||
dependencySourceSet = sourceSet,
|
|
||||||
dependencyConfiguration = configuration
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,20 @@ import org.gradle.language.jvm.tasks.ProcessResources
|
|||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
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() {
|
||||||
languageVersion = "1.5"
|
languageVersion = "1.6"
|
||||||
apiVersion = "1.5"
|
apiVersion = "1.6"
|
||||||
progressiveMode = true
|
progressiveMode = true
|
||||||
useExperimentalAnnotation("kotlin.Experimental")
|
|
||||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
optIn("kotlin.RequiresOptIn")
|
||||||
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
|
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||||
useExperimentalAnnotation("kotlin.time.ExperimentalTime")
|
optIn("kotlin.ExperimentalStdlibApi")
|
||||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
optIn("kotlin.time.ExperimentalTime")
|
||||||
useExperimentalAnnotation("kotlin.js.ExperimentalJsExport")
|
optIn("kotlin.contracts.ExperimentalContracts")
|
||||||
|
optIn("kotlin.js.ExperimentalJsExport")
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun RepositoryHandler.applyRepos(): Unit {
|
internal fun RepositoryHandler.applyRepos() {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.kotlin.link")
|
maven("https://repo.kotlin.link")
|
||||||
}
|
}
|
||||||
@ -50,8 +51,7 @@ internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){
|
||||||
fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){
|
|
||||||
js {
|
js {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
browser {
|
browser {
|
||||||
|
@ -87,7 +87,6 @@ internal fun Project.useCommonDependency(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
withPlugin("org.jetbrains.kotlin.jvm") {
|
withPlugin("org.jetbrains.kotlin.jvm") {
|
||||||
configure<KotlinJvmProjectExtension> {
|
configure<KotlinJvmProjectExtension> {
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
@ -102,6 +101,7 @@ internal fun Project.useCommonDependency(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
withPlugin("org.jetbrains.kotlin.js") {
|
withPlugin("org.jetbrains.kotlin.js") {
|
||||||
configure<KotlinJsProjectExtension> {
|
configure<KotlinJsProjectExtension> {
|
||||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||||
@ -116,4 +116,4 @@ internal fun Project.useCommonDependency(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package ru.mipt.npm.gradle.internal
|
|||||||
|
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
import org.gradle.kotlin.dsl.findByType
|
import org.gradle.kotlin.dsl.findByType
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
@ -10,7 +11,7 @@ import ru.mipt.npm.gradle.DependencyConfiguration
|
|||||||
import ru.mipt.npm.gradle.FXModule
|
import ru.mipt.npm.gradle.FXModule
|
||||||
import ru.mipt.npm.gradle.FXPlatform
|
import ru.mipt.npm.gradle.FXPlatform
|
||||||
|
|
||||||
val defaultPlatform: FXPlatform = when {
|
internal val defaultPlatform: FXPlatform = when {
|
||||||
Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS
|
Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS
|
||||||
Os.isFamily(Os.FAMILY_MAC) -> FXPlatform.MAC
|
Os.isFamily(Os.FAMILY_MAC) -> FXPlatform.MAC
|
||||||
Os.isFamily(Os.FAMILY_UNIX) -> FXPlatform.LINUX
|
Os.isFamily(Os.FAMILY_UNIX) -> FXPlatform.LINUX
|
||||||
@ -58,4 +59,4 @@ internal fun Project.useFx(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ package ru.mipt.npm.gradle.internal
|
|||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.publish.PublishingExtension
|
import org.gradle.api.publish.PublishingExtension
|
||||||
|
import org.gradle.api.publish.maven.MavenPom
|
||||||
import org.gradle.api.publish.maven.MavenPublication
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
import org.gradle.api.tasks.bundling.Jar
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.gradle.plugins.signing.SigningExtension
|
import org.gradle.plugins.signing.SigningExtension
|
||||||
|
import org.gradle.plugins.signing.SigningPlugin
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
|
|
||||||
@ -16,27 +18,27 @@ private fun Project.requestProperty(propertyName: String): String = requestPrope
|
|||||||
?: error("Property $propertyName not defined")
|
?: error("Property $propertyName not defined")
|
||||||
|
|
||||||
|
|
||||||
internal fun Project.setupPublication(vcs: String) = allprojects {
|
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
|
|
||||||
plugins.withId("org.jetbrains.kotlin.js") {
|
plugins.withId("org.jetbrains.kotlin.js") {
|
||||||
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
||||||
|
|
||||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
val sourcesJar by tasks.creating(Jar::class) {
|
||||||
archiveClassifier.set("sources")
|
archiveClassifier.set("sources")
|
||||||
kotlin.sourceSets.forEach{
|
|
||||||
from(it.kotlin)
|
kotlin.sourceSets.all {
|
||||||
|
from(kotlin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
publications {
|
publications.create<MavenPublication>("js") {
|
||||||
create("js", MavenPublication::class) {
|
kotlin.js().components.forEach {
|
||||||
kotlin.js().components.forEach {
|
from(it)
|
||||||
from(it)
|
|
||||||
}
|
|
||||||
artifact(sourcesJar)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artifact(sourcesJar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,24 +46,23 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
|||||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||||
|
|
||||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
val sourcesJar by tasks.creating(Jar::class) {
|
||||||
archiveClassifier.set("sources")
|
archiveClassifier.set("sources")
|
||||||
kotlin.sourceSets.forEach{
|
kotlin.sourceSets.forEach {
|
||||||
from(it.kotlin)
|
from(it.kotlin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publications {
|
publications.create<MavenPublication>("jvm") {
|
||||||
create("jvm", MavenPublication::class) {
|
kotlin.target.components.forEach {
|
||||||
kotlin.target.components.forEach {
|
from(it)
|
||||||
from(it)
|
|
||||||
}
|
|
||||||
artifact(sourcesJar)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artifact(sourcesJar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val dokkaJar: Jar by tasks.creating(Jar::class) {
|
val dokkaJar by tasks.creating(Jar::class) {
|
||||||
group = "documentation"
|
group = "documentation"
|
||||||
archiveClassifier.set("javadoc")
|
archiveClassifier.set("javadoc")
|
||||||
from(tasks.findByName("dokkaHtml"))
|
from(tasks.findByName("dokkaHtml"))
|
||||||
@ -69,35 +70,35 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
|||||||
|
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
publications.withType<MavenPublication>().forEach { publication ->
|
publications.withType<MavenPublication> {
|
||||||
publication.artifact(dokkaJar)
|
artifact(dokkaJar)
|
||||||
publication.pom {
|
|
||||||
|
pom {
|
||||||
name.set(project.name)
|
name.set(project.name)
|
||||||
description.set(project.description ?: project.name)
|
description.set(project.description ?: project.name)
|
||||||
url.set(vcs)
|
|
||||||
|
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name.set("The Apache Software License, Version 2.0")
|
name.set("The Apache Software License, Version 2.0")
|
||||||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||||
distribution.set("repo")
|
distribution.set("repo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id.set("MIPT-NPM")
|
id.set("MIPT-NPM")
|
||||||
name.set("MIPT nuclear physics methods laboratory")
|
name.set("MIPT nuclear physics methods laboratory")
|
||||||
organization.set("MIPT")
|
organization.set("MIPT")
|
||||||
organizationUrl.set("http://npm.mipt.ru")
|
organizationUrl.set("https://npm.mipt.ru")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scm {
|
scm {
|
||||||
url.set(vcs)
|
|
||||||
tag.set(project.version.toString())
|
tag.set(project.version.toString())
|
||||||
//developerConnection = "scm:git:[fetch=]/*ВАША ССЫЛКА НА .git файл*/[push=]/*Повторить предыдущую ссылку*/"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mavenPomConfiguration()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +106,7 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.isSnapshot() = version.toString().contains("dev") || version.toString().endsWith("SNAPSHOT")
|
internal fun Project.isSnapshot() = "dev" in version.toString() || version.toString().endsWith("SNAPSHOT")
|
||||||
|
|
||||||
internal val Project.publicationTarget: String
|
internal val Project.publicationTarget: String
|
||||||
get() {
|
get() {
|
||||||
@ -137,14 +138,14 @@ internal fun Project.addGithubPublishing(
|
|||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
logger.info("Adding github publishing to project [${project.name}]")
|
logger.info("Adding github publishing to project [${project.name}]")
|
||||||
repositories {
|
|
||||||
maven {
|
repositories.maven {
|
||||||
name = "github"
|
name = "github"
|
||||||
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
|
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
|
||||||
credentials {
|
|
||||||
username = githubUser
|
credentials {
|
||||||
password = githubToken
|
username = githubUser
|
||||||
}
|
password = githubToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,9 +155,10 @@ internal fun Project.addGithubPublishing(
|
|||||||
|
|
||||||
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||||
logger.info("Skipping github publishing because publishing is disabled")
|
logger.info("Skipping space publishing because publishing is disabled")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.space") == "false") {
|
if (requestPropertyOrNull("publishing.space") == "false") {
|
||||||
logger.info("Skipping space publishing because `publishing.space == false`")
|
logger.info("Skipping space publishing because `publishing.space == false`")
|
||||||
return
|
return
|
||||||
@ -169,15 +171,14 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
|||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "space"
|
|
||||||
url = uri(spaceRepo)
|
|
||||||
credentials {
|
|
||||||
username = spaceUser
|
|
||||||
password = spaceToken
|
|
||||||
}
|
|
||||||
|
|
||||||
|
repositories.maven {
|
||||||
|
name = "space"
|
||||||
|
url = uri(spaceRepo)
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = spaceUser
|
||||||
|
password = spaceToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,14 +187,16 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addSonatypePublishing() {
|
internal fun Project.addSonatypePublishing() {
|
||||||
if(requestPropertyOrNull("publishing.enabled")!="true"){
|
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||||
logger.info("Skipping github publishing because publishing is disabled")
|
logger.info("Skipping sonatype publishing because publishing is disabled")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSnapshot()) {
|
if (isSnapshot()) {
|
||||||
logger.info("Sonatype publishing skipped for dev version")
|
logger.info("Sonatype publishing skipped for dev version")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
||||||
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
||||||
return
|
return
|
||||||
@ -201,45 +204,37 @@ internal fun Project.addSonatypePublishing() {
|
|||||||
|
|
||||||
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
|
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
|
||||||
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
|
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
|
||||||
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
val sonatypeRepo: String = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
if (!plugins.hasPlugin("signing")) {
|
||||||
|
apply<SigningPlugin>()
|
||||||
if (plugins.findPlugin("signing") == null) {
|
|
||||||
plugins.apply("signing")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions.configure<SigningExtension>("signing") {
|
extensions.configure<SigningExtension>("signing") {
|
||||||
|
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
|
||||||
if (!signingId.isNullOrBlank()) {
|
if (!signingId.isNullOrBlank()) {
|
||||||
val signingKey: String = requestProperty("publishing.signing.key")
|
val signingKey: String = requestProperty("publishing.signing.key")
|
||||||
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
||||||
|
|
||||||
//if key is provided, use it
|
// if key is provided, use it
|
||||||
@Suppress("UnstableApiUsage")
|
|
||||||
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
||||||
} // else use file signing
|
} // else use file signing
|
||||||
sign(publications)
|
sign(publications)
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories.maven {
|
||||||
maven {
|
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri(sonatypeRepo)
|
url = uri(sonatypeRepo)
|
||||||
credentials {
|
|
||||||
username = sonatypeUser
|
credentials {
|
||||||
password = sonatypePassword
|
username = sonatypeUser
|
||||||
}
|
password = sonatypePassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//internal val Project.bintrayPublish: Boolean
|
|
||||||
// get() = (findProperty("publishing.bintray.publish") as? String)?.toBoolean() ?: false
|
|
||||||
//internal val Project.bintrayOrg: String? get() = findProperty("publishing.bintray.org") as? String
|
|
||||||
//internal val Project.bintrayUser: String? get() = findProperty("publishing.bintray.user") as? String
|
|
||||||
//internal val Project.bintrayApiKey: String? get() = findProperty("publishing.bintray.apiKey") as? String
|
|
||||||
|
10
src/test/kotlin/TestVersions.kt
Normal file
10
src/test/kotlin/TestVersions.kt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class TestPlugins {
|
||||||
|
@Test
|
||||||
|
fun testVersions() {
|
||||||
|
println(KScienceVersions.coroutinesVersion)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user