-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89765e4
commit 8e74a49
Showing
2 changed files
with
87 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ plugins { | |
|
||
id("org.gradle.maven-publish") | ||
id("signing") | ||
id("com.vanniktech.maven.publish") version "0.30.0" | ||
id("maven-publish") | ||
id("com.vanniktech.maven.publish") version "0.28.0" | ||
|
||
kotlin("plugin.serialization") version "2.0.0" | ||
id("com.google.devtools.ksp") | ||
|
@@ -15,12 +16,6 @@ plugins { | |
|
||
val ktorVersion = "3.0.0" | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
kotlin { | ||
androidTarget { | ||
compilations.all { | ||
|
@@ -30,15 +25,18 @@ kotlin { | |
} | ||
} | ||
|
||
// listOf( | ||
// iosArm64(), | ||
// //iosSimulatorArm64() // Uncomment if needed | ||
// ).forEach { | ||
// it.binaries.framework { | ||
// baseName = "shared" | ||
// isStatic = true | ||
// } | ||
// } | ||
// needs to be added into a build pipeline to automate creation of the static libraries (merged universal library) | ||
//lipo -create “libApplicationInsightsObjectiveC.a” “libApplicationInsightsObjectiveC.a” -output “libApplicationInsightsObjectiveC.a” | ||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "shared" | ||
isStatic = true | ||
} | ||
} | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
|
@@ -54,6 +52,7 @@ kotlin { | |
|
||
implementation("io.github.thearchitect123:kmpEssentials:1.8.5") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0") | ||
|
||
} | ||
} | ||
|
||
|
@@ -64,89 +63,93 @@ kotlin { | |
} | ||
} | ||
|
||
// val iosArm64Main by getting | ||
// // val iosSimulatorArm64Main by getting | ||
// val iosMain by creating { | ||
// dependsOn(commonMain) | ||
// iosArm64Main.dependsOn(this) | ||
// // iosSimulatorArm64Main.dependsOn(this) | ||
// dependencies { | ||
// implementation(libs.ktor.client.darwin) | ||
// } | ||
// } | ||
// // iOS Targets | ||
val iosArm64Main by getting | ||
val iosX64Main by getting | ||
val iosSimulatorArm64Main by getting | ||
val iosMain by creating { | ||
dependsOn(commonMain) | ||
iosX64Main.dependsOn(this) | ||
iosArm64Main.dependsOn(this) | ||
iosSimulatorArm64Main.dependsOn(this) | ||
dependencies { | ||
implementation(libs.ktor.client.darwin) | ||
} | ||
} | ||
} | ||
} | ||
|
||
mavenPublishing { | ||
// Automatically configures Sonatype repository and credentials | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) | ||
|
||
coordinates( | ||
groupId = "io.github.thearchitect123", | ||
artifactId = "appInsights", | ||
version = "0.7.0" | ||
) | ||
|
||
pom { | ||
name.set("KmpAppInsights") | ||
description.set("An AppInsights Client for Kotlin Multiplatform. Supports both iOS & Android") | ||
inceptionYear.set("2024") | ||
url.set("https://github.com/TheArchitect123/KmpAppInsights") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
|
||
afterEvaluate { | ||
mavenPublishing { | ||
// Define coordinates for the published artifact | ||
coordinates( | ||
groupId = "io.github.thearchitect123", | ||
artifactId = "appInsights", | ||
version = "0.6.1" | ||
) | ||
|
||
// Configure POM metadata for the published artifact | ||
pom { | ||
name.set("KmpAppInsights") | ||
description.set("An AppInsights Client for Kotlin Multiplatform. Supports both iOS & Android") | ||
inceptionYear.set("2024") | ||
url.set("https://github.com/TheArchitect123/KmpAppInsights") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("Dan Gerchcovich") | ||
name.set("TheArchitect123") | ||
email.set("[email protected]") | ||
// Specify developers information | ||
developers { | ||
developer { | ||
id.set("Dan Gerchcovich") | ||
name.set("TheArchitect123") | ||
email.set("[email protected]") | ||
} | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:git://github.com/TheArchitect123/KmpAppInsights.git") | ||
developerConnection.set("scm:git:ssh://git@github.com:TheArchitect123/KmpAppInsights.git") | ||
url.set("https://github.com/TheArchitect123/KmpAppInsights") | ||
// Specify SCM information | ||
scm { | ||
url.set("https://github.com/TheArchitect123/KmpAppInsights") | ||
} | ||
} | ||
|
||
// Configure publishing to Maven Central | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) | ||
|
||
// Enable GPG signing for all publications | ||
signAllPublications() | ||
} | ||
} | ||
|
||
signing { | ||
val privateKey = System.getenv("GPG_PRIVATE_KEY") | ||
val passphrase = System.getenv("GPG_PASSPHRASE") | ||
val privateKeyFile = project.properties["signing.privateKeyFile"] as? String | ||
?: error("No Private key file found") | ||
val passphrase = project.properties["signing.password"] as? String | ||
?: error("No Passphrase found for signing") | ||
|
||
if (privateKey.isNullOrBlank() || passphrase.isNullOrBlank()) { | ||
throw GradleException("GPG signing key and passphrase must be provided as environment variables") | ||
} | ||
// Read the private key from the file | ||
val privateKey = File(privateKeyFile).readText(Charsets.UTF_8) | ||
|
||
useInMemoryPgpKeys(privateKey, passphrase) | ||
sign(publishing.publications) | ||
} | ||
|
||
//tasks.named("sourcesJar").configure { dependsOn(":shared:kspCommonMainKotlinMetadata") } | ||
tasks.register("buildAllPlatformsAndPublish") { | ||
dependsOn( | ||
"clean", | ||
"assembleRelease", | ||
//":shared:linkReleaseFrameworkIosArm64", | ||
":shared:publishToMavenCentral" | ||
) | ||
} | ||
|
||
dependencies { | ||
with("de.jensklingenberg.ktorfit:ktorfit-ksp:2.0.1") { | ||
add("kspAndroid", this) | ||
//add("kspIosArm64", this) | ||
//add("kspIosSimulatorArm64", this) | ||
//add("kspIosX64", this) | ||
add("kspIosArm64", this) | ||
add("kspIosSimulatorArm64", this) | ||
add("kspIosX64", this) | ||
} | ||
} | ||
|
||
tasks.named("sourcesJar").configure { dependsOn(":shared:kspCommonMainKotlinMetadata") } | ||
|
||
ksp { | ||
arg("moduleName", project.name) | ||
} | ||
|