Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ValueSource to run pod commands for CocoaPods publishing #278

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

KevinSchildhorn
Copy link
Contributor

@KevinSchildhorn KevinSchildhorn commented Jan 17, 2025

Issue: #267

Summary

Moving pod calls to use a ValueSource.

Fix

  • Using a ValueSource instead
  • If there's an exitValue error, we catch it and then throw the underlying error
  • Some formatting

Testing

  • ./gradlew test
  • ./gradlew build
  • manual testing

before

> Task :allshared:pushRemotePodspec FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':allshared:pushRemotePodspec'.
> Process 'command 'pod'' finished with non-zero exit value 1

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':allshared:pushRemotePodspec'.
Caused by: org.gradle.process.internal.ExecException: Process 'command 'pod'' finished with non-zero exit value 1
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:442)
        at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:38)
        at org.gradle.process.internal.DefaultExecActionFactory.exec(DefaultExecActionFactory.java:202)
        at org.gradle.process.internal.DefaultExecOperations.exec(DefaultExecOperations.java:37)
        at org.gradle.api.internal.provider.sources.process.ProcessOutputValueSource.obtain(ProcessOutputValueSource.java:123)
        at org.gradle.api.internal.provider.sources.process.ProcessOutputValueSource.obtain(ProcessOutputValueSource.java:37)
        at org.gradle.api.internal.provider.DefaultValueSourceProviderFactory$LazilyObtainedValue.lambda$new$0(DefaultValueSourceProviderFactory.java:294)
        at org.gradle.internal.model.CalculatedValueContainerFactory$SupplierBackedCalculator.calculateValue(CalculatedValueContainerFactory.java:78)
        at org.gradle.internal.model.CalculatedValueContainer$CalculationState.lambda$attachValue$0(CalculatedValueContainer.java:228)
        at org.gradle.internal.Try.ofFailable(Try.java:50)
        at org.gradle.internal.model.CalculatedValueContainer$CalculationState.attachValue(CalculatedValueContainer.java:223)
        at org.gradle.internal.model.CalculatedValueContainer.finalizeIfNotAlready(CalculatedValueContainer.java:194)
        at org.gradle.internal.model.CalculatedValueContainer.finalizeIfNotAlready(CalculatedValueContainer.java:185)
        at org.gradle.api.internal.provider.DefaultValueSourceProviderFactory$LazilyObtainedValue.obtain(DefaultValueSourceProviderFactory.java:309)
        at org.gradle.api.internal.provider.DefaultValueSourceProviderFactory$ValueSourceProvider.calculateOwnValue(DefaultValueSourceProviderFactory.java:261)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:115)
        at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:81)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:115)
        at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:81)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateOwnPresentValue(AbstractMinimalProvider.java:80)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:100)
        at co.touchlab.kmmbridge.dependencymanager.CocoapodsDependencyManager$configure$pushRemotePodspecTask$1$2.execute(CocoapodsDependencyManager.kt:155)
        at co.touchlab.kmmbridge.dependencymanager.CocoapodsDependencyManager$configure$pushRemotePodspecTask$1$2.execute(CocoapodsDependencyManager.kt:122)

after

> Task :allshared:pushRemotePodspec FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':allshared:pushRemotePodspec'.
> Cloning spec repo `kevinschildhorn-kmmbridgetest_pods` from `[email protected]:KevinSchildhorn/KMMBridgeTest_Pods.git`
  [!] Unable to find the `[email protected]:KevinSchildhorn/KMMBridgeTest_Pods.git` repo. If it has not yet been cloned, add it via `pod repo add`.


* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':allshared:pushRemotePodspec'.
Caused by: org.gradle.process.internal.ExecException: Cloning spec repo `kevinschildhorn-kmmbridgetest_pods` from `[email protected]:KevinSchildhorn/KMMBridgeTest_Pods.git`
[!] Unable to find the `[email protected]:KevinSchildhorn/KMMBridgeTest_Pods.git` repo. If it has not yet been cloned, add it via `pod repo add`.

        at co.touchlab.kmmbridge.dependencymanager.PodPushValueSource.obtain(CocoapodsDependencyManager.kt:85)
        at co.touchlab.kmmbridge.dependencymanager.PodPushValueSource.obtain(CocoapodsDependencyManager.kt:66)
        at org.gradle.api.internal.provider.DefaultValueSourceProviderFactory$LazilyObtainedValue.lambda$new$0(DefaultValueSourceProviderFactory.java:294)

@KevinSchildhorn KevinSchildhorn changed the title Update CocoapodsDependencyManager.kt Use ValueSource to run pod commands for CocoaPods publishing Jan 17, 2025
@KevinSchildhorn KevinSchildhorn linked an issue Jan 17, 2025 that may be closed by this pull request
Copy link
Contributor

@samhill303 samhill303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure ValueSource is needed, but it's working and I don't mind a little more structure

@KevinSchildhorn KevinSchildhorn merged commit b9561e4 into main Jan 23, 2025
2 checks passed
@KevinSchildhorn KevinSchildhorn deleted the ks/CocoapodsUssValueSource branch January 23, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants