diff --git a/build.gradle.kts b/build.gradle.kts index f837fa1..abccaea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,17 @@ buildscript { repositories { - jcenter() + google() + mavenCentral() } dependencies { classpath(deps.Kotlin.Gradle.Plugin) classpath(deps.Dokka.Gradle.Plugin) + classpath("com.vanniktech:gradle-maven-publish-plugin:0.17.0") } } +subprojects { + repositories { + mavenCentral() + } +} diff --git a/buildSrc/src/main/kotlin/deps/deps.kt b/buildSrc/src/main/kotlin/deps/deps.kt index b92676f..d19f152 100644 --- a/buildSrc/src/main/kotlin/deps/deps.kt +++ b/buildSrc/src/main/kotlin/deps/deps.kt @@ -6,7 +6,7 @@ object Dokka : Group("org.jetbrains.dokka", "0.10.1") { } } -object Kotlin : Group("org.jetbrains.kotlin", "1.3.72") { +object Kotlin : Group("org.jetbrains.kotlin", "1.5.21") { val StdLib = artifact("kotlin-stdlib") object Gradle { diff --git a/gradle.properties b/gradle.properties index 06ea60d..5eacbc7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,21 @@ -GROUP=com.michaelpardo.max -VERSION_NAME=0.1.0-SNAPSHOT -POM_DESCRIPTION=Max -POM_URL=https://github.com/pardom/max/ -POM_SCM_URL=https://github.com/pardom/max/ -POM_SCM_CONNECTION=scm:git:git://github.com/pardom/max.git -POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/pardom/max.git +kotlin.native.ignoreDisabledTargets=true +kotlin.native.distribution.type=prebuilt +kotlin.mpp.enableGranularSourceSetsMetadata=true +kotlin.mpp.enableCompatibilityMetadataVariant=true + +GROUP=com.github.molmsted98.max +VERSION_NAME=1.0.33 + +POM_INCEPTION_YEAR=2021 + +POM_URL=https://github.com/molmsted98/max/ +POM_SCM_URL=https://github.com/molmsted98/max/ +POM_SCM_CONNECTION=scm:git:git://github.com/molmsted98/max.git + POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo -POM_DEVELOPER_ID=michaelpardo -POM_DEVELOPER_NAME=Michael Pardo -kotlin.native.ignoreDisabledTargets=true +POM_DEVELOPER_ID=molmsted98 +POM_DEVELOPER_NAME=Michael Olmsted +POM_DEVELOPER_URL=https://github.com/molmsted98/ diff --git a/gradle/gradle-mvn-mpp-push.gradle b/gradle/gradle-mvn-mpp-push.gradle index 6ae3f12..4ef6b57 100644 --- a/gradle/gradle-mvn-mpp-push.gradle +++ b/gradle/gradle-mvn-mpp-push.gradle @@ -1,112 +1,33 @@ +apply plugin: 'java-gradle-plugin' apply plugin: 'maven-publish' -apply plugin: 'signing' -apply plugin: 'org.jetbrains.dokka' -dokka { - outputDirectory = "$rootDir/docs" - outputFormat = "gfm" - - multiplatform { - global { - sourceLink { - path = "max/src/commonMain/kotlin" - url = "https://github.com/pardom/max/tree/master/max/src/commonMain/kotlin" - lineSuffix = "#L" - } - } - common {} +static def selectArtifactId(project, type, defaultName) { + def name = project.name + def isCommon = project.ext.has("commonStructure") + def commonIsRoot = project.ext.has("commonStructure") && project.ext.commonStructure + def hasNative = project.ext.has("hasNative") && project.ext.hasNative + switch (type) { + case 'metadata': + if (!isCommon) return "$name-$type" + return "$name-metadata" + break + case 'kotlinMultiplatform': + if (!hasNative) return "$name-kotlinMultiplatform" + return name + break + case 'jvm': + return commonIsRoot ? "$name-jvm" : "$name" + break + default: + return isCommon || hasNative ? defaultName : "$name" + break } } -def isReleaseBuild() { - return VERSION_NAME.contains("SNAPSHOT") == false -} - -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : - "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : - "https://oss.sonatype.org/content/repositories/snapshots/" -} - -def getRepositoryUsername() { - return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : "" -} - -task emptySourcesJar(type: Jar) { - classifier = 'sources' -} - -task javadocsJar(type: Jar, dependsOn: dokka) { - classifier = 'javadoc' - from dokka.outputDirectory -} - -signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign(publishing.publications) -} - publishing { - publications.all { - artifact javadocsJar - - pom.withXml { - def root = asNode() - - root.children().last() + { - resolveStrategy = Closure.DELEGATE_FIRST - - description POM_DESCRIPTION - name POM_NAME - url POM_URL - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } - } - } - - afterEvaluate { - publications.getByName('kotlinMultiplatform') { - // Source jars are only created for platforms, not the common artifact. - artifact emptySourcesJar - } - } - - repositories { - maven { - url isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl() - credentials { - username getRepositoryUsername() - password getRepositoryPassword() - } - } - maven { - name 'test' - url "file://${rootProject.buildDir}/localMaven" + publications { + pluginMaven(MavenPublication) { + it.artifactId = selectArtifactId(project, it.name, it.artifactId) } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4b4429..0f80bbf 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.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/matcher/build.gradle.kts b/matcher/build.gradle.kts index 024f987..a3a1ef1 100755 --- a/matcher/build.gradle.kts +++ b/matcher/build.gradle.kts @@ -1,22 +1,26 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeTargetPreset -val GROUP: String by project -val VERSION_NAME: String by project - -group = GROUP -version = VERSION_NAME - plugins { kotlin("multiplatform") -} - -repositories { - jcenter() + id("com.vanniktech.maven.publish") } kotlin { jvm() + js { + browser() + nodejs() + } + + ios() + tvos() + watchos() + + linuxX64() + macosX64() + mingwX64() + sourceSets { val commonMain by getting { dependencies { @@ -46,10 +50,12 @@ kotlin { } } +tasks.withType(Sign::class) { + enabled = false +} + tasks.withType(Test::class) { useJUnitPlatform { includeEngines("spek2") } } - -apply("$rootDir/gradle/gradle-mvn-mpp-push.gradle") diff --git a/matcher/gradle.properties b/matcher/gradle.properties index 5582e85..4eff17a 100644 --- a/matcher/gradle.properties +++ b/matcher/gradle.properties @@ -1,2 +1,3 @@ -POM_ARTIFACT_ID=max-matcher -POM_NAME=Max Matcher +POM_ARTIFACT_ID=matcher +POM_NAME=matcher +POM_DESCRIPTION=Matcher. diff --git a/navigator/build.gradle.kts b/navigator/build.gradle.kts index 1802d0e..159ca95 100755 --- a/navigator/build.gradle.kts +++ b/navigator/build.gradle.kts @@ -1,22 +1,26 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeTargetPreset -val GROUP: String by project -val VERSION_NAME: String by project - -group = GROUP -version = VERSION_NAME - plugins { kotlin("multiplatform") -} - -repositories { - jcenter() + id("com.vanniktech.maven.publish") } kotlin { jvm() + js { + browser() + nodejs() + } + + ios() + tvos() + watchos() + + linuxX64() + macosX64() + mingwX64() + sourceSets { val commonMain by getting { dependencies { @@ -48,10 +52,12 @@ kotlin { } } +tasks.withType(Sign::class) { + enabled = false +} + tasks.withType(Test::class) { useJUnitPlatform { includeEngines("spek2") } } - -apply("$rootDir/gradle/gradle-mvn-mpp-push.gradle") diff --git a/navigator/gradle.properties b/navigator/gradle.properties index 688d3c0..61553f0 100644 --- a/navigator/gradle.properties +++ b/navigator/gradle.properties @@ -1,2 +1,3 @@ -POM_ARTIFACT_ID=max-navigator -POM_NAME=Max Navigator +POM_ARTIFACT_ID=navigator +POM_NAME=navigator +POM_DESCRIPTION=Navigator implementation. diff --git a/router/build.gradle.kts b/router/build.gradle.kts index 4032776..31801d4 100755 --- a/router/build.gradle.kts +++ b/router/build.gradle.kts @@ -1,22 +1,26 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeTargetPreset -val GROUP: String by project -val VERSION_NAME: String by project - -group = GROUP -version = VERSION_NAME - plugins { kotlin("multiplatform") -} - -repositories { - jcenter() + id("com.vanniktech.maven.publish") } kotlin { jvm() + js { + browser() + nodejs() + } + + ios() + tvos() + watchos() + + linuxX64() + macosX64() + mingwX64() + sourceSets { val commonMain by getting { dependencies { @@ -48,10 +52,12 @@ kotlin { } } +tasks.withType(Sign::class) { + enabled = false +} + tasks.withType(Test::class) { useJUnitPlatform { includeEngines("spek2") } } - -apply("$rootDir/gradle/gradle-mvn-mpp-push.gradle") diff --git a/router/gradle.properties b/router/gradle.properties index 5432472..ed85420 100644 --- a/router/gradle.properties +++ b/router/gradle.properties @@ -1,2 +1,3 @@ -POM_ARTIFACT_ID=max-router -POM_NAME=Max Router +POM_ARTIFACT_ID=router +POM_NAME=router +POM_DESCRIPTION=Navigation router. diff --git a/settings.gradle.kts b/settings.gradle.kts index 687ed91..ce76c65 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,3 @@ -enableFeaturePreview("GRADLE_METADATA") - include(":uri") include(":matcher") include(":router") diff --git a/uri/build.gradle.kts b/uri/build.gradle.kts index 024f987..a3a1ef1 100755 --- a/uri/build.gradle.kts +++ b/uri/build.gradle.kts @@ -1,22 +1,26 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeTargetPreset -val GROUP: String by project -val VERSION_NAME: String by project - -group = GROUP -version = VERSION_NAME - plugins { kotlin("multiplatform") -} - -repositories { - jcenter() + id("com.vanniktech.maven.publish") } kotlin { jvm() + js { + browser() + nodejs() + } + + ios() + tvos() + watchos() + + linuxX64() + macosX64() + mingwX64() + sourceSets { val commonMain by getting { dependencies { @@ -46,10 +50,12 @@ kotlin { } } +tasks.withType(Sign::class) { + enabled = false +} + tasks.withType(Test::class) { useJUnitPlatform { includeEngines("spek2") } } - -apply("$rootDir/gradle/gradle-mvn-mpp-push.gradle") diff --git a/uri/gradle.properties b/uri/gradle.properties index 731bbcd..50ffd9c 100644 --- a/uri/gradle.properties +++ b/uri/gradle.properties @@ -1,2 +1,3 @@ -POM_ARTIFACT_ID=max-uri -POM_NAME=Max URI +POM_ARTIFACT_ID=uri +POM_NAME=uri +POM_DESCRIPTION=Representation of a URI.