Skip to content

Commit b30233e

Browse files
committed
Enable cocoapods publishing
1 parent 75f81d5 commit b30233e

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SONATYPE_HOST=DEFAULT
1818
RELEASE_SIGNING_ENABLED=true
1919

2020
GROUP=co.touchlab.kmmbridge
21-
VERSION_NAME=1.1.0-a2
21+
VERSION_NAME=1.1.0-a3
2222
VERSION_NAME_3x=0.3.7
2323

2424
POM_URL=https://github.com/touchlab/KMMBridge

kmmbridge/src/main/kotlin/co/touchlab/kmmbridge/KMMBridge.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ abstract class BaseKMMBridgePlugin : Plugin<Project> {
134134
artifactManager.configure(this, version.toString(), uploadTask, publishRemoteTask)
135135

136136
for (dependencyManager in dependencyManagers) {
137-
dependencyManager.configure(providers, this, uploadTask, publishRemoteTask)
137+
dependencyManager.configure(providers, this, version.toString(), uploadTask, publishRemoteTask)
138138
}
139139
}
140140

kmmbridge/src/main/kotlin/co/touchlab/kmmbridge/dependencymanager/CocoapodsDependencyManager.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ internal class CocoapodsDependencyManager(
4444
override fun configure(
4545
providers: ProviderFactory,
4646
project: Project,
47+
version: String,
4748
uploadTask: TaskProvider<Task>,
4849
publishRemoteTask: TaskProvider<Task>
4950
) {
@@ -64,7 +65,7 @@ internal class CocoapodsDependencyManager(
6465
doLast(object : Action<Task> {
6566
override fun execute(t: Task) {
6667
generatePodspec(
67-
cocoapodsExtension, urlFileLocal, podSpecFile, frameworkName
68+
cocoapodsExtension, urlFileLocal, version, podSpecFile, frameworkName
6869
)
6970
}
7071
})
@@ -74,6 +75,7 @@ internal class CocoapodsDependencyManager(
7475
group = TASK_GROUP_NAME
7576
inputs.files(podSpecFile)
7677
dependsOn(generatePodspecTask)
78+
outputs.upToDateWhen { false } // We want to always upload when this task is called
7779

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

100-
is SpecRepo.Private ->
101-
providers.exec {
102+
is SpecRepo.Private -> {
103+
val execOutput = providers.exec {
102104
commandLine(
103105
"pod",
104106
"repo",
@@ -108,6 +110,13 @@ internal class CocoapodsDependencyManager(
108110
*extras.toTypedArray()
109111
)
110112
}
113+
logger.info(execOutput.standardOutput.asText.get())
114+
val errorOut = execOutput.standardError.asText.get()
115+
val anyError = errorOut.lines().filter { it.isNotBlank() }.isNotEmpty()
116+
if(anyError){
117+
logger.error(errorOut)
118+
}
119+
}
111120
}
112121
}
113122
})
@@ -143,6 +152,7 @@ private fun findFrameworkName(project: Project): org.gradle.api.provider.Provide
143152
private fun generatePodspec(
144153
cocoapodsExtension: CocoapodsExtension,
145154
urlFile: File,
155+
projectVersion:String,
146156
outputFile: File,
147157
frameworkName: Provider<String>
148158
) = with(cocoapodsExtension) {
@@ -167,7 +177,7 @@ private fun generatePodspec(
167177
val customSpec = extraSpecAttributes.map { "| spec.${it.key} = ${it.value}" }.joinToString("\n")
168178

169179
val url = urlFile.readText()
170-
val version = version.toString()
180+
val version = version ?: projectVersion
171181

172182
// 'Accept: application/octet-stream' needed for GitHub release file downloads
173183
outputFile.writeText(

kmmbridge/src/main/kotlin/co/touchlab/kmmbridge/dependencymanager/DependencyManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ interface DependencyManager {
2626
fun configure(
2727
providers: ProviderFactory,
2828
project: Project,
29+
version: String,
2930
uploadTask: TaskProvider<Task>,
3031
publishRemoteTask: TaskProvider<Task>
3132
) {

kmmbridge/src/main/kotlin/co/touchlab/kmmbridge/dependencymanager/SpmDependencyManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ internal class SpmDependencyManager(
7575
override fun configure(
7676
providers: ProviderFactory,
7777
project: Project,
78+
version: String,
7879
uploadTask: TaskProvider<Task>,
7980
publishRemoteTask: TaskProvider<Task>
8081
) {

0 commit comments

Comments
 (0)