From 6464d9d926043b4e8ed5af0c4ef27c64f0934f59 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 20 Aug 2020 10:02:28 +0300 Subject: [PATCH] Migrate to kScience and kotlin 1.4 --- build.gradle.kts | 49 ++++++---- gradle/wrapper/gradle-wrapper.jar | Bin 58910 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- gradlew.bat | 21 +--- src/main/kotlin/Scientifik.kt | 18 ---- .../ru/mipt/npm/gradle/KScienceExtension.kt | 65 +++++++++++++ .../mipt/npm/gradle/KScienceJSPlugin.kt} | 14 ++- .../mipt/npm/gradle/KScienceJVMPlugin.kt} | 40 +++----- .../mipt/npm/gradle/KScienceMPPlugin.kt} | 65 +++---------- .../mipt/npm/gradle/KScienceNativePlugin.kt | 33 +++++++ .../ru/mipt/npm/gradle/KScienceNodePlugin.kt | 28 ++++++ .../mipt/npm/gradle/KSciencePublishPlugin.kt} | 17 ++-- .../ru/mipt/npm/gradle/KScienceVersions.kt | 20 ++++ .../mipt/npm/gradle}/common.kt | 7 +- .../mipt/npm/gradle}/extensions.kt | 74 ++++++++------ .../{scientifik => ru/mipt/npm/gradle}/fx.kt | 2 +- .../ru/mipt/npm/gradle/serialization.kt | 65 +++++++++++++ .../scientifik/ScientifikNativePlugin.kt | 38 -------- src/main/kotlin/scientifik/serialization.kt | 90 ------------------ 20 files changed, 340 insertions(+), 310 deletions(-) delete mode 100644 src/main/kotlin/Scientifik.kt create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt rename src/main/kotlin/{scientifik/ScientifikJSPlugin.kt => ru/mipt/npm/gradle/KScienceJSPlugin.kt} (86%) rename src/main/kotlin/{scientifik/ScientifikJVMPlugin.kt => ru/mipt/npm/gradle/KScienceJVMPlugin.kt} (66%) rename src/main/kotlin/{scientifik/ScientifikMPPlugin.kt => ru/mipt/npm/gradle/KScienceMPPlugin.kt} (58%) create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KScienceNodePlugin.kt rename src/main/kotlin/{scientifik/ScientifikPublishPlugin.kt => ru/mipt/npm/gradle/KSciencePublishPlugin.kt} (90%) create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt rename src/main/kotlin/{scientifik => ru/mipt/npm/gradle}/common.kt (97%) rename src/main/kotlin/{scientifik => ru/mipt/npm/gradle}/extensions.kt (54%) rename src/main/kotlin/{scientifik => ru/mipt/npm/gradle}/fx.kt (98%) create mode 100644 src/main/kotlin/ru/mipt/npm/gradle/serialization.kt delete mode 100644 src/main/kotlin/scientifik/ScientifikNativePlugin.kt delete mode 100644 src/main/kotlin/scientifik/serialization.kt diff --git a/build.gradle.kts b/build.gradle.kts index 4275de1..51bfc16 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,8 +7,8 @@ plugins { id("org.jetbrains.changelog") version "0.3.2" } -group = "scientifik" -version = "0.5.2" +group = "ru.mipt.npm" +version = "0.6.0" repositories { gradlePluginPortal() @@ -17,7 +17,7 @@ repositories { maven("https://dl.bintray.com/kotlin/kotlin-eap") } -val kotlinVersion = "1.3.72" +val kotlinVersion = "1.4.0" java { targetCompatibility = JavaVersion.VERSION_1_8 @@ -27,34 +27,47 @@ java { dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") - implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.3") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1") + implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.4") + implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.0-rc") + implementation("org.jetbrains.dokka:dokka-core:1.4.0-rc") } gradlePlugin { plugins { - create("scientifik-publish") { - id = "scientifik.publish" + create("kscience-publish") { + id = "kscience.publish" description = "The publication plugin for bintray and github" - implementationClass = "scientifik.ScientifikPublishPlugin" + implementationClass = "ru.mipt.npm.gradle.KSciencePublishPlugin" } - create("scientifik-mpp") { - id = "scientifik.mpp" + create("kscience.mpp") { + id = "kscience.mpp" description = "Pre-configured multiplatform project" - implementationClass = "scientifik.ScientifikMPPlugin" + implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin" } - create("scientifik-jvm") { - id = "scientifik.jvm" + create("kscience.jvm") { + id = "kscience.jvm" description = "Pre-configured JVM project" - implementationClass = "scientifik.ScientifikJVMPlugin" + implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin" } - create("scientifik-js") { - id = "scientifik.js" + create("kscience.js") { + id = "kscience.js" description = "Pre-configured JS project" - implementationClass = "scientifik.ScientifikJSPlugin" + implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin" + } + + create("kscience.native") { + id = "kscience.native" + description = "Additional native targets to be use alongside mpp" + implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin" + } + + create("kscience.node") { + id = "kscience.node" + description = "NodeJS target for kotlin-mpp and kotlin-js" + implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin" } } } @@ -106,7 +119,7 @@ publishing { // this is a problem of this plugin pkg.apply { userOrg = "mipt-npm" - repo = if (project.version.toString().contains("dev")) "dev" else "scientifik" + repo = if (project.version.toString().contains("dev")) "dev" else "kscience" name = project.name issueTrackerUrl = "$vcs/issues" setLicenses("Apache-2.0") diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053550b91381bbd28b1afc82d634bf73a8a..e708b1c023ec8b20f512888fe07c5bd3ff77bb8f 100644 GIT binary patch delta 6656 zcmY+Ibx_pN*Z*PZ4(U#j1qtbvrOTyO8fghZ8kYJfEe%U|$dV!@ASKczEZq$fg48M@ z;LnHO_j#Uq?%bL4dY^md%$$4Y+&@nKC|1uHR&59YNhubGh72|a#ylPdh9V+akp|I; zPk^W-a00GrFMkz_NSADdv2G2-i6rb=cB_@WnG(**4ZO$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hnBI4R12q6ews$lA`Jfi}r@A@-)6TOAUMNYFYJ zZ-Zd?lxFTyjN3mXnL!%#>Z%$0gJ4*9g;e;@zSmQ{eGGDaRRNM3s@6!;hYuVc=c+3B z=qzNNS~n^EsJU4aOGE|mdy={C^lPKEfPL-IJAsTpQsDgZ@~s+eHZYmp9yb=YW_4r?lqQaYZQ`nau){W`LY#P)>i zq^wHEuOYs#FlPZeMuT@Etb@~A6feCebq`miJE3w+gAL%bVF_s*5e*@)?xmKSo%I3? zLELHVdWia$}~s6 zr!^LfxSSB4Td&9iTXrzQpl5ZDo#SdmNr;23QsPHQ!x!UT9xtb!Ycz^JF8x)%cFOXK z^EXw%dRz_VD}7?RU^4{)1+xFO=z!EI8IUa3U*rag=1BpHX$Xi<__kSbS{y_xa*MJv z_`thq0Z^sPzjAk48ssDQj}!$N8Q$XC84(bU$t_Bm69Jf+C!h_}ep zwzpQj9sRA94<{x3{~z&ix-DwX;RAzka)4-#6ZHJqKh|SVuO|>Yrv+m30+!|sK<-|E z=)5E->#y<_1V|T1f%Af!ZYqXg}`O zI$qKOWdnclF`%_Z`WGOe{`A`l-#a?s=Q1a#@BOWmExH2;Wl`OB!B-%lq3nO{4=WO& z#k_x|N&(qzm*6S{G*|GCegF2N2ulC+(58z2DG~yUs}i8zvRf&$CJCaexJ6Xu!`qz( z)*v8*kAE#D0KCo*s{8^Rbg=`*E2MzeIt0|x55%n-gO&yX#$l=3W7-_~&(G8j1E(XB hw}tl`5K!1C(72%nnjQrp<7@!WCh47rWB+@R{{wClNUHz< diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc..6c9a224 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c51..4f906e0 100644 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 5093609..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/kotlin/Scientifik.kt b/src/main/kotlin/Scientifik.kt deleted file mode 100644 index 31b9450..0000000 --- a/src/main/kotlin/Scientifik.kt +++ /dev/null @@ -1,18 +0,0 @@ -import org.gradle.api.JavaVersion - -/** - * Build constants - */ -object Scientifik { - const val coroutinesVersion = "1.3.7" - const val serializationVersion = "0.20.0" - const val atomicVersion = "0.14.3" - - val JVM_TARGET = JavaVersion.VERSION_1_8 - - object Serialization{ - const val xmlVersion = "0.20.0.1" - const val yamlVersion = "0.16.1" - const val bsonVersion = "0.2.1" - } -} diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt new file mode 100644 index 0000000..c801afd --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt @@ -0,0 +1,65 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.extra +import org.gradle.kotlin.dsl.findPlugin +import org.gradle.kotlin.dsl.provideDelegate + +class KScienceExtension(val project: Project) { + + fun useCoroutines( + version: String = KScienceVersions.coroutinesVersion, + sourceSet: DependencySourceSet = DependencySourceSet.MAIN, + configuration: DependencyConfiguration = DependencyConfiguration.API + ): Unit = project.useCommonDependency( + "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + + fun useAtomic(version: String = KScienceVersions.atomicVersion): Unit = project.run { + plugins.apply("kotlinx-atomicfu") + useCommonDependency( + "org.jetbrains.kotlinx:atomicfu:$version" + ) + } + + fun useSerialization( + version: String = KScienceVersions.serializationVersion, + sourceSet: DependencySourceSet = DependencySourceSet.MAIN, + configuration: DependencyConfiguration = DependencyConfiguration.API, + block: SerializationTargets.() -> Unit = {} + ): Unit = project.run { + plugins.apply("org.jetbrains.kotlin.plugin.serialization") + useCommonDependency( + "org.jetbrains.kotlinx:kotlinx-serialization-core:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + SerializationTargets(sourceSet, configuration).apply(block) + } + + /** + * Activate publishing and configure it + */ + fun publishing(block: Publishing.() -> Unit) = Publishing().apply(block) + + inner class Publishing { + init { + if (project.plugins.findPlugin(KSciencePublishPlugin::class) == null) { + project.plugins.apply(KSciencePublishPlugin::class) + } + } + + var githubOrg: String? by project.extra + var githubProject: String? by project.extra + var spaceRepo: String? by project.extra + var spaceUser: String? by project.extra + var spaceToken: String? by project.extra + var bintrayOrg: String? by project.extra + var bintrayUser: String? by project.extra + var bintrayApiKey: String? by project.extra + var bintrayRepo: String? by project.extra + } +} \ No newline at end of file diff --git a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJSPlugin.kt similarity index 86% rename from src/main/kotlin/scientifik/ScientifikJSPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KScienceJSPlugin.kt index 234b5eb..0813c27 100644 --- a/src/main/kotlin/scientifik/ScientifikJSPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJSPlugin.kt @@ -1,4 +1,4 @@ -package scientifik +package ru.mipt.npm.gradle import org.gradle.api.Plugin import org.gradle.api.Project @@ -9,14 +9,16 @@ import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.getting import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension -open class ScientifikJSPlugin : Plugin { +open class KScienceJSPlugin : Plugin { override fun apply(project: Project): Unit = project.run { plugins.apply("org.jetbrains.kotlin.js") + val extension = extensions.add("kscience", KScienceExtension(this)) repositories.applyRepos() configure { - target { + explicitApiWarning() + js(IR) { browser { webpackTask { outputFileName = "main.bundle.js" @@ -47,18 +49,14 @@ open class ScientifikJSPlugin : Plugin { val processResources by getting(Copy::class) processResources.copyJSResources(configurations["runtimeClasspath"]) - val browserDistribution by getting { + findByName("jsBrowserDistribution")?.apply { doLast { val indexFile = project.jsDistDirectory.resolve("index.html") if (indexFile.exists()) { println("Run JS distribution at: ${indexFile.canonicalPath}") } } - group = "distribution" } - -// findByName("assemble")?.dependsOn(installJsDist) - } } diff --git a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt similarity index 66% rename from src/main/kotlin/scientifik/ScientifikJVMPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt index 64b407e..697361b 100644 --- a/src/main/kotlin/scientifik/ScientifikJVMPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceJVMPlugin.kt @@ -1,9 +1,7 @@ -package scientifik +package ru.mipt.npm.gradle -import Scientifik import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication @@ -15,36 +13,33 @@ import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -open class ScientifikJVMPlugin : Plugin { +open class KScienceJVMPlugin : Plugin { override fun apply(project: Project): Unit = project.run { plugins.apply("org.jetbrains.kotlin.jvm") + val extension = extensions.add("kscience", KScienceExtension(this)) repositories.applyRepos() extensions.findByType()?.apply { - targetCompatibility = Scientifik.JVM_TARGET + targetCompatibility = KScienceVersions.JVM_TARGET } tasks.withType { kotlinOptions { - jvmTarget = Scientifik.JVM_TARGET.toString() + useIR = true + jvmTarget = KScienceVersions.JVM_TARGET.toString() } } configure { - + explicitApiWarning() val sourceSet = sourceSets["main"].apply { languageSettings.applySettings() - dependencies { - api(kotlin("stdlib-jdk8")) - } } sourceSets["test"].apply { languageSettings.applySettings() dependencies { - implementation(kotlin("test")) -// implementation(kotlin("test-junit")) implementation(kotlin("test-junit5")) implementation("org.junit.jupiter:junit-jupiter:5.6.1") } @@ -69,23 +64,10 @@ open class ScientifikJVMPlugin : Plugin { pluginManager.withPlugin("org.jetbrains.dokka") { logger.info("Adding dokka functionality to project ${project.name}") - val dokka by tasks.getting(DokkaTask::class) { - outputFormat = "html" - outputDirectory = "$buildDir/javadoc" - } - - val kdocJar by tasks.registering(Jar::class) { - group = JavaBasePlugin.DOCUMENTATION_GROUP - dependsOn(dokka) - archiveClassifier.set("javadoc") - from("$buildDir/javadoc") - } - - configure { - publications { - getByName("jvm") { - this as MavenPublication - artifact(kdocJar.get()) + val dokkaHtml by tasks.getting(DokkaTask::class){ + dokkaSourceSets { + configureEach { + jdkVersion = 11 } } } diff --git a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt similarity index 58% rename from src/main/kotlin/scientifik/ScientifikMPPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt index d72bf69..87b39db 100644 --- a/src/main/kotlin/scientifik/ScientifikMPPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt @@ -1,36 +1,34 @@ -package scientifik +package ru.mipt.npm.gradle -import Scientifik import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.plugins.JavaBasePlugin -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.Copy -import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.testing.Test import org.gradle.kotlin.dsl.* import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension -open class ScientifikMPPlugin : Plugin { +open class KScienceMPPlugin : Plugin { override fun apply(project: Project): Unit = project.run { plugins.apply("org.jetbrains.kotlin.multiplatform") + val extension = extensions.add("kscience", KScienceExtension(this)) repositories.applyRepos() configure { + explicitApiWarning() jvm { compilations.all { kotlinOptions { - jvmTarget = Scientifik.JVM_TARGET.toString() + useIR = true + jvmTarget = KScienceVersions.JVM_TARGET.toString() } } } - val js = js { + js(IR) { browser { webpackTask { outputFileName = "main.bundle.js" @@ -42,35 +40,21 @@ open class ScientifikMPPlugin : Plugin { } sourceSets.invoke { - val commonMain by getting { - dependencies { - api(kotlin("stdlib")) - } - } + val commonMain by getting val commonTest by getting { dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) } } - val jvmMain by getting { - dependencies { - api(kotlin("stdlib-jdk8")) - } - } + val jvmMain by getting val jvmTest by getting { dependencies { - implementation(kotlin("test")) -// implementation(kotlin("test-junit")) implementation(kotlin("test-junit5")) implementation("org.junit.jupiter:junit-jupiter:5.6.1") } } - val jsMain by getting { - dependencies { - api(kotlin("stdlib-js")) - } - } + val jsMain by getting val jsTest by getting { dependencies { implementation(kotlin("test-js")) @@ -86,29 +70,11 @@ open class ScientifikMPPlugin : Plugin { pluginManager.withPlugin("org.jetbrains.dokka") { logger.info("Adding dokka functionality to project ${this@run.name}") - val dokka by tasks.getting(DokkaTask::class) { - outputFormat = "html" - outputDirectory = "$buildDir/javadoc" - multiplatform { - } - } - - val kdocJar by tasks.registering(Jar::class) { - group = JavaBasePlugin.DOCUMENTATION_GROUP - dependsOn(dokka) - archiveClassifier.set("javadoc") - from("$buildDir/javadoc") - } - - pluginManager.withPlugin("maven-publish") { - configure { - - targets.all { - val publication = publications.findByName(name) as MavenPublication - - // Patch publications with fake javadoc - publication.artifact(kdocJar.get()) + val dokkaHtml by tasks.getting(DokkaTask::class) { + dokkaSourceSets { + configureEach { + jdkVersion = 11 } } } @@ -125,14 +91,13 @@ open class ScientifikMPPlugin : Plugin { val jvmProcessResources by getting(Copy::class) jvmProcessResources.copyJVMResources(configurations["jvmRuntimeClasspath"]) - val jsBrowserDistribution by getting { + findByName("jsBrowserDistribution")?.apply { doLast { val indexFile = project.jsDistDirectory.resolve("index.html") if (indexFile.exists()) { println("Run JS distribution at: ${indexFile.canonicalPath}") } } - group = "distribution" } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt new file mode 100644 index 0000000..62be06f --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNativePlugin.kt @@ -0,0 +1,33 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.GradleException +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.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension + +class KScienceNativePlugin : Plugin { + override fun apply(target: Project) = target.run { + if (plugins.findPlugin(KScienceMPPlugin::class) == null) { + pluginManager.apply(KScienceMPPlugin::class) + } + configure { + val hostOs = System.getProperty("os.name") + val isMingwX64 = hostOs.startsWith("Windows") + + val nativeTarget = when { + hostOs == "Mac OS X" -> macosX64("native") + hostOs == "Linux" -> linuxX64("native") + isMingwX64 -> mingwX64("native") + else -> throw GradleException("Host OS is not supported in Kotlin/Native.") + } +// +// sourceSets { +// val nativeMain by getting +// val nativeTest by getting +// } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceNodePlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNodePlugin.kt new file mode 100644 index 0000000..bba5346 --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceNodePlugin.kt @@ -0,0 +1,28 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension + +class KScienceNodePlugin : Plugin { + override fun apply(target: Project) = target.run{ + pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { + configure { + js { + nodejs() + } + } + } + + pluginManager.withPlugin("org.jetbrains.kotlin.js") { + configure { + js { + nodejs() + } + } + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/scientifik/ScientifikPublishPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt similarity index 90% rename from src/main/kotlin/scientifik/ScientifikPublishPlugin.kt rename to src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt index 3860570..9c4dad2 100644 --- a/src/main/kotlin/scientifik/ScientifikPublishPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KSciencePublishPlugin.kt @@ -1,4 +1,4 @@ -package scientifik +package ru.mipt.npm.gradle import org.gradle.api.Plugin import org.gradle.api.Project @@ -9,16 +9,17 @@ import org.gradle.kotlin.dsl.provideDelegate import org.gradle.kotlin.dsl.withType -open class ScientifikPublishPlugin : Plugin { +open class KSciencePublishPlugin : Plugin { override fun apply(project: Project) { project.plugins.apply("maven-publish") project.afterEvaluate { - val githubProject = findProperty("githubProject") as? String + val githubOrg: String = project.findProperty("githubOrg") as? String ?: "mipt-npm" + val githubProject: String? by project val vcs = findProperty("vcs") as? String - ?: githubProject?.let { "https://github.com/mipt-npm/$it" } + ?: githubProject?.let { "https://github.com/$githubOrg/$it" } if (vcs == null) { project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.") @@ -95,8 +96,8 @@ open class ScientifikPublishPlugin : Plugin { } val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm" - val bintrayUser = project.findProperty("bintrayUser") as? String - val bintrayKey = project.findProperty("bintrayApiKey") as? String + val bintrayUser: String? by project + val bintrayApiKey: String? by project val bintrayRepo = if (project.version.toString().contains("dev")) { @@ -107,7 +108,7 @@ open class ScientifikPublishPlugin : Plugin { val projectName = project.name - if (bintrayRepo != null && bintrayUser != null && bintrayKey != null) { + if (bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) { project.logger.info("Adding bintray publishing to project [$projectName]") repositories { @@ -118,7 +119,7 @@ open class ScientifikPublishPlugin : Plugin { ) credentials { username = bintrayUser - password = bintrayKey + password = bintrayApiKey } } } diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt new file mode 100644 index 0000000..aef8579 --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceVersions.kt @@ -0,0 +1,20 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.JavaVersion + +/** + * Build constants + */ +object KScienceVersions { + const val coroutinesVersion = "1.3.9" + const val serializationVersion = "1.0.0-RC" + const val atomicVersion = "0.14.4" + + val JVM_TARGET = JavaVersion.VERSION_11 + + object Serialization{ + const val xmlVersion = "0.20.0.1" + const val yamlVersion = "0.16.1" + const val bsonVersion = "0.2.1" + } +} diff --git a/src/main/kotlin/scientifik/common.kt b/src/main/kotlin/ru/mipt/npm/gradle/common.kt similarity index 97% rename from src/main/kotlin/scientifik/common.kt rename to src/main/kotlin/ru/mipt/npm/gradle/common.kt index 99eace0..1bb9213 100644 --- a/src/main/kotlin/scientifik/common.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/common.kt @@ -1,4 +1,4 @@ -package scientifik +package ru.mipt.npm.gradle import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -23,9 +23,10 @@ internal fun RepositoryHandler.applyRepos(): Unit { jcenter() maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://kotlin.bintray.com/kotlinx") - maven("https://dl.bintray.com/mipt-npm/scientifik") - maven("https://dl.bintray.com/mipt-npm/dev") maven("https://kotlin.bintray.com/kotlin-js-wrappers/") + maven("https://dl.bintray.com/mipt-npm/scientifik") + maven("https://dl.bintray.com/mipt-npm/kscience") + maven("https://dl.bintray.com/mipt-npm/dev") maven("https://dl.bintray.com/mipt-npm/dataforge") } diff --git a/src/main/kotlin/scientifik/extensions.kt b/src/main/kotlin/ru/mipt/npm/gradle/extensions.kt similarity index 54% rename from src/main/kotlin/scientifik/extensions.kt rename to src/main/kotlin/ru/mipt/npm/gradle/extensions.kt index 002f397..4dcea9b 100644 --- a/src/main/kotlin/scientifik/extensions.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/extensions.kt @@ -1,6 +1,5 @@ -package scientifik +package ru.mipt.npm.gradle -import Scientifik import kotlinx.atomicfu.plugin.gradle.sourceSets import org.gradle.api.Project import org.gradle.kotlin.dsl.findByType @@ -33,7 +32,7 @@ internal fun Project.useDependency( when (dependencyConfiguration) { DependencyConfiguration.API -> api(dep) DependencyConfiguration.IMPLEMENTATION -> implementation(dep) - DependencyConfiguration.COMPILE_ONLY-> compileOnly(dep) + DependencyConfiguration.COMPILE_ONLY -> compileOnly(dep) } } } @@ -49,7 +48,7 @@ internal fun Project.useDependency( val configurationName = when (dependencyConfiguration) { DependencyConfiguration.API -> apiConfigurationName DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName - DependencyConfiguration.COMPILE_ONLY-> compileOnlyConfigurationName + DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName } add(configurationName, dep.second) } @@ -64,7 +63,7 @@ internal fun Project.useDependency( val configurationName = when (dependencyConfiguration) { DependencyConfiguration.API -> apiConfigurationName DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName - DependencyConfiguration.COMPILE_ONLY-> compileOnlyConfigurationName + DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName } add(configurationName, dep.second) } @@ -73,25 +72,46 @@ internal fun Project.useDependency( } } -fun Project.useCoroutines( - version: String = Scientifik.coroutinesVersion, - sourceSet: DependencySourceSet = DependencySourceSet.MAIN, - configuration: DependencyConfiguration = DependencyConfiguration.API -) = useDependency( - "common" to "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$version", - "jvm" to "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version", - "js" to "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$version", - "native" to "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration -) - -fun Project.useAtomic(version: String = Scientifik.atomicVersion) { - plugins.apply("kotlinx-atomicfu") - useDependency( - "commonMain" to "org.jetbrains.kotlinx:atomicfu-common:$version", - "jvmMain" to "org.jetbrains.kotlinx:atomicfu:$version", - "jsMain" to "org.jetbrains.kotlinx:atomicfu-js:$version", - "nativeMain" to "org.jetbrains.kotlinx:atomicfu-native:$version" - ) -} +internal fun Project.useCommonDependency( + dep: String, + dependencySourceSet: DependencySourceSet = DependencySourceSet.MAIN, + dependencyConfiguration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION +): Unit = pluginManager.run{ + withPlugin("org.jetbrains.kotlin.multiplatform"){ + extensions.findByType()?.apply { + sourceSets.findByName("common${dependencySourceSet.suffix}")?.apply { + dependencies { + when (dependencyConfiguration) { + DependencyConfiguration.API -> api(dep) + DependencyConfiguration.IMPLEMENTATION -> implementation(dep) + DependencyConfiguration.COMPILE_ONLY -> compileOnly(dep) + } + } + } + } + } + withPlugin("org.jetbrains.kotlin.jvm") { + sourceSets.findByName(dependencySourceSet.setName)?.apply { + dependencies.apply { + val configurationName = when (dependencyConfiguration) { + DependencyConfiguration.API -> apiConfigurationName + DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName + DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName + } + add(configurationName, dep) + } + } + } + withPlugin("org.jetbrains.kotlin.js") { + sourceSets.findByName(dependencySourceSet.setName)?.apply { + dependencies.apply { + val configurationName = when (dependencyConfiguration) { + DependencyConfiguration.API -> apiConfigurationName + DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName + DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName + } + add(configurationName, dep) + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/scientifik/fx.kt b/src/main/kotlin/ru/mipt/npm/gradle/fx.kt similarity index 98% rename from src/main/kotlin/scientifik/fx.kt rename to src/main/kotlin/ru/mipt/npm/gradle/fx.kt index 7faaed1..76f30c0 100644 --- a/src/main/kotlin/scientifik/fx.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/fx.kt @@ -1,4 +1,4 @@ -package scientifik +package ru.mipt.npm.gradle import org.apache.tools.ant.taskdefs.condition.Os import org.gradle.api.Project diff --git a/src/main/kotlin/ru/mipt/npm/gradle/serialization.kt b/src/main/kotlin/ru/mipt/npm/gradle/serialization.kt new file mode 100644 index 0000000..a5eb039 --- /dev/null +++ b/src/main/kotlin/ru/mipt/npm/gradle/serialization.kt @@ -0,0 +1,65 @@ +package ru.mipt.npm.gradle + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.maven +import org.gradle.kotlin.dsl.repositories + +class SerializationTargets( + val sourceSet: DependencySourceSet, + val configuration: DependencyConfiguration +) { + fun Project.cbor( + version: String = KScienceVersions.serializationVersion + ) { + useCommonDependency( + "org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + } + + fun Project.protobuf( + version: String = KScienceVersions.serializationVersion + ) { + useCommonDependency( + "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + } + + fun Project.xml( + version: String = KScienceVersions.Serialization.xmlVersion + ) { + repositories { + maven("https://dl.bintray.com/pdvrieze/maven") + } + useDependency( + "common" to "net.devrieze:xmlutil-serialization:$version", + "jvm" to "net.devrieze:xmlutil-serialization:$version", + "js" to "net.devrieze:xmlutil-serialization:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + } + + fun Project.yaml( + version: String = KScienceVersions.Serialization.yamlVersion + ) { + useDependency( + "jvm" to "com.charleskorn.kaml:kaml:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + } + + fun Project.bson( + version: String = KScienceVersions.Serialization.bsonVersion + ) { + useDependency( + "jvm" to "com.github.jershell:kbson:$version", + dependencySourceSet = sourceSet, + dependencyConfiguration = configuration + ) + } +} diff --git a/src/main/kotlin/scientifik/ScientifikNativePlugin.kt b/src/main/kotlin/scientifik/ScientifikNativePlugin.kt deleted file mode 100644 index 95b4d45..0000000 --- a/src/main/kotlin/scientifik/ScientifikNativePlugin.kt +++ /dev/null @@ -1,38 +0,0 @@ -package scientifik - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.* -import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension - -class ScientifikNativePlugin : Plugin { - override fun apply(target: Project) { - target.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { - target.configure { - linuxX64() - mingwX64() - - sourceSets.apply { - val commonMain by getting {} - - val native by creating { - dependsOn(commonMain) - - dependencies { - api(kotlin("native")) - //TODO add stdlib here - } - } - - mingwX64().compilations["main"].defaultSourceSet { - dependsOn(native) - } - - linuxX64().compilations["main"].defaultSourceSet { - dependsOn(native) - } - } - } - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/scientifik/serialization.kt b/src/main/kotlin/scientifik/serialization.kt deleted file mode 100644 index 3671512..0000000 --- a/src/main/kotlin/scientifik/serialization.kt +++ /dev/null @@ -1,90 +0,0 @@ -package scientifik - -import Scientifik -import org.gradle.api.Project -import org.gradle.kotlin.dsl.maven -import org.gradle.kotlin.dsl.repositories - -class SerializationTargets( - val sourceSet: DependencySourceSet, - val configuration: DependencyConfiguration -) { - fun Project.cbor( - version: String = Scientifik.serializationVersion - ) { - useDependency( - "common" to "org.jetbrains.kotlinx:kotlinx-serialization-cbor-common:$version", - "jvm" to "org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version", - "js" to "org.jetbrains.kotlinx:kotlinx-serialization-cbor-js:$version", - "native" to "org.jetbrains.kotlinx:kotlinx-serialization-cbor-native:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - } - - fun Project.protobuf( - version: String = Scientifik.serializationVersion - ) { - useDependency( - "common" to "org.jetbrains.kotlinx:kotlinx-serialization-protobuf-common:$version", - "jvm" to "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version", - "js" to "org.jetbrains.kotlinx:kotlinx-serialization-protobuf-js:$version", - "native" to "org.jetbrains.kotlinx:kotlinx-serialization-protobuf-native:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - } - - fun Project.xml( - version: String = Scientifik.Serialization.xmlVersion - ) { - repositories { - maven("https://dl.bintray.com/pdvrieze/maven") - } - useDependency( - "common" to "net.devrieze:xmlutil-serialization:$version", - "jvm" to "net.devrieze:xmlutil-serialization:$version", - "js" to "net.devrieze:xmlutil-serialization:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - } - - fun Project.yaml( - version: String = Scientifik.Serialization.yamlVersion - ) { - useDependency( - "jvm" to "com.charleskorn.kaml:kaml:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - } - - fun Project.bson( - version: String = Scientifik.Serialization.bsonVersion - ) { - useDependency( - "jvm" to "com.github.jershell:kbson:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - } -} - -fun Project.useSerialization( - version: String = Scientifik.serializationVersion, - sourceSet: DependencySourceSet = DependencySourceSet.MAIN, - configuration: DependencyConfiguration = DependencyConfiguration.API, - block: SerializationTargets.() -> Unit = {} -) { - plugins.apply("org.jetbrains.kotlin.plugin.serialization") - useDependency( - "common" to "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$version", - "jvm" to "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$version", - "js" to "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$version", - "native" to "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$version", - dependencySourceSet = sourceSet, - dependencyConfiguration = configuration - ) - SerializationTargets(sourceSet, configuration).apply(block) -} \ No newline at end of file