Created
October 31, 2020 18:42
-
-
Save rsetkus/5baf49076ea891348ddad5e0d7974ac3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.serialization.Serializable | |
@Serializable | |
data class DeviceUsed( | |
val manufacturer: String?, | |
val deviceName: String?, | |
val thumbnailUrl: String?, | |
val imageUrl: String? | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
kotlin("multiplatform") | |
kotlin("plugin.serialization") version "1.4.10" | |
} | |
apply(plugin = "maven-publish") | |
kotlin { | |
jvm() | |
ios() | |
sourceSets { | |
val commonMain by getting { | |
dependencies { | |
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0") | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | |
plugins { | |
kotlin("multiplatform") | |
kotlin("plugin.serialization") version "1.4.10" | |
} | |
apply(plugin = "maven-publish") | |
kotlin { | |
jvm() | |
ios() | |
sourceSets { | |
val commonMain by getting { | |
dependencies { | |
implementation(kotlin("stdlib-common")) | |
implementation("io.ktor:ktor-client-core:1.4.1") | |
implementation("io.ktor:ktor-client-json:1.4.1") | |
implementation("io.ktor:ktor-client-serialization:1.4.1") | |
implementation("io.ktor:ktor-client-logging:1.4.1") | |
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0") | |
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0-M1") | |
implementation("com.benasher44:uuid:0.2.2") | |
implementation(project(":generatedapi")) | |
} | |
} | |
val commonTest by getting { | |
dependencies { | |
implementation(kotlin("test-common")) | |
implementation(kotlin("test-annotations-common")) | |
implementation("io.ktor:ktor-client-mock:1.3.1") | |
implementation("io.ktor:ktor-client-tests:1.3.1") | |
} | |
} | |
val androidMain by getting { | |
dependencies { | |
} | |
} | |
val jvmMain by getting { | |
dependencies { | |
implementation(kotlin("stdlib")) | |
implementation("io.ktor:ktor-client-android:1.4.1") | |
} | |
} | |
val jvmTest by getting { | |
dependencies { | |
implementation(kotlin("test")) | |
implementation(kotlin("test-junit")) | |
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.0-M1") | |
implementation("io.ktor:ktor-client-mock-jvm:1.4.1") | |
implementation("io.ktor:ktor-client-tests-jvm:1.4.1") | |
implementation("io.mockk:mockk:1.10.2") | |
} | |
} | |
val iosMain by getting { | |
dependencies { | |
implementation("io.ktor:ktor-client-ios:1.4.1") | |
} | |
} | |
val iosTest by getting { | |
dependencies { | |
} | |
} | |
} | |
} | |
// Ktlint configuration | |
val ktlint by configurations.creating | |
dependencies { | |
ktlint("com.pinterest:ktlint:0.39.0") | |
} | |
val outputDir = "${project.buildDir}/reports/ktlint/" | |
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt")) | |
val ktlintCheck by tasks.creating(JavaExec::class) { | |
inputs.files(inputFiles) | |
outputs.dir(outputDir) | |
description = "Check Kotlin code style." | |
classpath = ktlint | |
main = "com.pinterest.ktlint.Main" | |
args = listOf("src/**/*.kt") | |
} | |
tasks.named("check") { | |
dependsOn("ktlintCheck") | |
} | |
val packForXcode by tasks.creating(Sync::class) { | |
group = "build" | |
val mode = System.getenv("CONFIGURATION") ?: "DEBUG" | |
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator" | |
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64" | |
val framework = | |
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode) | |
inputs.property("mode", mode) | |
dependsOn(framework.linkTask) | |
val targetDir = File(buildDir, "xcode-frameworks") | |
from({ framework.outputDirectory }) | |
into(targetDir) | |
} | |
tasks.getByName("build").dependsOn(packForXcode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment