Skip to content

Commit

Permalink
Enable cocoapods publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Dec 2, 2024
1 parent 75f81d5 commit b30233e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true

GROUP=co.touchlab.kmmbridge
VERSION_NAME=1.1.0-a2
VERSION_NAME=1.1.0-a3
VERSION_NAME_3x=0.3.7

POM_URL=https://github.com/touchlab/KMMBridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ abstract class BaseKMMBridgePlugin : Plugin<Project> {
artifactManager.configure(this, version.toString(), uploadTask, publishRemoteTask)

for (dependencyManager in dependencyManagers) {
dependencyManager.configure(providers, this, uploadTask, publishRemoteTask)
dependencyManager.configure(providers, this, version.toString(), uploadTask, publishRemoteTask)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ internal class CocoapodsDependencyManager(
override fun configure(
providers: ProviderFactory,
project: Project,
version: String,
uploadTask: TaskProvider<Task>,
publishRemoteTask: TaskProvider<Task>
) {
Expand All @@ -64,7 +65,7 @@ internal class CocoapodsDependencyManager(
doLast(object : Action<Task> {
override fun execute(t: Task) {
generatePodspec(
cocoapodsExtension, urlFileLocal, podSpecFile, frameworkName
cocoapodsExtension, urlFileLocal, version, podSpecFile, frameworkName
)
}
})
Expand All @@ -74,6 +75,7 @@ internal class CocoapodsDependencyManager(
group = TASK_GROUP_NAME
inputs.files(podSpecFile)
dependsOn(generatePodspecTask)
outputs.upToDateWhen { false } // We want to always upload when this task is called

@Suppress("ObjectLiteralToLambda")
doLast(object : Action<Task> {
Expand All @@ -97,8 +99,8 @@ internal class CocoapodsDependencyManager(
}.standardOutput.asText.get()
}

is SpecRepo.Private ->
providers.exec {
is SpecRepo.Private -> {
val execOutput = providers.exec {
commandLine(
"pod",
"repo",
Expand All @@ -108,6 +110,13 @@ internal class CocoapodsDependencyManager(
*extras.toTypedArray()
)
}
logger.info(execOutput.standardOutput.asText.get())
val errorOut = execOutput.standardError.asText.get()
val anyError = errorOut.lines().filter { it.isNotBlank() }.isNotEmpty()
if(anyError){
logger.error(errorOut)
}
}
}
}
})
Expand Down Expand Up @@ -143,6 +152,7 @@ private fun findFrameworkName(project: Project): org.gradle.api.provider.Provide
private fun generatePodspec(
cocoapodsExtension: CocoapodsExtension,
urlFile: File,
projectVersion:String,
outputFile: File,
frameworkName: Provider<String>
) = with(cocoapodsExtension) {
Expand All @@ -167,7 +177,7 @@ private fun generatePodspec(
val customSpec = extraSpecAttributes.map { "| spec.${it.key} = ${it.value}" }.joinToString("\n")

val url = urlFile.readText()
val version = version.toString()
val version = version ?: projectVersion

// 'Accept: application/octet-stream' needed for GitHub release file downloads
outputFile.writeText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface DependencyManager {
fun configure(
providers: ProviderFactory,
project: Project,
version: String,
uploadTask: TaskProvider<Task>,
publishRemoteTask: TaskProvider<Task>
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ internal class SpmDependencyManager(
override fun configure(
providers: ProviderFactory,
project: Project,
version: String,
uploadTask: TaskProvider<Task>,
publishRemoteTask: TaskProvider<Task>
) {
Expand Down

0 comments on commit b30233e

Please sign in to comment.