forked from kscience/kmath
Updated build script
This commit is contained in:
parent
1af0ed4b91
commit
4065fda99a
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.gradle
|
.gradle
|
||||||
**/build/
|
build/
|
||||||
/.idea/
|
out/
|
||||||
|
.idea/
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -12,7 +12,7 @@ fun main() {
|
|||||||
val l = Matrix.real(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 }
|
val l = Matrix.real(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 }
|
||||||
val matrix = l dot u
|
val matrix = l dot u
|
||||||
|
|
||||||
val n = 500 // iterations
|
val n = 5000 // iterations
|
||||||
|
|
||||||
val solver = LUSolver.real
|
val solver = LUSolver.real
|
||||||
|
|
||||||
|
225
build.gradle.kts
225
build.gradle.kts
@ -1,4 +1,9 @@
|
|||||||
|
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.dsl.KotlinMultiplatformExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
val kotlinVersion: String by rootProject.extra("1.3.21")
|
val kotlinVersion: String by rootProject.extra("1.3.21")
|
||||||
@ -6,10 +11,11 @@ buildscript {
|
|||||||
val coroutinesVersion: String by rootProject.extra("1.1.1")
|
val coroutinesVersion: String by rootProject.extra("1.1.1")
|
||||||
val atomicfuVersion: String by rootProject.extra("0.12.1")
|
val atomicfuVersion: String by rootProject.extra("0.12.1")
|
||||||
val dokkaVersion: String by rootProject.extra("0.9.17")
|
val dokkaVersion: String by rootProject.extra("0.9.17")
|
||||||
|
val serializationVersion: String by rootProject.extra("0.10.0")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
//maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -17,94 +23,199 @@ buildscript {
|
|||||||
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4+")
|
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4+")
|
||||||
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
||||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
|
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 {
|
plugins {
|
||||||
id("com.jfrog.artifactory") version "4.9.1" apply false
|
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.0")
|
val kmathVersion by extra("0.1.2-dev-1")
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "scientifik"
|
|
||||||
version = kmathVersion
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
//maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(plugin = "maven")
|
apply(plugin = "maven")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
|
||||||
// apply bintray configuration
|
repositories {
|
||||||
apply(from = "${rootProject.rootDir}/gradle/bintray.gradle")
|
jcenter()
|
||||||
|
maven("https://kotlin.bintray.com/kotlinx")
|
||||||
//apply artifactory configuration
|
}
|
||||||
apply(from = "${rootProject.rootDir}/gradle/artifactory.gradle")
|
group = "scientifik"
|
||||||
|
version = kmathVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
if (!name.startsWith("kmath")) return@subprojects
|
if(name.startsWith("kmath")) {
|
||||||
|
// apply bintray configuration
|
||||||
|
apply(from = "${rootProject.rootDir}/gradle/bintray.gradle")
|
||||||
|
|
||||||
|
//apply artifactory configuration
|
||||||
|
apply(from = "${rootProject.rootDir}/gradle/artifactory.gradle")
|
||||||
|
}
|
||||||
|
// dokka {
|
||||||
|
// outputFormat = "html"
|
||||||
|
// outputDirectory = javadoc.destinationDir
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// task dokkaJar (type: Jar, dependsOn: dokka) {
|
||||||
|
// from javadoc . destinationDir
|
||||||
|
// classifier = "javadoc"
|
||||||
|
// }
|
||||||
|
|
||||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
// Create empty jar for sources classifier to satisfy maven requirements
|
||||||
jvm {
|
val stubSources by tasks.registering(Jar::class) {
|
||||||
compilations.all {
|
archiveClassifier.set("sources")
|
||||||
kotlinOptions {
|
//from(sourceSets.main.get().allSource)
|
||||||
jvmTarget = "1.8"
|
}
|
||||||
}
|
|
||||||
}
|
// Create empty jar for javadoc classifier to satisfy maven requirements
|
||||||
}
|
val stubJavadoc by tasks.registering(Jar::class) {
|
||||||
targets.all {
|
archiveClassifier.set("javadoc")
|
||||||
sourceSets.all {
|
}
|
||||||
languageSettings.progressiveMode = true
|
|
||||||
}
|
tasks.withType<KotlinCompile> {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extensions.findByType<PublishingExtension>()?.apply {
|
afterEvaluate {
|
||||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
||||||
if (publication.name == "kotlinMultiplatform") {
|
jvm {
|
||||||
// for our root metadata publication, set artifactId with a package and project name
|
compilations.all {
|
||||||
publication.artifactId = project.name
|
kotlinOptions {
|
||||||
} else {
|
jvmTarget = "1.8"
|
||||||
// for targets, set artifactId with a package, project name and target name (e.g. iosX64)
|
}
|
||||||
publication.artifactId = "${project.name}-${publication.name}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create empty jar for sources classifier to satisfy maven requirements
|
js {
|
||||||
val stubSources by tasks.registering(Jar::class) {
|
compilations.all {
|
||||||
archiveClassifier.set("sources")
|
tasks.getByName(compileKotlinTaskName) {
|
||||||
//from(sourceSets.main.get().allSource)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create empty jar for javadoc classifier to satisfy maven requirements
|
sourceSets {
|
||||||
val stubJavadoc by tasks.registering(Jar::class) {
|
|
||||||
archiveClassifier.set("javadoc")
|
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"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
targets.all {
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.progressiveMode = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
targets.forEach { target ->
|
configure<PublishingExtension> {
|
||||||
val publication = publications.findByName(target.name) as MavenPublication
|
|
||||||
|
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
|
// Patch publications with fake javadoc
|
||||||
publication.artifact(stubJavadoc)
|
publication.artifact(stubJavadoc.get())
|
||||||
|
|
||||||
// Remove gradle metadata publishing from all targets which are not native
|
|
||||||
// if (target.platformType.name != "native") {
|
|
||||||
// publication.gradleModuleMetadataFile = null
|
|
||||||
// tasks.matching { it.name == "generateMetadataFileFor${name.capitalize()}Publication" }.all {
|
|
||||||
// onlyIf { false }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -10,6 +10,9 @@ pluginManagement {
|
|||||||
"kotlinx-atomicfu" -> {
|
"kotlinx-atomicfu" -> {
|
||||||
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
|
useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
|
||||||
}
|
}
|
||||||
|
"kotlin-multiplatform" ->{
|
||||||
|
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user