Build refactoring
This commit is contained in:
commit
0e7ad1c0c0
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
build/
|
build/
|
||||||
out/
|
out/
|
||||||
.idea/
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
!gradle-wrapper.jar
|
!gradle-wrapper.jar
|
||||||
|
206
build.gradle.kts
206
build.gradle.kts
@ -1,45 +1,6 @@
|
|||||||
import com.moowork.gradle.node.NodeExtension
|
|
||||||
import com.moowork.gradle.node.npm.NpmTask
|
|
||||||
import com.moowork.gradle.node.task.NodeTask
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
val kotlinVersion: String by rootProject.extra("1.3.30")
|
|
||||||
val ioVersion: String by rootProject.extra("0.1.5")
|
|
||||||
val coroutinesVersion: String by rootProject.extra("1.2.0")
|
|
||||||
val atomicfuVersion: String by rootProject.extra("0.12.1")
|
|
||||||
val dokkaVersion: String by rootProject.extra("0.9.17")
|
|
||||||
val serializationVersion: String by rootProject.extra("0.10.0")
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
|
||||||
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4+")
|
|
||||||
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
|
||||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
|
|
||||||
//classpath("org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.45")
|
|
||||||
//classpath("org.openjfx:javafx-plugin:0.0.7")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("com.jfrog.artifactory") version "4.9.1" apply false
|
|
||||||
id("com.moowork.node") version "1.3.1" apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
val kmathVersion by extra("0.1.2-dev-1")
|
val kmathVersion by extra("0.1.2-dev-1")
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "maven")
|
|
||||||
apply(plugin = "maven-publish")
|
|
||||||
apply(plugin = "com.jfrog.artifactory")
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
maven("https://kotlin.bintray.com/kotlinx")
|
maven("https://kotlin.bintray.com/kotlinx")
|
||||||
@ -49,12 +10,17 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
if(name.startsWith("kmath")) {
|
if (name.startsWith("kmath")) {
|
||||||
// apply bintray configuration
|
// apply bintray configuration
|
||||||
apply(from = "${rootProject.rootDir}/gradle/bintray.gradle")
|
apply(plugin = "bintray-config")
|
||||||
|
|
||||||
//apply artifactory configuration
|
//apply artifactory configuration
|
||||||
apply(from = "${rootProject.rootDir}/gradle/artifactory.gradle")
|
apply(plugin = "artifactory-config")
|
||||||
|
|
||||||
|
plugins.withId("org.jetbrains.kotlin.multiplatform") {
|
||||||
|
apply(plugin = "multiplatform-config")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// dokka {
|
// dokka {
|
||||||
// outputFormat = "html"
|
// outputFormat = "html"
|
||||||
@ -66,160 +32,4 @@ subprojects {
|
|||||||
// classifier = "javadoc"
|
// classifier = "javadoc"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Create empty jar for sources classifier to satisfy maven requirements
|
|
||||||
val stubSources by tasks.registering(Jar::class) {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
//from(sourceSets.main.get().allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create empty jar for javadoc classifier to satisfy maven requirements
|
|
||||||
val stubJavadoc by tasks.registering(Jar::class) {
|
|
||||||
archiveClassifier.set("javadoc")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
|
||||||
jvm {
|
|
||||||
compilations.all {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
//freeCompilerArgs = listOf("-Xno-call-assertions", "-Xno-param-assertions")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
js {
|
|
||||||
compilations.all {
|
|
||||||
tasks.getByName(compileKotlinTaskName) {
|
|
||||||
kotlinOptions {
|
|
||||||
metaInfo = true
|
|
||||||
sourceMap = true
|
|
||||||
sourceMapEmbedSources = "always"
|
|
||||||
moduleKind = "commonjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(listOf(compilations["main"])) {
|
|
||||||
tasks.getByName(compileKotlinTaskName) {
|
|
||||||
kotlinOptions {
|
|
||||||
main = "call"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
val runJsTests by ext(false)
|
|
||||||
|
|
||||||
if(runJsTests) {
|
|
||||||
apply(plugin = "com.moowork.node")
|
|
||||||
configure<NodeExtension> {
|
|
||||||
nodeModulesDir = file("$buildDir/node_modules")
|
|
||||||
}
|
|
||||||
|
|
||||||
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
|
||||||
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
|
||||||
|
|
||||||
val populateNodeModules by tasks.registering(Copy::class) {
|
|
||||||
dependsOn(compileKotlinJs)
|
|
||||||
from(compileKotlinJs.destinationDir)
|
|
||||||
|
|
||||||
compilations["test"].runtimeDependencyFiles.forEach {
|
|
||||||
if (it.exists() && !it.isDirectory) {
|
|
||||||
from(zipTree(it.absolutePath).matching { include("*.js") })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
into("$buildDir/node_modules")
|
|
||||||
}
|
|
||||||
|
|
||||||
val installMocha by tasks.registering(NpmTask::class) {
|
|
||||||
setWorkingDir(buildDir)
|
|
||||||
setArgs(listOf("install", "mocha"))
|
|
||||||
}
|
|
||||||
|
|
||||||
val runMocha by tasks.registering(NodeTask::class) {
|
|
||||||
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
|
||||||
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
|
||||||
setArgs(listOf(compileTestKotlinJs.outputFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks["jsTest"].dependsOn(runMocha)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
|
|
||||||
val commonMain by getting {
|
|
||||||
dependencies {
|
|
||||||
api(kotlin("stdlib"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val commonTest by getting {
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("test-common"))
|
|
||||||
implementation(kotlin("test-annotations-common"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val jvmMain by getting {
|
|
||||||
dependencies {
|
|
||||||
api(kotlin("stdlib-jdk8"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val jvmTest by getting {
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("test"))
|
|
||||||
implementation(kotlin("test-junit"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val jsMain by getting {
|
|
||||||
dependencies {
|
|
||||||
api(kotlin("stdlib-js"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val jsTest by getting {
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("test-js"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
targets.all {
|
|
||||||
sourceSets.all {
|
|
||||||
languageSettings.progressiveMode = true
|
|
||||||
languageSettings.enableLanguageFeature("InlineClasses")
|
|
||||||
languageSettings.useExperimentalAnnotation("ExperimentalContracts")
|
|
||||||
//languageSettings.enableLanguageFeature("Contracts")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
|
||||||
|
|
||||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
|
||||||
if (publication.name == "kotlinMultiplatform") {
|
|
||||||
// for our root metadata publication, set artifactId with a package and project name
|
|
||||||
publication.artifactId = project.name
|
|
||||||
} else {
|
|
||||||
// for targets, set artifactId with a package, project name and target name (e.g. iosX64)
|
|
||||||
publication.artifactId = "${project.name}-${publication.name}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
targets.all {
|
|
||||||
val publication = publications.findByName(name) as MavenPublication
|
|
||||||
|
|
||||||
// Patch publications with fake javadoc
|
|
||||||
publication.artifact(stubJavadoc.get())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
18
buildSrc/build.gradle.kts
Normal file
18
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
val kotlinVersion = "1.3.30"
|
||||||
|
|
||||||
|
// Add plugins used in buildSrc as dependencies, also we should specify version only here
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||||
|
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.5")
|
||||||
|
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
||||||
|
implementation("com.moowork.gradle:gradle-node-plugin:1.3.1")
|
||||||
|
}
|
0
buildSrc/settings.gradle.kts
Normal file
0
buildSrc/settings.gradle.kts
Normal file
10
buildSrc/src/main/kotlin/Dep.kt
Normal file
10
buildSrc/src/main/kotlin/Dep.kt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Instead of defining runtime properties and use them dynamically
|
||||||
|
// define version in buildSrc and have autocompletion and compile-time check
|
||||||
|
// Also dependencies itself can be moved here
|
||||||
|
object Ver {
|
||||||
|
val ioVersion = "0.1.5"
|
||||||
|
val coroutinesVersion = "1.1.1"
|
||||||
|
val atomicfuVersion = "0.12.1"
|
||||||
|
// This version is not used and IDEA shows this property as unused
|
||||||
|
val dokkaVersion = "0.9.17"
|
||||||
|
}
|
38
buildSrc/src/main/kotlin/artifactory-config.gradle.kts
Normal file
38
buildSrc/src/main/kotlin/artifactory-config.gradle.kts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import groovy.lang.GroovyObject
|
||||||
|
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
|
||||||
|
import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.jfrog.artifactory")
|
||||||
|
}
|
||||||
|
|
||||||
|
artifactory {
|
||||||
|
val artifactoryUser: String? by project
|
||||||
|
val artifactoryPassword: String? by project
|
||||||
|
val artifactoryContextUrl = "http://npm.mipt.ru:8081/artifactory"
|
||||||
|
|
||||||
|
setContextUrl(artifactoryContextUrl)//The base Artifactory URL if not overridden by the publisher/resolver
|
||||||
|
publish(delegateClosureOf<PublisherConfig> {
|
||||||
|
repository(delegateClosureOf<GroovyObject> {
|
||||||
|
setProperty("repoKey", "gradle-dev-local")
|
||||||
|
setProperty("username", artifactoryUser)
|
||||||
|
setProperty("password", artifactoryPassword)
|
||||||
|
})
|
||||||
|
|
||||||
|
defaults(delegateClosureOf<GroovyObject>{
|
||||||
|
invokeMethod("publications", arrayOf("jvm", "js", "kotlinMultiplatform", "metadata"))
|
||||||
|
//TODO: This property is not available for ArtifactoryTask
|
||||||
|
//setProperty("publishBuildInfo", false)
|
||||||
|
setProperty("publishArtifacts", true)
|
||||||
|
setProperty("publishPom", true)
|
||||||
|
setProperty("publishIvy", false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
resolve(delegateClosureOf<ResolverConfig> {
|
||||||
|
repository(delegateClosureOf<GroovyObject> {
|
||||||
|
setProperty("repoKey", "gradle-dev")
|
||||||
|
setProperty("username", artifactoryUser)
|
||||||
|
setProperty("password", artifactoryPassword)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
97
buildSrc/src/main/kotlin/bintray-config.gradle.kts
Normal file
97
buildSrc/src/main/kotlin/bintray-config.gradle.kts
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
import com.jfrog.bintray.gradle.BintrayExtension.PackageConfig
|
||||||
|
import com.jfrog.bintray.gradle.BintrayExtension.VersionConfig
|
||||||
|
|
||||||
|
// Old bintray.gradle script converted to real Gradle plugin (precompiled script plugin)
|
||||||
|
// It now has own dependencies and support type safe accessors
|
||||||
|
// Syntax is pretty close to what we had in Groovy
|
||||||
|
// (excluding Property.set and bintray dynamic configs)
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.jfrog.bintray")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
val vcs = "https://github.com/mipt-npm/kmath"
|
||||||
|
|
||||||
|
// Configure publishing
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven("https://bintray.com/mipt-npm/scientifik")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process each publication we have in this project
|
||||||
|
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
||||||
|
|
||||||
|
// use type safe pom config GSL insterad of old dynamic
|
||||||
|
publication.pom {
|
||||||
|
name.set(project.name)
|
||||||
|
description.set(project.description)
|
||||||
|
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")
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
url.set(vcs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bintray {
|
||||||
|
// delegates for runtime properties
|
||||||
|
val bintrayUser: String? by project
|
||||||
|
val bintrayApiKey: String? by project
|
||||||
|
user = bintrayUser ?: System.getenv("BINTRAY_USER")
|
||||||
|
key = bintrayApiKey ?: System.getenv("BINTRAY_API_KEY")
|
||||||
|
publish = true
|
||||||
|
override = true // for multi-platform Kotlin/Native publishing
|
||||||
|
|
||||||
|
// We have to use delegateClosureOf because bintray supports only dynamic groovy syntax
|
||||||
|
// this is a problem of this plugin
|
||||||
|
pkg(delegateClosureOf<PackageConfig> {
|
||||||
|
userOrg = "mipt-npm"
|
||||||
|
repo = "scientifik"
|
||||||
|
name = "scientifik.kmath"
|
||||||
|
issueTrackerUrl = "https://github.com/mipt-npm/kmath/issues"
|
||||||
|
setLicenses("Apache-2.0")
|
||||||
|
vcsUrl = vcs
|
||||||
|
version(delegateClosureOf<VersionConfig> {
|
||||||
|
name = project.version.toString()
|
||||||
|
vcsTag = project.version.toString()
|
||||||
|
released = java.util.Date().toString()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
bintrayUpload {
|
||||||
|
dependsOn(publishToMavenLocal)
|
||||||
|
doFirst {
|
||||||
|
setPublications(project.publishing.publications
|
||||||
|
.filterIsInstance<MavenPublication>()
|
||||||
|
.filter { !it.name.contains("-test") && it.name != "kotlinMultiplatform" }
|
||||||
|
.map {
|
||||||
|
println("""Uploading artifact "${it.groupId}:${it.artifactId}:${it.version}" from publication "${it.name}""")
|
||||||
|
it.name //https://github.com/bintray/gradle-bintray-plugin/issues/256
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
49
buildSrc/src/main/kotlin/js-test.gradle.kts
Normal file
49
buildSrc/src/main/kotlin/js-test.gradle.kts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import com.moowork.gradle.node.npm.NpmTask
|
||||||
|
import com.moowork.gradle.node.task.NodeTask
|
||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.moowork.node")
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
node {
|
||||||
|
nodeModulesDir = file("$buildDir/node_modules")
|
||||||
|
}
|
||||||
|
|
||||||
|
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||||
|
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
||||||
|
|
||||||
|
val populateNodeModules by tasks.registering(Copy::class) {
|
||||||
|
dependsOn(compileKotlinJs)
|
||||||
|
from(compileKotlinJs.destinationDir)
|
||||||
|
|
||||||
|
kotlin.js().compilations["test"].runtimeDependencyFiles.forEach {
|
||||||
|
if (it.exists() && !it.isDirectory) {
|
||||||
|
from(zipTree(it.absolutePath).matching { include("*.js") })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
into("$buildDir/node_modules")
|
||||||
|
}
|
||||||
|
|
||||||
|
val installMocha by tasks.registering<NpmTask> {
|
||||||
|
setWorkingDir(buildDir)
|
||||||
|
setArgs(listOf("install", "mocha"))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline fun <reified T : Task> TaskContainer.registering(
|
||||||
|
crossinline action: T.() -> Unit
|
||||||
|
): RegisteringDomainObjectDelegateProviderWithTypeAndAction<TaskContainer, T> =
|
||||||
|
RegisteringDomainObjectDelegateProviderWithTypeAndAction.of(this, T::class, { action() })
|
||||||
|
|
||||||
|
|
||||||
|
val runMocha by tasks.registering(NodeTask::class) {
|
||||||
|
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
||||||
|
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
||||||
|
setArgs(listOf(compileTestKotlinJs.outputFile))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks["jsTest"].dependsOn(runMocha)
|
119
buildSrc/src/main/kotlin/multiplatform-config.gradle.kts
Normal file
119
buildSrc/src/main/kotlin/multiplatform-config.gradle.kts
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm {
|
||||||
|
compilations.all {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
js {
|
||||||
|
compilations.all {
|
||||||
|
kotlinOptions {
|
||||||
|
metaInfo = true
|
||||||
|
sourceMap = true
|
||||||
|
sourceMapEmbedSources = "always"
|
||||||
|
moduleKind = "commonjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compilations.named("main") {
|
||||||
|
kotlinOptions {
|
||||||
|
main = "call"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.invoke {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonTest {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-common"))
|
||||||
|
implementation(kotlin("test-annotations-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"jvmMain" {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-jdk8"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"jvmTest" {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test"))
|
||||||
|
implementation(kotlin("test-junit"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"jsMain" {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"jsTest" {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targets.all {
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.progressiveMode = true
|
||||||
|
languageSettings.enableLanguageFeature("InlineClasses")
|
||||||
|
languageSettings.useExperimentalAnnotation("ExperimentalContracts")
|
||||||
|
//languageSettings.enableLanguageFeature("Contracts")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create empty jar for sources classifier to satisfy maven requirements
|
||||||
|
tasks.register<Jar>("stubSources") {
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
//from(sourceSets.main.get().allSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create empty jar for javadoc classifier to satisfy maven requirements
|
||||||
|
val stubJavadoc by tasks.registering(Jar::class) {
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
|
||||||
|
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
||||||
|
if (publication.name == "kotlinMultiplatform") {
|
||||||
|
// for our root metadata publication, set artifactId with a package and project name
|
||||||
|
publication.artifactId = project.name
|
||||||
|
} else {
|
||||||
|
// for targets, set artifactId with a package, project name and target name (e.g. iosX64)
|
||||||
|
publication.artifactId = "${project.name}-${publication.name}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targets.all {
|
||||||
|
val publication = publications.findByName(name) as MavenPublication
|
||||||
|
|
||||||
|
// Patch publications with fake javadoc
|
||||||
|
publication.artifact(stubJavadoc.get())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply JS test configuration
|
||||||
|
val runJsTests by ext(false)
|
||||||
|
|
||||||
|
if (runJsTests) {
|
||||||
|
apply(plugin = "js-test")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
apply plugin: "com.jfrog.artifactory"
|
|
||||||
|
|
||||||
artifactory {
|
|
||||||
def artifactory_user = project.hasProperty('artifactoryUser') ? project.property('artifactoryUser') : ""
|
|
||||||
def artifactory_password = project.hasProperty('artifactoryPassword') ? project.property('artifactoryPassword') : ""
|
|
||||||
def artifactory_contextUrl = 'http://npm.mipt.ru:8081/artifactory'
|
|
||||||
|
|
||||||
contextUrl = artifactory_contextUrl //The base Artifactory URL if not overridden by the publisher/resolver
|
|
||||||
publish {
|
|
||||||
repository {
|
|
||||||
repoKey = 'gradle-dev-local'
|
|
||||||
username = artifactory_user
|
|
||||||
password = artifactory_password
|
|
||||||
}
|
|
||||||
|
|
||||||
defaults {
|
|
||||||
publications('jvm', 'js', 'kotlinMultiplatform', 'metadata')
|
|
||||||
publishBuildInfo = false
|
|
||||||
publishArtifacts = true
|
|
||||||
publishPom = true
|
|
||||||
publishIvy = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resolve {
|
|
||||||
repository {
|
|
||||||
repoKey = 'gradle-dev'
|
|
||||||
username = artifactory_user
|
|
||||||
password = artifactory_password
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
apply plugin: 'com.jfrog.bintray'
|
|
||||||
|
|
||||||
def vcs = "https://github.com/mipt-npm/kmath"
|
|
||||||
|
|
||||||
def pomConfig = {
|
|
||||||
licenses {
|
|
||||||
license {
|
|
||||||
name "The Apache Software License, Version 2.0"
|
|
||||||
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
||||||
distribution "repo"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
developers {
|
|
||||||
developer {
|
|
||||||
id "MIPT-NPM"
|
|
||||||
name "MIPT nuclear physics methods laboratory"
|
|
||||||
organization "MIPT"
|
|
||||||
organizationUrl "http://npm.mipt.ru"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scm {
|
|
||||||
url vcs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.ext.configureMavenCentralMetadata = { pom ->
|
|
||||||
def root = asNode()
|
|
||||||
root.appendNode('name', project.name)
|
|
||||||
root.appendNode('description', project.description)
|
|
||||||
root.appendNode('url', vcs)
|
|
||||||
root.children().last() + pomConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
project.ext.configurePom = pomConfig
|
|
||||||
|
|
||||||
|
|
||||||
// Configure publishing
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = "https://bintray.com/mipt-npm/scientifik"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process each publication we have in this project
|
|
||||||
publications.all { publication ->
|
|
||||||
// apply changes to pom.xml files, see pom.gradle
|
|
||||||
pom.withXml(configureMavenCentralMetadata)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bintray {
|
|
||||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
|
||||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
|
||||||
publish = true
|
|
||||||
override = true // for multi-platform Kotlin/Native publishing
|
|
||||||
|
|
||||||
pkg {
|
|
||||||
userOrg = "mipt-npm"
|
|
||||||
repo = "scientifik"
|
|
||||||
name = "scientifik.kmath"
|
|
||||||
issueTrackerUrl = "https://github.com/mipt-npm/kmath/issues"
|
|
||||||
licenses = ['Apache-2.0']
|
|
||||||
vcsUrl = vcs
|
|
||||||
version {
|
|
||||||
name = project.version
|
|
||||||
vcsTag = project.version
|
|
||||||
released = new Date()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bintrayUpload.dependsOn publishToMavenLocal
|
|
||||||
|
|
||||||
// This is for easier debugging of bintray uploading problems
|
|
||||||
bintrayUpload.doFirst {
|
|
||||||
publications = project.publishing.publications.findAll {
|
|
||||||
!it.name.contains('-test') && it.name != 'kotlinMultiplatform'
|
|
||||||
}.collect {
|
|
||||||
println("Uploading artifact '$it.groupId:$it.artifactId:$it.version' from publication '$it.name'")
|
|
||||||
it.name//https://github.com/bintray/gradle-bintray-plugin/issues/256
|
|
||||||
}
|
|
||||||
}
|
|
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-5.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -15,13 +15,13 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
val sourcesJar by tasks.registering(Jar::class) {
|
val sourcesJar by tasks.registering(Jar::class) {
|
||||||
classifier = "sources"
|
archiveClassifier.set("sources")
|
||||||
from(sourceSets.main.get().allSource)
|
from(sourceSets.main.get().allSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
register("jvm", MavenPublication::class) {
|
register<MavenPublication>("jvm") {
|
||||||
from(components["java"])
|
from(components["java"])
|
||||||
artifact(sourcesJar.get())
|
artifact(sourcesJar.get())
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ kotlin {
|
|||||||
js()
|
js()
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain by getting {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kmath-memory"))
|
api(project(":kmath-memory"))
|
||||||
}
|
}
|
||||||
|
@ -2,42 +2,40 @@ plugins {
|
|||||||
kotlin("multiplatform")
|
kotlin("multiplatform")
|
||||||
}
|
}
|
||||||
|
|
||||||
val coroutinesVersion: String by rootProject.extra
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm()
|
jvm()
|
||||||
js()
|
js()
|
||||||
|
|
||||||
sourceSets {
|
sourceSets.invoke {
|
||||||
val commonMain by getting {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutinesVersion")
|
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Ver.coroutinesVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val commonTest by getting {
|
commonTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
implementation(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jvmMain by getting {
|
"jvmMain" {
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Ver.coroutinesVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jvmTest by getting {
|
"jvmTest" {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test"))
|
implementation(kotlin("test"))
|
||||||
implementation(kotlin("test-junit"))
|
implementation(kotlin("test-junit"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsMain by getting {
|
"jsMain" {
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
|
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Ver.coroutinesVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsTest by getting {
|
"jsTest" {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-js"))
|
implementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
|
@ -6,26 +6,25 @@ kotlin {
|
|||||||
jvm()
|
jvm()
|
||||||
js()
|
js()
|
||||||
|
|
||||||
sourceSets {
|
sourceSets.invoke {
|
||||||
|
commonMain {
|
||||||
val commonMain by getting {
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val commonTest by getting {
|
commonTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-common"))
|
implementation(kotlin("test-common"))
|
||||||
implementation(kotlin("test-annotations-common"))
|
implementation(kotlin("test-annotations-common"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jvmTest by getting {
|
"jvmTest" {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test"))
|
implementation(kotlin("test"))
|
||||||
implementation(kotlin("test-junit"))
|
implementation(kotlin("test-junit"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsTest by getting {
|
"jsTest" {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-js"))
|
implementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api project(":kmath-core")
|
api project(":kmath-core")
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||||
api "org.jetbrains.kotlinx:kotlinx-io:$ioVersion"
|
api "org.jetbrains.kotlinx:kotlinx-io:${Ver.ioVersion}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commonTest {
|
commonTest {
|
||||||
@ -28,7 +28,7 @@ kotlin {
|
|||||||
jvmMain {
|
jvmMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||||
api "org.jetbrains.kotlinx:kotlinx-io-jvm:$ioVersion"
|
api "org.jetbrains.kotlinx:kotlinx-io-jvm:${Ver.ioVersion}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmTest {
|
jvmTest {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform")
|
kotlin("multiplatform")
|
||||||
id("kotlinx-atomicfu") version "0.12.4"
|
id("kotlinx-atomicfu")
|
||||||
}
|
}
|
||||||
|
|
||||||
val atomicfuVersion: String by rootProject.extra
|
val atomicfuVersion: String by rootProject.extra
|
||||||
@ -14,17 +14,17 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
api(project(":kmath-coroutines"))
|
api(project(":kmath-coroutines"))
|
||||||
compileOnly("org.jetbrains.kotlinx:atomicfu-common:$atomicfuVersion")
|
compileOnly("org.jetbrains.kotlinx:atomicfu-common:${Ver.atomicfuVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains.kotlinx:atomicfu:$atomicfuVersion")
|
compileOnly("org.jetbrains.kotlinx:atomicfu:${Ver.atomicfuVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsMain by getting {
|
val jsMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains.kotlinx:atomicfu-js:$atomicfuVersion")
|
compileOnly("org.jetbrains.kotlinx:atomicfu-js:${Ver.atomicfuVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,9 @@ pluginManagement {
|
|||||||
eachPlugin {
|
eachPlugin {
|
||||||
when (requested.id.id) {
|
when (requested.id.id) {
|
||||||
"kotlinx-atomicfu" -> {
|
"kotlinx-atomicfu" -> {
|
||||||
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
|
// Just hardcode version here,
|
||||||
}
|
// because anyway different submodules cannot use different versions
|
||||||
"kotlin-multiplatform" ->{
|
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.12.1")
|
||||||
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user