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
|
||||
|
||||
### Security
|
||||
## [0.10.2]
|
||||
|
||||
## [0.10.4]
|
||||
### Added
|
||||
- Experimental automatic JS project bundling in MPP
|
||||
|
||||
### Changed
|
||||
- Kotlin 1.6
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
-Release task (#19)
|
||||
- Some issues with opt-ins
|
||||
|
||||
|
||||
### 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]
|
||||
### Added
|
||||
- Lazy readme properties
|
||||
- BOM for kotlin-wrappers on JS
|
||||
- Jupyter loader
|
||||
|
||||
|
||||
### Changed
|
||||
- API validation disabled for dev versions
|
||||
- Kotlin plugins are propagated downstream
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- bson support
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
## [0.9.5]
|
||||
### Added
|
||||
- Disable API validation for snapshots
|
||||
- `-Xjvm-default=all` on JVM
|
||||
|
||||
|
||||
### Changed
|
||||
- `publication.platform` changed to `publishing.platform`
|
||||
- Dokka version to `1.4.30`
|
||||
- `useDateTime` in extension
|
||||
- Kotlin 1.5
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- Publish plugin. Use MavenPublish instead
|
||||
|
||||
|
||||
### Fixed
|
||||
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
|
||||
|
||||
### Security
|
||||
|
||||
## [0.9.0]
|
||||
### Added
|
||||
- Skip sonatype publishing for dev versions
|
||||
|
||||
|
||||
### Changed
|
||||
- Publishing repositories are explicit and defined in the top level project
|
||||
- Paths to publishing properties now use dot notation like `publishing.github.user`
|
||||
|
||||
|
||||
### Deprecated
|
||||
- Publishing plugin
|
||||
|
||||
|
||||
### Removed
|
||||
- Bintray publishing
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
## [0.8.4]
|
||||
### Added
|
||||
- Adaptive support for host OS in native
|
||||
- CSS support for JS targets
|
||||
|
||||
|
||||
### Changed
|
||||
- Kotlin 1.4.31
|
||||
- Coroutines 1.4.3
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
- Plugin loading order for publishing
|
||||
- Release task
|
||||
- Readme generation for multi-module project
|
||||
|
||||
### Security
|
||||
|
||||
## [0.8.1]
|
||||
### Added
|
||||
- Ktor version to versions
|
||||
- Add sonatype publishing
|
||||
- Per-platform release publishing
|
||||
|
||||
|
||||
### Changed
|
||||
- Kotlin to 1.4.30 stable.
|
||||
- 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`
|
||||
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- kaml
|
||||
|
||||
|
||||
### Fixed
|
||||
- Fix publishing load order for sonatype
|
||||
- Fix root project readme
|
||||
|
||||
### Security
|
||||
|
||||
## [0.7.4]
|
||||
|
||||
### Added
|
||||
- Changelog plugin automatically applied to `project`.
|
||||
- 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
|
||||
- Suppress API validation for modules with maturity below DEVELOPMENT
|
||||
|
||||
|
||||
### Changed
|
||||
- Remove node plugin. Node binaries should be turned on manually.
|
||||
- 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
|
||||
- Kotlin 1.4.30-RC
|
||||
|
||||
|
||||
### Deprecated
|
||||
- Support of `kaml` and `snake-yaml` in favor of `yamlKt`
|
||||
- Publish plugin
|
||||
|
||||
|
||||
### Removed
|
||||
- `useDokka` method. Documentation jar should be added manually if needed.
|
||||
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
## [0.6.0]
|
||||
|
||||
### Added
|
||||
- Migrate to kotlin 1.4.0
|
||||
- Separate Native (current platform) and nodeJs plugins.
|
||||
- Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm.
|
||||
- Add `publish` to expose publishing configuration.
|
||||
|
||||
|
||||
### Changed
|
||||
-Publishing in bintray now is automatic.
|
||||
|
||||
## [0.5.2]
|
||||
|
||||
### Added
|
||||
- Copy resources for jvm modules and jvm source sets in mpp.
|
@ -1,14 +1,15 @@
|
||||
plugins {
|
||||
alias(libs.plugins.changelog)
|
||||
alias(libs.plugins.dokka)
|
||||
`java-gradle-plugin`
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
signing
|
||||
alias(libs.plugins.changelog)
|
||||
alias(libs.plugins.dokka)
|
||||
`version-catalog`
|
||||
}
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
version = "0.10.2"
|
||||
version = libs.versions.tools.get()
|
||||
|
||||
description = "Build tools for DataForge and kscience projects"
|
||||
|
||||
@ -22,6 +23,8 @@ repositories {
|
||||
|
||||
java.targetCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
kotlin.explicitApiWarning()
|
||||
|
||||
dependencies {
|
||||
api(libs.kotlin.gradle)
|
||||
implementation(libs.atomicfu.gradle)
|
||||
@ -30,8 +33,19 @@ dependencies {
|
||||
implementation(libs.dokka.gradle)
|
||||
implementation(libs.kotlin.jupyter.gradle)
|
||||
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 {
|
||||
plugins {
|
||||
create("common") {
|
||||
@ -78,9 +92,13 @@ gradlePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
||||
//publishing version catalog
|
||||
|
||||
catalog.versionCatalog {
|
||||
from(files("gradle/libs.versions.toml"))
|
||||
}
|
||||
|
||||
//publishing the artifact
|
||||
|
||||
val sourcesJar by tasks.creating(Jar::class) {
|
||||
archiveClassifier.set("sources")
|
||||
@ -88,19 +106,31 @@ afterEvaluate {
|
||||
}
|
||||
|
||||
val javadocsJar by tasks.creating(Jar::class) {
|
||||
group = "documentation"
|
||||
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
||||
archiveClassifier.set("javadoc")
|
||||
from(tasks.dokkaHtml)
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
||||
|
||||
// Process each publication we have in this project
|
||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
||||
publication.apply {
|
||||
publications {
|
||||
create<MavenPublication>("catalog") {
|
||||
from(components["versionCatalog"])
|
||||
this.artifactId = "version-catalog"
|
||||
|
||||
pom {
|
||||
name.set("version-catalog")
|
||||
}
|
||||
}
|
||||
|
||||
withType<MavenPublication> {
|
||||
artifact(sourcesJar)
|
||||
artifact(javadocsJar)
|
||||
|
||||
pom {
|
||||
name.set(project.name)
|
||||
description.set(project.description)
|
||||
url.set(vcs)
|
||||
|
||||
@ -157,10 +187,6 @@ afterEvaluate {
|
||||
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
||||
}
|
||||
|
||||
if (plugins.findPlugin("signing") == null) {
|
||||
plugins.apply("signing")
|
||||
}
|
||||
|
||||
repositories.maven {
|
||||
name = "sonatype"
|
||||
url = uri(sonatypeRepo)
|
||||
@ -171,6 +197,10 @@ afterEvaluate {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.findPlugin("signing") == null) {
|
||||
apply<SigningPlugin>()
|
||||
}
|
||||
|
||||
signing {
|
||||
//useGpgCmd()
|
||||
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]
|
||||
tools = "0.10.4"
|
||||
kotlin = "1.6.0-M1"
|
||||
atomicfu = "0.16.2"
|
||||
binary-compatibility-validator = "0.6.0"
|
||||
changelog = "1.2.1"
|
||||
binary-compatibility-validator = "0.7.1"
|
||||
changelog = "1.3.0"
|
||||
dokka = "1.5.0"
|
||||
kotlin = "1.5.21"
|
||||
kotlin-jupyter = "0.10.0-173"
|
||||
kotlin-jupyter = "0.10.0-227"
|
||||
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]
|
||||
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" }
|
||||
|
||||
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-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||
|
||||
[kotlin-jupyter-gradle]
|
||||
module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin"
|
||||
version.ref = "kotlin-jupyter"
|
||||
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
|
||||
|
||||
[libraries.binary-compatibility-validator]
|
||||
module = "org.jetbrains.kotlinx:binary-compatibility-validator"
|
||||
version.ref = "binary-compatibility-validator"
|
||||
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
|
||||
|
||||
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]
|
||||
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
|
||||
|
||||
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
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,2 +1,3 @@
|
||||
rootProject.name = "gradle-tools"
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
@ -6,6 +6,7 @@ import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
||||
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
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
open class KScienceCommonPlugin : Plugin<Project> {
|
||||
public open class KScienceCommonPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
//Common configuration
|
||||
registerKScienceExtension()
|
||||
@ -27,12 +28,11 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
explicitApiWarning()
|
||||
|
||||
sourceSets["main"].apply {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-junit5"))
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.6.1")
|
||||
@ -50,12 +50,10 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
withType<Test> {
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
|
||||
//logger.info("Applying KScience configuration for JS project")
|
||||
@ -70,15 +68,17 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["main"].apply {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
|
||||
sourceSets["main"].apply {
|
||||
dependencies {
|
||||
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["test"].apply {
|
||||
languageSettings.applySettings()
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
@ -112,7 +112,7 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.invoke {
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
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 {
|
||||
dependencies {
|
||||
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
|
||||
@ -139,13 +139,9 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
targets.all {
|
||||
sourceSets.all {
|
||||
languageSettings.applySettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(tasks.findByName("jsProcessResources") as? Copy)?.apply {
|
||||
fromJsDependencies("jsRuntimeClasspath")
|
||||
@ -155,18 +151,15 @@ open class KScienceCommonPlugin : Plugin<Project> {
|
||||
targetCompatibility = KScienceVersions.JVM_TARGET
|
||||
}
|
||||
|
||||
tasks.apply {
|
||||
withType<Test> {
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apply dokka for all projects
|
||||
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
|
||||
plugins.apply("org.jetbrains.dokka")
|
||||
}
|
||||
|
||||
apply<DokkaPlugin>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.ApplicationPlugin
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
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.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||
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.useCommonDependency
|
||||
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"),
|
||||
GRAPHICS("javafx-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)
|
||||
}
|
||||
|
||||
enum class FXPlatform(val id: String) {
|
||||
public enum class FXPlatform(public val id: String) {
|
||||
WINDOWS("win"),
|
||||
LINUX("linux"),
|
||||
MAC("mac")
|
||||
}
|
||||
|
||||
enum class DependencyConfiguration {
|
||||
public enum class DependencyConfiguration {
|
||||
API,
|
||||
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"),
|
||||
TEST("test", "Test")
|
||||
}
|
||||
|
||||
|
||||
class KScienceExtension(val project: Project) {
|
||||
|
||||
public class KScienceExtension(public val project: Project) {
|
||||
/**
|
||||
* Use coroutines-core with default version or [version]
|
||||
*/
|
||||
fun useCoroutines(
|
||||
public fun useCoroutines(
|
||||
version: String = KScienceVersions.coroutinesVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
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,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION,
|
||||
): Unit = project.run {
|
||||
plugins.apply("kotlinx-atomicfu")
|
||||
apply<AtomicFUGradlePlugin>()
|
||||
useCommonDependency(
|
||||
"org.jetbrains.kotlinx:atomicfu:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
@ -73,7 +76,7 @@ class KScienceExtension(val project: Project) {
|
||||
/**
|
||||
* Use core serialization library and configure targets
|
||||
*/
|
||||
fun useSerialization(
|
||||
public fun useSerialization(
|
||||
version: String = KScienceVersions.serializationVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||
@ -90,23 +93,23 @@ class KScienceExtension(val project: Project) {
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
SerializationTargets(sourceSet, configuration).apply(block)
|
||||
SerializationTargets(sourceSet, configuration).block()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add platform-specific JavaFX dependencies with given list of [FXModule]s
|
||||
*/
|
||||
fun useFx(
|
||||
public fun useFx(
|
||||
vararg modules: FXModule,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.COMPILE_ONLY,
|
||||
version: String = "11",
|
||||
platform: FXPlatform = defaultPlatform,
|
||||
) = project.useFx(modules.toList(), configuration, version, platform)
|
||||
): Unit = project.useFx(modules.toList(), configuration, version, platform)
|
||||
|
||||
/**
|
||||
* Add dependency on kotlinx-html library
|
||||
*/
|
||||
fun useHtml(
|
||||
public fun useHtml(
|
||||
version: String = KScienceVersions.htmlVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||
@ -119,35 +122,44 @@ class KScienceExtension(val project: Project) {
|
||||
/**
|
||||
* Use kotlinx-datetime library with default version or [version]
|
||||
*/
|
||||
fun useDateTime(
|
||||
public fun useDateTime(
|
||||
version: String = KScienceVersions.dateTimeVersion,
|
||||
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
|
||||
configuration: DependencyConfiguration = DependencyConfiguration.API,
|
||||
) {
|
||||
project.useCommonDependency(
|
||||
): Unit = project.useCommonDependency(
|
||||
"org.jetbrains.kotlinx:kotlinx-datetime:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply jupyter plugin
|
||||
*/
|
||||
fun useJupyter() {
|
||||
@Deprecated("Use jupyterLibrary")
|
||||
public fun useJupyter() {
|
||||
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
|
||||
*/
|
||||
fun application() {
|
||||
public fun application() {
|
||||
project.extensions.findByType<KotlinProjectExtension>()?.apply {
|
||||
explicitApi = null
|
||||
}
|
||||
|
||||
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
project.plugins.apply(ApplicationPlugin::class.java)
|
||||
project.apply<ApplicationPlugin>()
|
||||
}
|
||||
|
||||
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
|
||||
@ -160,8 +172,9 @@ class KScienceExtension(val project: Project) {
|
||||
js {
|
||||
binaries.executable()
|
||||
}
|
||||
targets.filterIsInstance<KotlinNativeTarget>().forEach {
|
||||
it.binaries.executable()
|
||||
|
||||
targets.withType<KotlinNativeTarget> {
|
||||
binaries.executable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,14 @@ import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
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 {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.js") == null) {
|
||||
pluginManager.apply("org.jetbrains.kotlin.js")
|
||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) {
|
||||
plugins.apply("org.jetbrains.kotlin.js")
|
||||
} else {
|
||||
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.kotlin.dsl.apply
|
||||
|
||||
open class KScienceJVMPlugin : Plugin<Project> {
|
||||
public open class KScienceJVMPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.jvm") == null) {
|
||||
pluginManager.apply("org.jetbrains.kotlin.jvm")
|
||||
} else {
|
||||
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm"))
|
||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||
else
|
||||
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.Project
|
||||
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 {
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||
pluginManager.apply("org.jetbrains.kotlin.multiplatform")
|
||||
if (!plugins.hasPlugin(KotlinMultiplatformPlugin::class)) {
|
||||
//apply<KotlinMultiplatformPlugin>() for some reason it does not work
|
||||
plugins.apply("org.jetbrains.kotlin.multiplatform")
|
||||
} else {
|
||||
logger.info("Kotlin MPP plugin is already present")
|
||||
}
|
||||
plugins.apply(KScienceCommonPlugin::class)
|
||||
|
||||
apply<KScienceCommonPlugin>()
|
||||
}
|
||||
}
|
||||
|
@ -1,67 +1,56 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.findPlugin
|
||||
import org.gradle.kotlin.dsl.*
|
||||
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)
|
||||
|
||||
class KScienceNativePlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) = project.run {
|
||||
public class KScienceNativePlugin : Plugin<Project> {
|
||||
override fun apply(project: Project): Unit = project.run {
|
||||
//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")
|
||||
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")
|
||||
pluginManager.apply(KScienceCommonPlugin::class)
|
||||
apply<KScienceCommonPlugin>()
|
||||
}
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
val hostOs = System.getProperty("os.name")
|
||||
|
||||
val isLinux = hostOs == "Linux"
|
||||
val isMinGw = hostOs.startsWith("Windows")
|
||||
val isMacOs = hostOs == "Mac OS X"
|
||||
|
||||
if (isLinux || isMinGw) {
|
||||
linuxX64()
|
||||
}
|
||||
if (isMinGw) {
|
||||
mingwX64()
|
||||
}
|
||||
if (isMacOs) {
|
||||
macosX64()
|
||||
}
|
||||
val nativeTargets = setOf(
|
||||
linuxX64(),
|
||||
mingwX64(),
|
||||
macosX64(),
|
||||
)
|
||||
|
||||
sourceSets {
|
||||
val commonMain = findByName("commonMain")!!
|
||||
val commonTest = findByName("commonTest")!!
|
||||
|
||||
val nativeMain = create("nativeMain").apply {
|
||||
val nativeMain by creating {
|
||||
dependsOn(commonMain)
|
||||
}
|
||||
|
||||
val nativeTest = create("nativeTest").apply {
|
||||
val nativeTest by creating {
|
||||
dependsOn(nativeMain)
|
||||
dependsOn(commonTest)
|
||||
}
|
||||
|
||||
findByName("linuxX64Main")?.dependsOn(nativeMain)
|
||||
findByName("linuxX64Test")?.dependsOn(nativeTest)
|
||||
configure(nativeTargets) {
|
||||
compilations["main"]?.apply {
|
||||
configure(kotlinSourceSets) {
|
||||
dependsOn(nativeMain)
|
||||
}
|
||||
}
|
||||
|
||||
findByName("mingwX64Main")?.dependsOn(nativeMain)
|
||||
findByName("mingwX64Test")?.dependsOn(nativeTest)
|
||||
|
||||
findByName("macosX64Main")?.dependsOn(nativeMain)
|
||||
findByName("macosX64Test")?.dependsOn(nativeTest)
|
||||
compilations["test"]?.apply {
|
||||
configure(kotlinSourceSets) {
|
||||
dependsOn(nativeTest)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,24 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.findPlugin
|
||||
import org.gradle.kotlin.dsl.*
|
||||
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
|
||||
*/
|
||||
class KScienceNodePlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) = target.run {
|
||||
public class KScienceNodePlugin : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = target.run {
|
||||
//Apply multiplatform plugin is not applied, apply it
|
||||
if (plugins.findPlugin("org.jetbrains.kotlin.multiplatform") == null) {
|
||||
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) {
|
||||
logger.info("KScience plugin is not resolved. Adding it automatically")
|
||||
pluginManager.apply(KScienceCommonPlugin::class)
|
||||
apply<KScienceCommonPlugin>()
|
||||
}
|
||||
|
||||
configure<KotlinMultiplatformExtension> {
|
||||
|
@ -11,42 +11,70 @@ import org.jetbrains.changelog.ChangelogPlugin
|
||||
import org.jetbrains.changelog.ChangelogPluginExtension
|
||||
import org.jetbrains.dokka.gradle.AbstractDokkaTask
|
||||
import org.jetbrains.dokka.gradle.DokkaPlugin
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import ru.mipt.npm.gradle.internal.*
|
||||
|
||||
private fun Project.allTasks(): Set<Task> = allprojects.flatMapTo(HashSet()) { it.tasks }
|
||||
|
||||
@Suppress("unused")
|
||||
class KSciencePublishingExtension(val project: Project) {
|
||||
private var initializedFlag = false
|
||||
public class KSciencePublishingExtension(public val project: Project) {
|
||||
private var isVcsInitialized = false
|
||||
|
||||
fun vcs(vcsUrl: String) {
|
||||
if (!initializedFlag) {
|
||||
project.setupPublication(vcsUrl)
|
||||
initializedFlag = true
|
||||
@Deprecated("Use git function and report an issue if other VCS is used.")
|
||||
public fun vcs(vcsUrl: String) {
|
||||
if (!isVcsInitialized) {
|
||||
project.setupPublication {
|
||||
url.set(vcsUrl)
|
||||
scm { url.set(vcsUrl) }
|
||||
}
|
||||
|
||||
isVcsInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* github publishing
|
||||
* @param publish include github packages in release publishing. By default - false
|
||||
* Configures Git repository (sources) for the publication.
|
||||
*
|
||||
* @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) {
|
||||
//automatically initialize vcs using github
|
||||
if (!initializedFlag) {
|
||||
vcs("https://github.com/$githubOrg/$githubProject")
|
||||
public fun git(vcsUrl: String, connectionUrl: String? = null, developerConnectionUrl: String? = connectionUrl) {
|
||||
if (!isVcsInitialized) {
|
||||
project.setupPublication {
|
||||
url.set(vcsUrl)
|
||||
|
||||
scm {
|
||||
url.set(vcsUrl)
|
||||
connectionUrl?.let { connection.set("scm:git:$it") }
|
||||
developerConnectionUrl?.let { developerConnection.set("scm:git:$it") }
|
||||
}
|
||||
}
|
||||
|
||||
project.addGithubPublishing(githubOrg, githubProject)
|
||||
isVcsInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
if (publish)
|
||||
project.afterEvaluate {
|
||||
private fun linkPublicationsToReleaseTask(name: String) = project.afterEvaluate {
|
||||
allTasks()
|
||||
.find { it.name == "publish${publicationTarget}ToGithubRepository" }
|
||||
?.let { publicationTask ->
|
||||
releaseTask?.dependsOn(publicationTask)
|
||||
.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")
|
||||
}
|
||||
|
||||
if (publish) project.addGithubPublishing(githubOrg, githubProject)
|
||||
if (release) linkPublicationsToReleaseTask("github")
|
||||
}
|
||||
|
||||
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) {
|
||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||
public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) {
|
||||
project.addSpacePublishing(spaceRepo)
|
||||
|
||||
if (publish)
|
||||
project.afterEvaluate {
|
||||
allTasks()
|
||||
.find { it.name == "publish${publicationTarget}ToSpaceRepository" }
|
||||
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
|
||||
}
|
||||
if (release) linkPublicationsToReleaseTask("space")
|
||||
}
|
||||
|
||||
// // Bintray publishing
|
||||
@ -75,25 +100,23 @@ class KSciencePublishingExtension(val project: Project) {
|
||||
// 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) {
|
||||
require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" }
|
||||
public fun sonatype(release: Boolean = true) {
|
||||
require(isVcsInitialized) { "The project vcs is not set up use 'git' method to do so" }
|
||||
project.addSonatypePublishing()
|
||||
|
||||
if (publish)
|
||||
project.afterEvaluate {
|
||||
allTasks()
|
||||
.find { it.name == "publish${publicationTarget}ToSonatypeRepository" }
|
||||
?.let { publicationTask -> releaseTask?.dependsOn(publicationTask) }
|
||||
}
|
||||
if (release) linkPublicationsToReleaseTask("sonatype")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
apply<ChangelogPlugin>()
|
||||
|
||||
@ -143,7 +166,8 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.withType<DokkaTask> {
|
||||
|
||||
tasks.withType<AbstractDokkaTask> {
|
||||
dependsOn(generateReadme)
|
||||
}
|
||||
}
|
||||
@ -231,7 +255,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val RELEASE_GROUP = "release"
|
||||
public companion object {
|
||||
public const val RELEASE_GROUP: String = "release"
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package ru.mipt.npm.gradle
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
import kotlinx.validation.ApiValidationExtension
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import java.io.File
|
||||
|
||||
enum class Maturity {
|
||||
public enum class Maturity {
|
||||
PROTOTYPE,
|
||||
EXPERIMENTAL,
|
||||
DEVELOPMENT,
|
||||
@ -14,16 +14,17 @@ enum class Maturity {
|
||||
}
|
||||
|
||||
|
||||
class KScienceReadmeExtension(val project: Project) {
|
||||
var description: String = project.description ?: ""
|
||||
var maturity: Maturity = Maturity.EXPERIMENTAL
|
||||
public class KScienceReadmeExtension(public val project: Project) {
|
||||
public var description: String = project.description ?: ""
|
||||
|
||||
public var maturity: Maturity = Maturity.EXPERIMENTAL
|
||||
set(value) {
|
||||
field = value
|
||||
val projectName = project.name
|
||||
if (value == Maturity.EXPERIMENTAL || value == Maturity.PROTOTYPE) {
|
||||
project.rootProject.run {
|
||||
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")
|
||||
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")
|
||||
fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
||||
@Deprecated("Use lambda builder instead.")
|
||||
public fun feature(id: String, description: String, ref: String? = null, name: String = id) {
|
||||
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)
|
||||
}
|
||||
|
||||
@ -54,25 +55,25 @@ class KScienceReadmeExtension(val project: Project) {
|
||||
"features" to { featuresString() }
|
||||
)
|
||||
|
||||
val actualizedProperties
|
||||
public val actualizedProperties: Map<String, Any?>
|
||||
get() = properties.mapValues { (_, value) -> value() }
|
||||
|
||||
fun property(key: String, value: Any?) {
|
||||
public fun property(key: String, value: Any?) {
|
||||
properties[key] = { value }
|
||||
}
|
||||
|
||||
fun property(key: String, value: () -> Any?) {
|
||||
public fun property(key: String, value: () -> Any?) {
|
||||
properties[key] = value
|
||||
}
|
||||
|
||||
fun propertyByTemplate(key: String, template: String) {
|
||||
public fun propertyByTemplate(key: String, template: String) {
|
||||
val actual = actualizedProperties
|
||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||
}
|
||||
|
||||
internal val additionalFiles = ArrayList<File>()
|
||||
|
||||
fun propertyByTemplate(key: String, template: File) {
|
||||
public fun propertyByTemplate(key: String, template: File) {
|
||||
val actual = actualizedProperties
|
||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||
additionalFiles += template
|
||||
@ -81,7 +82,7 @@ class KScienceReadmeExtension(val project: Project) {
|
||||
/**
|
||||
* Generate a markdown string listing features
|
||||
*/
|
||||
fun featuresString(itemPrefix: String = " - ", pathPrefix: String = "") = buildString {
|
||||
public fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
|
||||
features.forEach {
|
||||
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
|
||||
*/
|
||||
fun readmeString(): String? {
|
||||
return if (readmeTemplate.exists()) {
|
||||
public fun readmeString(): String? = if (readmeTemplate.exists()) {
|
||||
val actual = actualizedProperties
|
||||
SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,32 @@
|
||||
package ru.mipt.npm.gradle
|
||||
|
||||
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.tomlj.Toml
|
||||
|
||||
/**
|
||||
* Build constants
|
||||
*/
|
||||
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"
|
||||
public object KScienceVersions {
|
||||
|
||||
val JVM_TARGET = JavaVersion.VERSION_11
|
||||
private val toml by lazy {
|
||||
Toml.parse(javaClass.getResource("/libs.versions.toml")!!.readText())
|
||||
}
|
||||
|
||||
object Serialization{
|
||||
const val xmlVersion = "0.82.0"
|
||||
const val yamlKtVersion = "0.10.0"
|
||||
public val kotlinVersion: String get() = toml.getString("versions.kotlin")!!
|
||||
public val kotlinxNodeVersion: String get() = toml.getString("versions.kotlinx-nodejs")!!
|
||||
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 ru.mipt.npm.gradle.internal.useCommonDependency
|
||||
|
||||
class SerializationTargets(
|
||||
val sourceSet: DependencySourceSet,
|
||||
val configuration: DependencyConfiguration
|
||||
public class SerializationTargets(
|
||||
public val sourceSet: DependencySourceSet,
|
||||
public val configuration: DependencyConfiguration,
|
||||
) {
|
||||
|
||||
fun Project.json(
|
||||
version: String = KScienceVersions.serializationVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
public fun Project.json(
|
||||
version: String = KScienceVersions.serializationVersion,
|
||||
): Unit = useCommonDependency(
|
||||
"org.jetbrains.kotlinx:kotlinx-serialization-json:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
dependencyConfiguration = configuration,
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.cbor(
|
||||
version: String = KScienceVersions.serializationVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
public fun Project.cbor(
|
||||
version: String = KScienceVersions.serializationVersion,
|
||||
): Unit = useCommonDependency(
|
||||
"org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
dependencyConfiguration = configuration,
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.protobuf(
|
||||
version: String = KScienceVersions.serializationVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
public fun Project.protobuf(
|
||||
version: String = KScienceVersions.serializationVersion,
|
||||
): Unit = useCommonDependency(
|
||||
"org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
dependencyConfiguration = configuration,
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.xml(
|
||||
version: String = KScienceVersions.Serialization.xmlVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
public fun Project.xml(
|
||||
version: String = KScienceVersions.Serialization.xmlVersion,
|
||||
): Unit = useCommonDependency(
|
||||
"io.github.pdvrieze.xmlutil:serialization:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
dependencyConfiguration = configuration,
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.yamlKt(
|
||||
version: String = KScienceVersions.Serialization.yamlKtVersion
|
||||
) {
|
||||
useCommonDependency(
|
||||
public fun Project.yamlKt(
|
||||
version: String = KScienceVersions.Serialization.yamlKtVersion,
|
||||
): Unit = useCommonDependency(
|
||||
"net.mamoe.yamlkt:yamlkt:$version",
|
||||
dependencySourceSet = sourceSet,
|
||||
dependencyConfiguration = configuration
|
||||
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.plugin.LanguageSettingsBuilder
|
||||
|
||||
internal fun LanguageSettingsBuilder.applySettings(): Unit {
|
||||
languageVersion = "1.5"
|
||||
apiVersion = "1.5"
|
||||
internal fun LanguageSettingsBuilder.applySettings() {
|
||||
languageVersion = "1.6"
|
||||
apiVersion = "1.6"
|
||||
progressiveMode = true
|
||||
useExperimentalAnnotation("kotlin.Experimental")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
||||
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
|
||||
useExperimentalAnnotation("kotlin.time.ExperimentalTime")
|
||||
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||
useExperimentalAnnotation("kotlin.js.ExperimentalJsExport")
|
||||
|
||||
optIn("kotlin.RequiresOptIn")
|
||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
optIn("kotlin.ExperimentalStdlibApi")
|
||||
optIn("kotlin.time.ExperimentalTime")
|
||||
optIn("kotlin.contracts.ExperimentalContracts")
|
||||
optIn("kotlin.js.ExperimentalJsExport")
|
||||
}
|
||||
|
||||
internal fun RepositoryHandler.applyRepos(): Unit {
|
||||
internal fun RepositoryHandler.applyRepos() {
|
||||
mavenCentral()
|
||||
maven("https://repo.kotlin.link")
|
||||
}
|
||||
@ -50,8 +51,7 @@ internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){
|
||||
internal fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){
|
||||
js {
|
||||
binaries.executable()
|
||||
browser {
|
||||
|
@ -87,7 +87,6 @@ internal fun Project.useCommonDependency(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
withPlugin("org.jetbrains.kotlin.jvm") {
|
||||
configure<KotlinJvmProjectExtension> {
|
||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||
@ -102,6 +101,7 @@ internal fun Project.useCommonDependency(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
withPlugin("org.jetbrains.kotlin.js") {
|
||||
configure<KotlinJsProjectExtension> {
|
||||
sourceSets.findByName(dependencySourceSet.setName)?.apply {
|
||||
|
@ -2,6 +2,7 @@ package ru.mipt.npm.gradle.internal
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.findByType
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
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.FXPlatform
|
||||
|
||||
val defaultPlatform: FXPlatform = when {
|
||||
internal val defaultPlatform: FXPlatform = when {
|
||||
Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS
|
||||
Os.isFamily(Os.FAMILY_MAC) -> FXPlatform.MAC
|
||||
Os.isFamily(Os.FAMILY_UNIX) -> FXPlatform.LINUX
|
||||
|
@ -2,10 +2,12 @@ package ru.mipt.npm.gradle.internal
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPom
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.*
|
||||
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.KotlinJvmProjectExtension
|
||||
|
||||
@ -16,52 +18,51 @@ private fun Project.requestProperty(propertyName: String): String = requestPrope
|
||||
?: error("Property $propertyName not defined")
|
||||
|
||||
|
||||
internal fun Project.setupPublication(vcs: String) = allprojects {
|
||||
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
|
||||
plugins.withId("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.js") {
|
||||
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
|
||||
|
||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
||||
val sourcesJar by tasks.creating(Jar::class) {
|
||||
archiveClassifier.set("sources")
|
||||
kotlin.sourceSets.forEach{
|
||||
from(it.kotlin)
|
||||
|
||||
kotlin.sourceSets.all {
|
||||
from(kotlin)
|
||||
}
|
||||
}
|
||||
afterEvaluate {
|
||||
publications {
|
||||
create("js", MavenPublication::class) {
|
||||
publications.create<MavenPublication>("js") {
|
||||
kotlin.js().components.forEach {
|
||||
from(it)
|
||||
}
|
||||
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
|
||||
|
||||
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
||||
val sourcesJar by tasks.creating(Jar::class) {
|
||||
archiveClassifier.set("sources")
|
||||
kotlin.sourceSets.forEach {
|
||||
from(it.kotlin)
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
create("jvm", MavenPublication::class) {
|
||||
publications.create<MavenPublication>("jvm") {
|
||||
kotlin.target.components.forEach {
|
||||
from(it)
|
||||
}
|
||||
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val dokkaJar: Jar by tasks.creating(Jar::class) {
|
||||
val dokkaJar by tasks.creating(Jar::class) {
|
||||
group = "documentation"
|
||||
archiveClassifier.set("javadoc")
|
||||
from(tasks.findByName("dokkaHtml"))
|
||||
@ -69,35 +70,35 @@ internal fun Project.setupPublication(vcs: String) = allprojects {
|
||||
|
||||
// Process each publication we have in this project
|
||||
afterEvaluate {
|
||||
publications.withType<MavenPublication>().forEach { publication ->
|
||||
publication.artifact(dokkaJar)
|
||||
publication.pom {
|
||||
publications.withType<MavenPublication> {
|
||||
artifact(dokkaJar)
|
||||
|
||||
pom {
|
||||
name.set(project.name)
|
||||
description.set(project.description ?: project.name)
|
||||
url.set(vcs)
|
||||
|
||||
licenses {
|
||||
license {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id.set("MIPT-NPM")
|
||||
name.set("MIPT nuclear physics methods laboratory")
|
||||
organization.set("MIPT")
|
||||
organizationUrl.set("http://npm.mipt.ru")
|
||||
organizationUrl.set("https://npm.mipt.ru")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
scm {
|
||||
url.set(vcs)
|
||||
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
|
||||
get() {
|
||||
@ -137,10 +138,11 @@ internal fun Project.addGithubPublishing(
|
||||
plugins.withId("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
logger.info("Adding github publishing to project [${project.name}]")
|
||||
repositories {
|
||||
maven {
|
||||
|
||||
repositories.maven {
|
||||
name = "github"
|
||||
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
|
||||
|
||||
credentials {
|
||||
username = githubUser
|
||||
password = githubToken
|
||||
@ -150,13 +152,13 @@ internal fun Project.addGithubPublishing(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
logger.info("Skipping space publishing because publishing is disabled")
|
||||
return
|
||||
}
|
||||
|
||||
if (requestPropertyOrNull("publishing.space") == "false") {
|
||||
logger.info("Skipping space publishing because `publishing.space == false`")
|
||||
return
|
||||
@ -169,16 +171,15 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
plugins.withId("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
||||
repositories {
|
||||
maven {
|
||||
|
||||
repositories.maven {
|
||||
name = "space"
|
||||
url = uri(spaceRepo)
|
||||
|
||||
credentials {
|
||||
username = spaceUser
|
||||
password = spaceToken
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,13 +188,15 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||
|
||||
internal fun Project.addSonatypePublishing() {
|
||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
||||
logger.info("Skipping github publishing because publishing is disabled")
|
||||
logger.info("Skipping sonatype publishing because publishing is disabled")
|
||||
return
|
||||
}
|
||||
|
||||
if (isSnapshot()) {
|
||||
logger.info("Sonatype publishing skipped for dev version")
|
||||
return
|
||||
}
|
||||
|
||||
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
||||
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
||||
return
|
||||
@ -201,32 +204,31 @@ internal fun Project.addSonatypePublishing() {
|
||||
|
||||
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
|
||||
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
|
||||
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
|
||||
|
||||
allprojects {
|
||||
plugins.withId("maven-publish") {
|
||||
configure<PublishingExtension> {
|
||||
val sonatypeRepo: String = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
||||
|
||||
if (plugins.findPlugin("signing") == null) {
|
||||
plugins.apply("signing")
|
||||
if (!plugins.hasPlugin("signing")) {
|
||||
apply<SigningPlugin>()
|
||||
}
|
||||
|
||||
extensions.configure<SigningExtension>("signing") {
|
||||
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
|
||||
if (!signingId.isNullOrBlank()) {
|
||||
val signingKey: String = requestProperty("publishing.signing.key")
|
||||
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
|
||||
|
||||
// if key is provided, use it
|
||||
@Suppress("UnstableApiUsage")
|
||||
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
|
||||
} // else use file signing
|
||||
sign(publications)
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
repositories.maven {
|
||||
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
||||
name = "sonatype"
|
||||
url = uri(sonatypeRepo)
|
||||
|
||||
credentials {
|
||||
username = sonatypeUser
|
||||
password = sonatypePassword
|
||||
@ -236,10 +238,3 @@ internal fun Project.addSonatypePublishing() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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