diff --git a/build.gradle.kts b/build.gradle.kts index d2b284b..7fd8ce8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,15 @@ -import org.jetbrains.dokka.gradle.DokkaTask +import io.github.gciatto.kt.mpp.log +@Suppress("DSL_SCOPE_VIOLATION") plugins { - `kotlin-jvm-js` alias(libs.plugins.gitSemVer) - `publish-on-maven` - `publish-on-npm` - `print-versions` + alias(libs.plugins.ktMpp.multiplatform) + alias(libs.plugins.ktMpp.versions) + alias(libs.plugins.ktMpp.linter) + alias(libs.plugins.ktMpp.bugFinder) + alias(libs.plugins.ktMpp.documentation) + alias(libs.plugins.ktMpp.mavenPublish) + alias(libs.plugins.ktMpp.npmPublish) } group = "io.github.gciatto" @@ -15,19 +19,27 @@ gitSemVer { assignGitSemanticVersion() } -logger.log(LogLevel.LIFECYCLE, "${rootProject.name} version: $version") +log("version: $version") repositories { mavenCentral() } -jvmVersion(libs.versions.jvm) -nodeVersion(libs.versions.node, rootProject.findProperty("nodeVersion")) - kotlin { js { nodejs { binaries.library() } } + sourceSets { + commonMain { + dependencies { + api(libs.kotlin.reflect) + } + } + } +} + +tasks.withType { + println(path) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 8eb8211..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,35 +0,0 @@ -plugins { - `kotlin-dsl` - `java-gradle-plugin` - alias(libs.plugins.kotlin.jvm) -} - -repositories { - mavenCentral() - gradlePluginPortal() -} - -// https://github.com/gradle/gradle/issues/20847 -configurations.configureEach { - if (isCanBeResolved) { - attributes { - attribute( - GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, - project.objects.named(GradleVersion.current().version) - ) - } - } -} - -//kotlin { -// jvmToolchain(11) -//} - -dependencies { - implementation(libs.kotlin.bom) - implementation(libs.kotlin.gradlePlugin) - implementation(libs.npmPublish) - implementation(libs.dokka) - implementation(libs.ktlint) - implementation(libs.detekt) -} diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties deleted file mode 100644 index 2eeeab7..0000000 --- a/buildSrc/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -kotlin.mpp.stability.nowarn=true -kotlin.options.suppressFreeCompilerArgsModificationWarning=true diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts deleted file mode 100644 index b5a0fab..0000000 --- a/buildSrc/settings.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -dependencyResolutionManagement { - versionCatalogs { - create("libs") { - from(files("../gradle/libs.versions.toml")) - } - } -} diff --git a/buildSrc/src/main/kotlin/Developer.kt b/buildSrc/src/main/kotlin/Developer.kt deleted file mode 100644 index f31b5f3..0000000 --- a/buildSrc/src/main/kotlin/Developer.kt +++ /dev/null @@ -1,30 +0,0 @@ -import Organization.Companion.getOrg -import org.gradle.api.Project - -data class Developer(val name: String, val url: String?, val email: String?, val org: Organization?) { - - fun toPerson() = mutableMapOf( - "name" to name, - "url" to url, - "email" to email, - ) - - companion object { - fun Project.getDev(key: String): Developer { - val name = property("${key}Name")?.toString() ?: error("Missing property ${key}Name") - val url = findProperty("${key}Url")?.toString() - val email = findProperty("${key}Email")?.toString() - val orgKey = findProperty("${key}Org")?.toString() - val org = orgKey?.let { getOrg(it) } - return Developer(name, url, email, org) - } - - fun Project.getAllDevs(): Set = - properties.keys.asSequence() - .filter { it.startsWith("developer") && it.endsWith("Name") } - .map { it.replace("Name", "") } - .distinct() - .map { getDev(it) } - .toSet() - } -} diff --git a/buildSrc/src/main/kotlin/NodeVersions.kt b/buildSrc/src/main/kotlin/NodeVersions.kt deleted file mode 100644 index 9ab5c31..0000000 --- a/buildSrc/src/main/kotlin/NodeVersions.kt +++ /dev/null @@ -1,58 +0,0 @@ -import java.io.BufferedReader -import java.io.InputStreamReader -import java.net.URL -import kotlin.streams.asSequence - -object NodeVersions { - private fun getLatestVersionOfWithMajor(major: String): String { - val url = URL("https://nodejs.org/dist/latest-v$major.x/") - return findVersion(url) ?: error("Cannot retrieve last version of node $major") - } - - private fun getLatestVersion(): String { - val url = URL("https://nodejs.org/dist/latest/") - return findVersion(url) ?: error("Cannot retrieve last version of node") - } - - private val FILE_REGEX = "\"node-v(\\d+).(\\d+).(\\d+).*?\"".toRegex() - - private val MAJOR_REGEX = "\\d+".toRegex() - - private val FULL_VERSION_REGEX = "\\d+.\\d+.\\d+".toRegex() - - private val LATEST_VERSION_REGEX = "(?:v?)(\\d+)-latest|latest-(?:v?)(\\d+)".toRegex(RegexOption.IGNORE_CASE) - - private fun findVersion(url: URL): String? { - BufferedReader(InputStreamReader(url.openStream())).use { reader -> - return reader.lines().asSequence() - .map { FILE_REGEX.find(it) } - .filterNotNull() - .filter { it.groups.size >= 3 } - .map { it.groupValues.subList(1, 4).joinToString(".") } - .firstOrNull() - } - } - - private val VERSIONS_CACHE = mutableMapOf() - - fun latest(major: String = "latest"): String = - VERSIONS_CACHE.computeIfAbsent(major) { - when { - it.equals("latest", ignoreCase = true) -> getLatestVersion() - MAJOR_REGEX.matches(it) -> getLatestVersionOfWithMajor(it) - else -> error("Major number expected, provided: $it") - } - } - - fun toFullVersion(version: String): String = when { - version.equals("latest", ignoreCase = true) -> latest() - FULL_VERSION_REGEX.matches(version) -> version - else -> { - val match = LATEST_VERSION_REGEX.matchEntire(version) ?: error("Invalid version string: $version") - val major = match.groupValues.let { it.subList(1, it.size) }.first { !it.isEmpty() } - latest(major) - } - } -} - - diff --git a/buildSrc/src/main/kotlin/Organization.kt b/buildSrc/src/main/kotlin/Organization.kt deleted file mode 100644 index ef242e0..0000000 --- a/buildSrc/src/main/kotlin/Organization.kt +++ /dev/null @@ -1,11 +0,0 @@ -import org.gradle.api.Project - -data class Organization(val name: String, val url: String) { - companion object { - fun Project.getOrg(key: String): Organization { - val name = property("${key}Name")?.toString() ?: error("Missing property ${key}Name") - val url = findProperty("${key}Url")?.toString() ?: error("Missing property ${key}Url") - return Organization(name, url) - } - } -} diff --git a/buildSrc/src/main/kotlin/ProjectUtils.kt b/buildSrc/src/main/kotlin/ProjectUtils.kt deleted file mode 100644 index f8a9796..0000000 --- a/buildSrc/src/main/kotlin/ProjectUtils.kt +++ /dev/null @@ -1,105 +0,0 @@ -import dev.petuska.npm.publish.NpmPublishPlugin -import dev.petuska.npm.publish.extension.NpmPublishExtension -import dev.petuska.npm.publish.extension.domain.json.PackageJson -import dev.petuska.npm.publish.extension.domain.json.Person -import org.gradle.api.JavaVersion -import org.gradle.api.Project -import org.gradle.api.artifacts.MinimalExternalModuleDependency -import org.gradle.api.logging.LogLevel -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.api.provider.Provider -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin -import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension -import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -fun Project.jvmVersion(provider: Provider) { - val version = provider.map { JavaVersion.toVersion(it) }.getOrElse(JavaVersion.current()) - plugins.withType { - configure { - targetCompatibility = version - logger.log(LogLevel.LIFECYCLE, "${rootProject.name} set java.targetCompatibility=$targetCompatibility") - sourceCompatibility = version - logger.log(LogLevel.LIFECYCLE, "${rootProject.name} set java.sourceCompatibility=$sourceCompatibility") - } - } - tasks.withType { - kotlinOptions { - logger.log(LogLevel.LIFECYCLE, "${rootProject.name} set ${path}.jvmTarget=$version") - jvmTarget = version.toString() - } - } -} - -val Project.npmCompliantVersion: String - get() = version.toString().split("+")[0] - -fun Project.nodeVersion(default: Provider, override: Any? = null) { - plugins.withType { - configure { - val requestedVersion = override?.toString() ?: default.takeIf { it.isPresent }?.get() ?: nodeVersion - nodeVersion = NodeVersions.toFullVersion(requestedVersion) - logger.log(LogLevel.LIFECYCLE, "${rootProject.name} set nodeVersion=$nodeVersion") - } - } -} - -fun Project.packageJson(handler: PackageJson.() -> Unit) { - plugins.withType { - configure { - packages { - all { - packageJson(handler) - } - } - } - } -} - -fun PackageJson.person(developer: Developer): Person = - this.Person { - name.set(developer.name) - email.set(developer.email) - url.set(developer.url) - } - -fun Project.subprojects(names: Iterable): Set { - return subprojects.filter { it.name in names }.toSet() -} - -fun Project.subprojects(first: String, vararg others: String): Set { - val names = setOf(first, *others) - return subprojects(names) -} - -fun Project.subprojects(names: Iterable, except: Iterable = emptySet(), action: Project.() -> Unit) { - rootProject.subprojects { - if (name.let { it in names && it !in except }) { - action() - } - } -} - -fun Project.subprojects(names: Iterable, except: String, action: Project.() -> Unit) { - subprojects(names, setOf(except), action) -} - -fun Project.subprojects(first: String, vararg others: String, action: Project.() -> Unit) { - val names = setOf(first, *others) - subprojects(names, emptySet(), action) -} - -fun Iterable.except(names: Iterable): Set { - return filter { it.name !in names }.toSet() -} - -fun Iterable.except(first: String, vararg others: String): Set { - val names = setOf(first, *others) - return except(names) -} - -val Provider.version - get() = this.get().versionConstraint.requiredVersion diff --git a/buildSrc/src/main/kotlin/kotlin-bug-finder.gradle.kts b/buildSrc/src/main/kotlin/kotlin-bug-finder.gradle.kts deleted file mode 100644 index b9155a3..0000000 --- a/buildSrc/src/main/kotlin/kotlin-bug-finder.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -import io.gitlab.arturbosch.detekt.DetektPlugin -import io.gitlab.arturbosch.detekt.extensions.DetektExtension - -apply() - -configure { - // toolVersion = "1.19.0" - config = rootProject.files(".detekt.yml") - buildUponDefaultConfig = true -} diff --git a/buildSrc/src/main/kotlin/kotlin-doc.gradle.kts b/buildSrc/src/main/kotlin/kotlin-doc.gradle.kts deleted file mode 100644 index e0e1647..0000000 --- a/buildSrc/src/main/kotlin/kotlin-doc.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaTask -import org.jetbrains.dokka.gradle.DokkaMultiModuleTask -import org.jetbrains.dokka.gradle.DokkaPlugin -import org.jetbrains.dokka.gradle.DokkaTask - -apply() - -inline fun createJavadocArchiveTask(dependingOn: AbstractDokkaTask): A { - return tasks.create("${dependingOn.name}${A::class.simpleName}") { - group = "documentation" - archiveClassifier.set("javadoc") - from(dependingOn.outputDirectory) - dependsOn(dependingOn) - } -} - -if (project == rootProject) { - tasks.withType().all { - createJavadocArchiveTask(dependingOn = this) - } -} else { - tasks.withType().all { - createJavadocArchiveTask(dependingOn = this) - } -} diff --git a/buildSrc/src/main/kotlin/kotlin-js-only.gradle.kts b/buildSrc/src/main/kotlin/kotlin-js-only.gradle.kts deleted file mode 100644 index c197203..0000000 --- a/buildSrc/src/main/kotlin/kotlin-js-only.gradle.kts +++ /dev/null @@ -1,53 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - kotlin("js") -} - -val mochaTimeout: String by project -val ktCompilerArgs: String by project - -kotlin { - js { - useCommonJs() - compilations.all { - kotlinOptions { - main = "noCall" - } - } - nodejs { - testTask { - useMocha { - timeout = mochaTimeout - } - } - } - } -} - -dependencies { - implementation(kotlin("bom")) - api(kotlin("stdlib-js")) -} - -tasks.withType { - kotlinOptions { - allWarningsAsErrors = true - freeCompilerArgs = ktCompilerArgs.split(";").toList() - } -} - -tasks.register("jsTest") { - group = "verification" - dependsOn("test") -} - -tasks.register("jsMainClasses") { - group = "build" - dependsOn("mainClasses") -} - -tasks.register("jsTestClasses") { - group = "build" - dependsOn("testClasses") -} diff --git a/buildSrc/src/main/kotlin/kotlin-jvm-js.gradle.kts b/buildSrc/src/main/kotlin/kotlin-jvm-js.gradle.kts deleted file mode 100644 index b6198e9..0000000 --- a/buildSrc/src/main/kotlin/kotlin-jvm-js.gradle.kts +++ /dev/null @@ -1,78 +0,0 @@ -plugins { - kotlin("multiplatform") -} - -val mochaTimeout: String by project -val ktCompilerArgsJvm: String by project -val ktCompilerArgs: String by project - -kotlin { - jvm { - withJava() - compilations.all { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + ktCompilerArgsJvm.split(";") - } - } - } - - js { - useCommonJs() - compilations.all { - kotlinOptions { - main = "noCall" - } - } - nodejs { - testTask { - useMocha { - timeout = mochaTimeout - } - } - } - } - - @Suppress("UNUSED_VARIABLE") - sourceSets { - commonMain { - dependencies { - api(kotlin("stdlib-common")) - } - } - commonTest { - 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-junit")) - } - } - val jsMain by getting { - dependencies { - api(kotlin("stdlib-js")) - } - } - val jsTest by getting { - dependencies { - implementation(kotlin("test-js")) - } - } - } - - targets.all { - compilations.all { - kotlinOptions { - allWarningsAsErrors = true - freeCompilerArgs = freeCompilerArgs + ktCompilerArgs.split(";") - } - } - } -} diff --git a/buildSrc/src/main/kotlin/kotlin-jvm-only.gradle.kts b/buildSrc/src/main/kotlin/kotlin-jvm-only.gradle.kts deleted file mode 100644 index 24922c5..0000000 --- a/buildSrc/src/main/kotlin/kotlin-jvm-only.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - kotlin("jvm") - `java-library` -} - -val ktCompilerArgsJvm: String by project -val ktCompilerArgs: String by project - -tasks.withType { - kotlinOptions { - allWarningsAsErrors = true - freeCompilerArgs = listOf(ktCompilerArgs, ktCompilerArgsJvm).flatMap { it.split(";") } - } -} - -dependencies { - implementation(kotlin("bom")) - api(kotlin("stdlib-jdk8")) -} - -java { - withSourcesJar() -} - -tasks.register("jvmTest") { - group = "verification" - dependsOn("test") -} - -tasks.register("jvmMainClasses") { - group = "build" - dependsOn("classes") -} - -tasks.register("jvmTestClasses") { - group = "build" - dependsOn("testClasses") -} diff --git a/buildSrc/src/main/kotlin/kotlin-mp.gradle.kts b/buildSrc/src/main/kotlin/kotlin-mp.gradle.kts deleted file mode 100644 index 1348e51..0000000 --- a/buildSrc/src/main/kotlin/kotlin-mp.gradle.kts +++ /dev/null @@ -1,90 +0,0 @@ -plugins { - kotlin("multiplatform") -} - -val mochaTimeout: String by project -val ktCompilerArgsJvm: String by project -val ktCompilerArgs: String by project - -val disableJvm: Boolean = project.findProperty("ktTargetJvmDisable")?.toString()?.toBoolean() ?: false -val disableJs: Boolean = project.findProperty("ktTargetJsDisable")?.toString()?.toBoolean() ?: false - -kotlin { - if (!disableJvm) { - jvm { - withJava() - compilations.all { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + ktCompilerArgsJvm.split(";") - } - } - } - } - - if (!disableJs) { - js { - useCommonJs() - compilations.all { - kotlinOptions { - main = "noCall" - } - } - nodejs { - testTask { - useMocha { - timeout = mochaTimeout - } - } - } - } - } - - @Suppress("UNUSED_VARIABLE") - sourceSets { - commonMain { - dependencies { - implementation(kotlin("bom")) - api(kotlin("stdlib-common")) - } - } - commonTest { - dependencies { - implementation(kotlin("test-common")) - implementation(kotlin("test-annotations-common")) - } - } - if (!disableJvm) { - val jvmMain by getting { - dependencies { - api(kotlin("stdlib-jdk8")) - } - } - val jvmTest by getting { - dependencies { - implementation(kotlin("test-junit")) - } - } - } - if (!disableJs) { - val jsMain by getting { - dependencies { - api(kotlin("stdlib-js")) - } - } - val jsTest by getting { - dependencies { - implementation(kotlin("test-js")) - } - } - } - } - - targets.all { - compilations.all { - kotlinOptions { - allWarningsAsErrors = true - freeCompilerArgs = freeCompilerArgs + ktCompilerArgs.split(";") - } - } - } -} diff --git a/buildSrc/src/main/kotlin/kotlin-style-checker.gradle.kts b/buildSrc/src/main/kotlin/kotlin-style-checker.gradle.kts deleted file mode 100644 index cccbd2c..0000000 --- a/buildSrc/src/main/kotlin/kotlin-style-checker.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -import org.jlleitschuh.gradle.ktlint.reporter.ReporterType -import org.jlleitschuh.gradle.ktlint.KtlintPlugin -import org.jlleitschuh.gradle.ktlint.KtlintExtension -import org.jlleitschuh.gradle.ktlint.KtlintIdeaPlugin - -apply() -apply() - -configure { - // version.set("0.22.0") - debug.set(false) - verbose.set(true) - android.set(false) - outputToConsole.set(true) - outputColorName.set("RED") - ignoreFailures.set(false) - enableExperimentalRules.set(true) - additionalEditorconfigFile.set(rootProject.file(".editorconfig")) - - reporters { - reporter(ReporterType.PLAIN) - reporter(ReporterType.CHECKSTYLE) - } - filter { - exclude("**/generated/**") - include("**/kotlin/**") - } -} diff --git a/buildSrc/src/main/kotlin/print-versions.gradle.kts b/buildSrc/src/main/kotlin/print-versions.gradle.kts deleted file mode 100644 index bb94dee..0000000 --- a/buildSrc/src/main/kotlin/print-versions.gradle.kts +++ /dev/null @@ -1,11 +0,0 @@ -val versioning = "versioning" - -tasks.register("printVersion") { - group = versioning - doLast { println(project.version) } -} - -tasks.register("printNpmVersion") { - group = versioning - doLast { println(project.npmCompliantVersion) } -} diff --git a/buildSrc/src/main/kotlin/publish-on-maven.gradle.kts b/buildSrc/src/main/kotlin/publish-on-maven.gradle.kts deleted file mode 100644 index 4cc3311..0000000 --- a/buildSrc/src/main/kotlin/publish-on-maven.gradle.kts +++ /dev/null @@ -1,111 +0,0 @@ -import Developer.Companion.getAllDevs - -plugins { - `maven-publish` - signing -} - -val projectLongName: String by project -val projectDescription: String by project -val projectHomepage: String by project -val projectLicense: String? by project -val projectLicenseUrl: String? by project -val scmUrl: String? by project -val scmConnection: String? by project -val issuesUrl: String? by project -val issuesEmail: String? by project -// env ORG_GRADLE_PROJECT_signingKey -val signingKey: String? by project -// env ORG_GRADLE_PROJECT_signingPassword -val signingPassword: String? by project -// env ORG_GRADLE_PROJECT_mavenRepo -val mavenRepo: String? by project -// env ORG_GRADLE_PROJECT_mavenUsername -val mavenUsername: String? by project -// env ORG_GRADLE_PROJECT_mavenPassword -val mavenPassword: String? by project - -val publishableClassifiers = setOf("javadoc") - -publishing { - repositories { - maven { - mavenRepo?.let { url = uri(it) } - if (mavenUsername != null && mavenPassword != null) { - credentials { - username = mavenUsername - password = mavenPassword - } - } - } - } - - plugins.withId("org.jetbrains.kotlin.jvm") { - publications.maybeCreate("jvm").run { - from(components["java"]) - } - } - - plugins.withId("org.jetbrains.kotlin.js") { - publications.maybeCreate("js").run { - from(components["kotlin"]) - } - } - - project.afterEvaluate { - publications.withType { - groupId = project.group.toString() - version = project.version.toString() - - tasks.withType { - if ("Html" in name && archiveClassifier.getOrElse("") in publishableClassifiers) { - artifact(this) - } - } - - pom { - name.set(projectLongName) - description.set(projectDescription) - url.set(projectHomepage) - licenses { - license { - name.set(projectLicense) - url.set(projectLicenseUrl) - } - } - - developers { - for (dev in project.getAllDevs()) { - developer { - name.set(dev.name) - dev.email?.let { email.set(it) } - dev.url?.let { url.set(it) } - dev.org?.let { - organization.set(it.name) - organization.set(it.url) - } - - } - } - } - - scm { - connection.set(scmConnection) - url.set(scmUrl) - } - } - } - } - - signing { - if (arrayOf(signingKey, signingPassword).none { it.isNullOrBlank() }) { - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publications) - } - - val signAll = project.tasks.create("signAllPublications") - project.tasks.withType { - signAll.dependsOn(this) - } - } -} diff --git a/buildSrc/src/main/kotlin/publish-on-npm.gradle.kts b/buildSrc/src/main/kotlin/publish-on-npm.gradle.kts deleted file mode 100644 index c65c8d2..0000000 --- a/buildSrc/src/main/kotlin/publish-on-npm.gradle.kts +++ /dev/null @@ -1,60 +0,0 @@ -import Developer.Companion.getAllDevs -import dev.petuska.npm.publish.NpmPublishPlugin -import dev.petuska.npm.publish.extension.NpmPublishExtension - -apply() - -val projectLongName: String? by project -val projectDescription: String? by project -val projectHomepage: String? by project -val projectLicense: String? by project -val projectLicenseUrl: String? by project -val scmUrl: String? by project -val scmConnection: String? by project -val issuesUrl: String? by project -val issuesEmail: String? by project -val npmToken: String? by project -val npmRepo: String? by project -val npmDryRun: String? by project -val npmOrganization: String? by project - -configure { - npmOrganization?.let { organization.set(it) } - readme.set(rootProject.file("README.md")) - // bundleKotlinDependencies.set(true) - dry.set(npmDryRun?.let { it.toBoolean() } ?: false) - registries { - npmjs { - npmToken?.let { authToken.set(it) } - } - } - packages { - all { - packageName.set("${rootProject.name}-${project.name}") - packageJson { - homepage.set(projectHomepage) - description.set(projectDescription) - val developers = project.getAllDevs() - if (developers.isNotEmpty()) { - author.set(person(developers.first())) - } - contributors.set( - developers.asSequence() - .drop(1) - .map { person(it) } - .toCollection(mutableListOf()) - ) - license.set(projectLicense) - private.set(false) - bugs { - url.set(issuesUrl) - email.set(issuesEmail) - } - repository { - type.set("git") - url.set(scmUrl) - } - } - } - } -} diff --git a/gradle.properties b/gradle.properties index 54ba83f..3ff2a65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,14 @@ systemProp.org.gradle.internal.http.socketTimeout=180000 org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g ktCompilerArgs=-opt-in=kotlin.js.ExperimentalJsExport;-opt-in=kotlin.time.ExperimentalTime ktCompilerArgsJvm=-Xjvm-default=all +ktCompilerArgsJs= +ktTargetJvmDisable=false +ktTargetJsDisable=false +versionsFromCatalog=libs +nodeVersion= +allWarningsAsErrors=true mochaTimeout=180s + projectLongName=Kt-Math projectDescription=Kotlin multi-platform porting of Java's BigIntegers and BigDecimals projectHomepage=https://github.com/gciatto/kt-math @@ -25,12 +32,15 @@ mavenUsername= mavenPassword= signingKey= signingPassword= + developerGciattoName=Giovanni Ciatto developerGciattoEmail=giovanni.ciatto@gmail.com developerGciattoUrl=https://about.me/gciatto developerGciattoOrg=unibo -uniboName=Alma Mater Studiorum - Universit� di Bologna +uniboName=Alma Mater Studiorum - Università di Bologna uniboUrl=https://www.unibo.it/en/homepage + +npmOrganization=tuprolog npmToken= npmRepo=https://registry.npmjs.org npmDryRun=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 42dfb1b..25f0e49 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,32 +1,22 @@ [versions] -detekt = "1.22.0" -dokka = "1.8.10" -jvm = "1.8" kotlin = "1.8.10" -ktlint = "10.3.0" +jvm = "1.8" node = "16-latest" -npmPublish = "3.2.1" +ktMpp = "1.1.0" [libraries] -detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } -dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } -kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" } -kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } -kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } -kotlin-stdlib-jvm = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } -kotlin-stdlib-js = { module = "org.jetbrains.kotlin:kotlin-stdlib-js", version.ref = "kotlin" } -ktlint = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint" } -npmPublish = { module = "dev.petuska:npm-publish-gradle-plugin", version.ref = "npmPublish" } [plugins] -detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } -dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } gitSemVer = "org.danilopianini.git-sensitive-semantic-versioning:1.1.4" -kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } -kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } -ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } -ktlint-idea = { id = "org.jlleitschuh.gradle.ktlint-idea", version.ref = "ktlint" } -npmPublish = { id = "dev.petuska.npm.publish", version.ref = "npmPublish" } +ktMpp-bugFinder = { id = "io.github.gciatto.kt-mpp.bug-finder", version.ref = "ktMpp" } +ktMpp-documentation = { id = "io.github.gciatto.kt-mpp.documentation", version.ref = "ktMpp" } +ktMpp-linter = { id = "io.github.gciatto.kt-mpp.linter", version.ref = "ktMpp" } +ktMpp-mavenPublish = { id = "io.github.gciatto.kt-mpp.maven-publish", version.ref = "ktMpp" } +ktMpp-npmPublish = { id = "io.github.gciatto.kt-mpp.npm-publish", version.ref = "ktMpp" } +ktMpp-versions = { id = "io.github.gciatto.kt-mpp.versions", version.ref = "ktMpp" } +ktMpp-jsOnly = { id = "io.github.gciatto.kt-mpp.js-only", version.ref = "ktMpp" } +ktMpp-jvmOnly = { id = "io.github.gciatto.kt-mpp.jvm-only", version.ref = "ktMpp" } +ktMpp-multiplatform = { id = "io.github.gciatto.kt-mpp.multiplatform", version.ref = "ktMpp" } +ktMpp-multiProjectHelper = { id = "io.github.gciatto.kt-mpp.multi-project-helper", version.ref = "ktMpp" } nexusPublish = "de.marcphilipp.nexus-publish:0.4.0"