Skip to content

Commit

Permalink
Adding targets and trying targetHierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
oldergod committed Sep 6, 2023
1 parent 067561d commit 12ff5fb
Show file tree
Hide file tree
Showing 6 changed files with 932 additions and 88 deletions.
2 changes: 1 addition & 1 deletion samples/js/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("js")
kotlin("multiplatform")
id("com.squareup.wire")
}

Expand Down
47 changes: 21 additions & 26 deletions wire-grpc-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import com.vanniktech.maven.publish.JavadocJar.Javadoc
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")
Expand All @@ -15,9 +16,7 @@ if (project.rootProject.name == "wire") {
}

kotlin {
jvm {
withJava()
}
jvm().withJava()
if (System.getProperty("kjs", "true").toBoolean()) {
js(IR) {
configure(listOf(compilations.getByName("main"), compilations.getByName("test"))) {
Expand All @@ -34,18 +33,32 @@ kotlin {
}
}
if (System.getProperty("knative", "true").toBoolean()) {
iosX64()
androidNativeArm32()
androidNativeArm64()
androidNativeX64()
androidNativeX86()
iosArm64()
iosSimulatorArm64()
// Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
linuxX64()
macosX64()
iosSimulatorArm64()
iosX64()
linuxArm64()
linuxX64() // Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
macosArm64()
macosX64()
mingwX64()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()
wasm().nodejs()
watchosArm32()
watchosArm64()
watchosDeviceArm64()
watchosSimulatorArm64()
watchosX64()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default()

sourceSets {
val commonMain by getting {
dependencies {
Expand All @@ -59,24 +72,6 @@ kotlin {
api(libs.okhttp.core)
}
}
if (System.getProperty("knative", "true").toBoolean()) {
val nativeMain by creating {
dependsOn(commonMain)
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val linuxX64Main by getting
val macosX64Main by getting
val macosArm64Main by getting
val mingwX64Main by getting
val tvosX64Main by getting
val tvosArm64Main by getting
val tvosSimulatorArm64Main by getting
for (it in listOf(iosX64Main, iosArm64Main, iosSimulatorArm64Main, linuxX64Main, macosX64Main, macosArm64Main, mingwX64Main, tvosX64Main, tvosArm64Main, tvosSimulatorArm64Main)) {
it.dependsOn(nativeMain)
}
}
}
}

Expand Down
74 changes: 22 additions & 52 deletions wire-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import com.diffplug.gradle.spotless.SpotlessExtension
import com.vanniktech.maven.publish.JavadocJar.Javadoc
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

plugins {
kotlin("multiplatform")
Expand All @@ -17,9 +19,7 @@ if (project.rootProject.name == "wire") {
}

kotlin {
jvm {
withJava()
}
jvm().withJava()
if (System.getProperty("kjs", "true").toBoolean()) {
js(IR) {
configure(listOf(compilations.getByName("main"), compilations.getByName("test"))) {
Expand All @@ -36,18 +36,32 @@ kotlin {
}
}
if (System.getProperty("knative", "true").toBoolean()) {
iosX64()
androidNativeArm32()
androidNativeArm64()
androidNativeX64()
androidNativeX86()
iosArm64()
iosSimulatorArm64()
// Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
linuxX64()
macosX64()
iosSimulatorArm64()
iosX64()
linuxArm64()
linuxX64() // Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
macosArm64()
macosX64()
mingwX64()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()
wasm().nodejs()
watchosArm32()
watchosArm64()
watchosDeviceArm64()
watchosSimulatorArm64()
watchosX64()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default()

sourceSets {
val commonMain by getting {
dependencies {
Expand Down Expand Up @@ -78,50 +92,6 @@ kotlin {
}
}
}
if (System.getProperty("knative", "true").toBoolean()) {
val nativeMain by creating {
dependsOn(commonMain)
}
val nativeTest by creating {
dependsOn(commonTest)
}
val darwinMain by creating {
dependsOn(commonMain)
}

val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val linuxX64Main by getting
val macosX64Main by getting
val macosArm64Main by getting
val mingwX64Main by getting
val tvosX64Main by getting
val tvosArm64Main by getting
val tvosSimulatorArm64Main by getting
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val linuxX64Test by getting
val macosX64Test by getting
val macosArm64Test by getting
val mingwX64Test by getting
val tvosX64Test by getting
val tvosArm64Test by getting
val tvosSimulatorArm64Test by getting

for (it in listOf(iosX64Main, iosArm64Main, iosSimulatorArm64Main, linuxX64Main, macosX64Main, macosArm64Main, mingwX64Main, tvosX64Main, tvosArm64Main, tvosSimulatorArm64Main)) {
it.dependsOn(nativeMain)
}

for (it in listOf(iosX64Test, iosArm64Test, iosSimulatorArm64Test, linuxX64Test, macosX64Test, macosArm64Test, mingwX64Test, tvosX64Test, tvosArm64Test, tvosSimulatorArm64Test)) {
it.dependsOn(nativeTest)
}

for (it in listOf(iosX64Main, iosArm64Main, macosX64Main, macosArm64Main, tvosX64Main, tvosArm64Main)) {
it.dependsOn(darwinMain)
}
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions wire-schema-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import com.vanniktech.maven.publish.JavadocJar.Javadoc
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")
Expand All @@ -16,10 +17,7 @@ if (project.rootProject.name == "wire") {
}

kotlin {
jvm {
// Required by MavenPublishBaseExtension even though we do not have Java sources.
withJava()
}
jvm().withJava() // Required by MavenPublishBaseExtension even though we do not have Java sources.
if (System.getProperty("kjs", "true").toBoolean()) {
js(IR) {
configure(listOf(compilations.getByName("main"), compilations.getByName("test"))) {
Expand All @@ -35,6 +33,9 @@ kotlin {
browser()
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default()

sourceSets {
val commonMain by getting {
dependencies {
Expand Down
10 changes: 5 additions & 5 deletions wire-schema/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import com.diffplug.gradle.spotless.SpotlessExtension
import com.vanniktech.maven.publish.JavadocJar.Javadoc
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")
Expand All @@ -16,9 +17,7 @@ if (project.rootProject.name == "wire") {
}

kotlin {
jvm {
withJava()
}
jvm().withJava()
if (System.getProperty("kjs", "true").toBoolean()) {
js(IR) {
configure(listOf(compilations.getByName("main"), compilations.getByName("test"))) {
Expand All @@ -34,14 +33,15 @@ kotlin {
browser()
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default()

sourceSets {
val commonMain by getting {
dependencies {
api(projects.wireRuntime)
}
}
val commonTest by getting {
}
val jvmMain by getting {
dependencies {
api(libs.okio.core)
Expand Down
Loading

0 comments on commit 12ff5fb

Please sign in to comment.