Skip to content

Commit

Permalink
Collapse integration convention plugin with resolution to source build (
Browse files Browse the repository at this point in the history
#622)

* Collapse integration convention plugin with resolution to source build

* chore(deps): update hashicorp/setup-terraform action to v3 (#621)

Co-authored-by: playground-manager[bot] <126197455+playground-manager[bot]@users.noreply.github.com>

* Migrate sources to common main

---------

Co-authored-by: playground-manager[bot] <126197455+playground-manager[bot]@users.noreply.github.com>
  • Loading branch information
ashdavies and playground-manager[bot] authored Nov 6, 2023
1 parent f2dbd6a commit 198ddd2
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 73 deletions.
2 changes: 0 additions & 2 deletions build-plugins/src/main/kotlin/SourceSets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import kotlin.properties.ReadOnlyProperty

public val KotlinMultiplatformExtension.androidInstrumentedTest: KotlinSourceSet by SourceSetDelegate()
public val KotlinMultiplatformExtension.androidMain: KotlinSourceSet by SourceSetDelegate()
public val KotlinMultiplatformExtension.androidDebug: SourceSetInvoker by InvokerDelegate()
public val KotlinMultiplatformExtension.androidUnitTest: KotlinSourceSet by SourceSetDelegate()

public val KotlinMultiplatformExtension.commonMain: KotlinSourceSet by SourceSetDelegate()
public val KotlinMultiplatformExtension.commonTest: KotlinSourceSet by SourceSetDelegate()
Expand Down
24 changes: 0 additions & 24 deletions build-plugins/src/main/kotlin/io.ashdavies.integration.gradle.kts

This file was deleted.

116 changes: 69 additions & 47 deletions cloud-run/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@file:Suppress("DSL_SCOPE_VIOLATION") // https://github.com/gradle/gradle/issues/22797

plugins {
id("com.google.cloud.tools.jib")
id("io.ashdavies.integration")
id("io.ashdavies.kotlin")
application

Expand All @@ -19,57 +16,82 @@ jib {

kotlin {
explicitApiWarning()
jvm { withJava() }

jvmMain.dependencies {
with(projects) {
implementation(appCheck.appCheckSdk)
implementation(cloudFirestore)
implementation(httpClient)
implementation(eventsAggregator)
implementation(localStorage)
}

with(libs.google) {
implementation(dependencies.platform(cloud.bom))
implementation(cloud.firestore)
implementation(cloud.storage)
implementation(firebase.admin)
implementation(guava.jre)
}
jvm {
compilations {
val main by compilations.getting
val test by compilations.getting

with(libs.jetbrains.kotlinx) {
implementation(coroutines.core)
implementation(datetime)
implementation(serialization.core)
implementation(serialization.json)
}
val integrationTest by compilations.creating {
defaultSourceSet.dependencies {
implementation(main.compileDependencyFiles + main.output.classesDirs)
implementation(kotlin("test-junit"))

implementation(libs.ktor.serialization.json)
implementation(libs.ktor.serialization.kotlinx)

with(libs.ktor.server) {
implementation(auth)
implementation(call.logging)
implementation(cio)
implementation(compression)
implementation(conditional.headers)
implementation(content.negotiation)
implementation(core)
implementation(default.headers)
implementation(request.validation)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.json)
implementation(libs.ktor.server.test.host)
}

tasks.register<Test>("integrationTest") {
classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs
description = "Run integration tests."
group = LifecycleBasePlugin.VERIFICATION_GROUP
testClassesDirs = output.classesDirs
testLogging { events("passed") }
}
}

integrationTest.associateWith(test)
}
}

jvmIntegrationTest.dependencies {
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.core)
implementation(libs.ktor.server.test.host)
withJava()
}
}

sourceSets.main {
java.srcDir(tasks.openApiGenerate)
commonMain {
kotlin.srcDir(tasks.openApiGenerate)

dependencies {
with(projects) {
implementation(appCheck.appCheckSdk)
implementation(cloudFirestore)
implementation(httpClient)
implementation(eventsAggregator)
implementation(localStorage)
}

with(libs.google) {
implementation(dependencies.platform(cloud.bom))
implementation(cloud.firestore)
implementation(cloud.storage)
implementation(firebase.admin)
implementation(guava.jre)
}

with(libs.jetbrains.kotlinx) {
implementation(coroutines.core)
implementation(datetime)
implementation(serialization.core)
implementation(serialization.json)
}

with(libs.ktor) {
implementation(serialization.json)
implementation(serialization.kotlinx)

with(server) {
implementation(auth)
implementation(call.logging)
implementation(cio)
implementation(compression)
implementation(conditional.headers)
implementation(content.negotiation)
implementation(core)
implementation(default.headers)
implementation(request.validation)
}
}
}
}
}

openApiGenerate {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.ashdavies.cloud

import kotlin.test.Test
import kotlin.test.assertEquals

internal class CloudRunCommonTest {

@Test
fun `should assert equality`() {
assertEquals(4, 2 + 2)
}
}
12 changes: 12 additions & 0 deletions cloud-run/src/jvmTest/kotlin/io/ashdavies/cloud/CloudRunJvmTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.ashdavies.cloud

import kotlin.test.Test
import kotlin.test.assertEquals

internal class CloudRunJvmTest {

@Test
fun `should assert equality`() {
assertEquals(4, 2 + 2)
}
}

0 comments on commit 198ddd2

Please sign in to comment.