11package co.touchlab.faktory
22
3- import co.touchlab.faktory.co.touchlab.faktory.internal.GithubCalls
4- import co.touchlab.faktory.co.touchlab.faktory.internal.procRunFailLog
3+ import co.touchlab.faktory.internal.procRunFailLog
54import org.gradle.api.Project
65import org.gradle.api.Task
76import java.io.ByteArrayOutputStream
@@ -13,14 +12,8 @@ class SpmDependencyManager(
1312 * Folder where the Package.swift file lives
1413 */
1514 private val swiftPackageFolder : String ,
16- private val commitVersionStrategy : CommitVersionStrategy ,
1715 private val packageName : String
1816) : DependencyManager {
19-
20- enum class CommitVersionStrategy {
21- None , GitTag , GithubRelease
22- }
23-
2417 private val swiftPackageFilePath: String
2518 get() = " ${stripEndSlash(swiftPackageFolder)} /Package.swift"
2619
@@ -31,36 +24,16 @@ class SpmDependencyManager(
3124 inputs.files(zipFile, project.urlFile, project.versionFile)
3225
3326 doLast {
34- val originalPackageFile = project.readPackageFile()
35-
3627 val checksum = project.findSpmChecksum(zipFile)
3728 val url = project.urlFile.readText()
3829
3930 project.writePackageFile(packageName, url, checksum)
31+
4032 val version = project.versionFile.readText()
4133
42- if (commitVersionStrategy != CommitVersionStrategy .None ) {
43-
44- project.procRunFailLog(" git" , " add" , " ." )
45- project.procRunFailLog(" git" , " commit" , " -m" , " KMM SPM package release for $version " )
46- if (commitVersionStrategy == CommitVersionStrategy .GitTag ) {
47- project.procRunFailLog(" git" , " tag" , " -a" , version, " -m" , " KMM release version $version " )
48- } else {
49- project.procRunFailLog(" git" , " push" )
50- val commitId = project.procRunFailLog(" git" , " rev-parse" , " HEAD" ).first()
51- GithubCalls .createRelease(project, project.githubRepo, version, commitId)
52- }
53-
54- project.writePackageFile(originalPackageFile)
55-
56- project.procRunFailLog(" git" , " add" , " ." )
57- project.procRunFailLog(" git" , " commit" , " -m" , " KMM SPM package file revert" )
58- if (commitVersionStrategy == CommitVersionStrategy .GitTag ) {
59- project.procRunFailLog(" git" , " push" , " --follow-tags" )
60- } else {
61- project.procRunFailLog(" git" , " push" )
62- }
63- }
34+ project.procRunFailLog(" git" , " add" , " ." )
35+ project.procRunFailLog(" git" , " commit" , " -m" , " KMM SPM package release for $version " )
36+ project.procRunFailLog(" git" , " push" )
6437 }
6538 }
6639
0 commit comments