Skip to content

Commit

Permalink
Converted core to multiplatform project
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Dec 3, 2023
1 parent 39578b7 commit 8a80acb
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 24 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
base
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.gradle.nexusPublish)
`git-versioning`
}
Expand Down
15 changes: 8 additions & 7 deletions buildSrc/src/main/kotlin/maven-central-publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
java
`maven-publish`
org.jetbrains.dokka
}
Expand All @@ -19,13 +18,15 @@ if (signingKey != null && signingPassword != null) {
logger.warn("Artifact signing disabled due lack of signing properties `signingKey` and `signingPassword`")
}

java {
withJavadocJar()
withSourcesJar()
}
plugins.withId("java") {
configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}

tasks.named<Jar>("javadocJar") {
from(tasks.dokkaJavadoc)
tasks.named<Jar>("javadocJar") {
from(tasks.dokkaJavadoc)
}
}

publishing.publications.withType<MavenPublication>().configureEach {
Expand Down
21 changes: 6 additions & 15 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
alias(libs.plugins.kotlin.jvm)
`java-test-fixtures`
alias(libs.plugins.kotlin.multiplatform)
`maven-central-publish`
jacoco
}
Expand All @@ -9,21 +8,13 @@ description = "CodeOwners Library"

java.toolchain.languageVersion.set(JavaLanguageVersion.of(8))

testing.suites.withType<JvmTestSuite> {
useKotlinTest(libs.versions.kotlin)
dependencies {
implementation(platform(libs.junit.bom))
}
kotlin {
jvm()
}

publishing.publications {
create<MavenPublication>("java") { from(components["java"]) }
}

// disables testFixtures artifact publication
components.named<AdhocComponentWithVariants>("java") {
withVariantsFromConfiguration(configurations.testFixturesApiElements.get()) { skip() }
withVariantsFromConfiguration(configurations.testFixturesRuntimeElements.get()) { skip() }
dependencies {
commonTestImplementation(libs.kotlin.test)
commonTestImplementation(platform(libs.junit.bom))
}

publishing.repositories {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
android = "com.android.application:8.1.4"
buildConfig = "com.github.gmazzo.buildconfig:4.2.0"
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-samWithReceiver = { id = "org.jetbrains.kotlin.plugin.sam.with.receiver", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.10" }
gradle-pluginPublish = { id = "com.gradle.plugin-publish", version = "1.2.1" }
Expand Down
2 changes: 1 addition & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ gradlePlugin {
buildConfig {
useKotlinOutput { internalVisibility = true }
buildConfigField("String", "CORE_DEPENDENCY", projects.core.dependencyProject
.publishing.publications.named<MavenPublication>("java").map {
.publishing.publications.named<MavenPublication>("kotlinMultiplatform").map {
"\"${it.groupId}:${it.artifactId}:${it.version}\""
}
)
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositoriesMode = RepositoriesMode.PREFER_PROJECT
repositories {
mavenCentral()
google()
Expand Down

0 comments on commit 8a80acb

Please sign in to comment.