Skip to content

Commit

Permalink
[none] fully removing grgit from tagger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfmurdock committed Sep 21, 2024
1 parent 3c9916d commit c20f04c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 63 deletions.
1 change: 0 additions & 1 deletion tools/git-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ kotlin {
dependencies {
commonMainImplementation(platform(project(":dependency-bom")))
commonMainImplementation(project(":git-adapter"))
"jvmMainApi"(libs.org.ajoberstar.grgit.grgit.core)
"jvmMainApi"(kotlin("test-junit5", embeddedKotlinVersion))
"jvmMainApi"("org.junit.jupiter:junit-jupiter-api")
"jvmMainApi"("org.junit.jupiter:junit-jupiter-engine")
Expand Down
1 change: 0 additions & 1 deletion tools/tagger-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
commonMainImplementation(platform(project(":dependency-bom")))
commonMainImplementation(project(":tagger-core"))
commonMainApi(project(":git-test"))
"jvmMainApi"(libs.org.ajoberstar.grgit.grgit.core)
"jvmMainApi"(kotlin("test-junit5", embeddedKotlinVersion))
"jvmMainApi"("org.junit.jupiter:junit-jupiter-api")
"jvmMainApi"("org.junit.jupiter:junit-jupiter-engine")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package com.zegreatrob.tools.tagger

import com.zegreatrob.tools.adapter.git.GitAdapter
import com.zegreatrob.tools.test.git.addCommitWithMessage
import com.zegreatrob.tools.test.git.initializeGitRepo
import org.ajoberstar.grgit.Grgit
import org.ajoberstar.grgit.operation.AddOp
import org.ajoberstar.grgit.operation.CommitOp
import org.ajoberstar.grgit.operation.RemoteAddOp
import org.ajoberstar.grgit.operation.TagAddOp
import java.io.File
import kotlin.test.Test
import kotlin.test.assertContains
Expand Down Expand Up @@ -63,29 +59,11 @@ interface CalculateVersionTestSpec {
val gitAdapter = GitAdapter(projectDir.absolutePath)
gitAdapter.init()
gitAdapter.config("commit.gpgsign", "false")
val grgit = Grgit.open(mapOf("dir" to projectDir.absolutePath))
grgit.add(
fun(it: AddOp) {
it.patterns = setOf(".")
},
)
grgit.commit(
fun(it: CommitOp) {
it.message = "test commit"
},
)
grgit.tag.add(
fun(it: TagAddOp) {
it.name = "1.0.23"
},
)
grgit.checkout(mapOf<String?, Any>("branch" to "main", "createBranch" to true))
grgit.remote.add(
fun(it: RemoteAddOp) {
it.name = "origin"
it.url = projectDir.absolutePath
},
)
gitAdapter.add(".")
gitAdapter.addCommitWithMessage("test commit")
gitAdapter.newAnnotatedTag("1.0.23", "HEAD", null, null)
gitAdapter.checkout("main", newBranch = true)
gitAdapter.addRemote("origin", projectDir.absolutePath)
val version = runCalculateVersionSuccessfully()

assertEquals("1.0.23-SNAPSHOT", version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package com.zegreatrob.tools.tagger
import com.zegreatrob.tools.adapter.git.GitAdapter
import com.zegreatrob.tools.adapter.git.runProcess
import com.zegreatrob.tools.tagger.core.TagErrors
import org.ajoberstar.grgit.Grgit
import org.ajoberstar.grgit.operation.CommitOp
import org.ajoberstar.grgit.operation.InitOp
import com.zegreatrob.tools.test.git.addCommitWithMessage
import org.junit.jupiter.api.Assertions.assertNotEquals
import java.io.File
import kotlin.io.path.absolutePathString
Expand Down Expand Up @@ -62,14 +60,11 @@ interface TagTestSpec {
configureWithDefaults()

val originDirectory = createTempDirectory()
val originGrgit = Grgit.init(fun InitOp.() {
this.dir = originDirectory.absolutePathString()
})
val originGitAdapter = GitAdapter(originDirectory.absolutePathString())
originGitAdapter.init()
originGitAdapter.config("receive.denyCurrentBranch", "ignore")
originGitAdapter.disableGpgSign()
originGrgit.commit(fun CommitOp.() {
this.message = "init"
})
originGitAdapter.addCommitWithMessage("init")
val gitAdapter = initializeGitRepo(
listOf("init", "[patch] commit 1", "[patch] commit 2"),
remoteUrl = originDirectory.absolutePathString(),
Expand Down Expand Up @@ -100,14 +95,11 @@ interface TagTestSpec {
)

val originDirectory = createTempDirectory()
val originGrgit = Grgit.init(fun InitOp.() {
this.dir = originDirectory.absolutePathString()
})
val originGitAdapter = GitAdapter(originDirectory.absolutePathString())
originGitAdapter.init()
originGitAdapter.config("receive.denyCurrentBranch", "ignore")
originGitAdapter.disableGpgSign()
originGrgit.commit(fun CommitOp.() {
this.message = "init"
})
originGitAdapter.addCommitWithMessage("init")
val gitAdapter = initializeGitRepo(
listOf("init", "[patch] commit 1", "[patch] commit 2"),
remoteUrl = originDirectory.absolutePathString(),
Expand All @@ -126,14 +118,11 @@ interface TagTestSpec {
configureWithOverrides(releaseBranch = "master", warningsAsErrors = true)

val originDirectory = createTempDirectory()
val originGrgit = Grgit.init(fun InitOp.() {
this.dir = originDirectory.absolutePathString()
})
val originGitAdapter = GitAdapter(originDirectory.absolutePathString())
originGitAdapter.init()
originGitAdapter.config("receive.denyCurrentBranch", "ignore")
originGitAdapter.disableGpgSign()
originGrgit.commit(fun CommitOp.() {
this.message = "init"
})
originGitAdapter.addCommitWithMessage("init")
val gitAdapter = initializeGitRepo(
listOf("init", "[patch] commit 1", "[patch] commit 2"),
remoteUrl = originDirectory.absolutePathString(),
Expand All @@ -154,14 +143,11 @@ interface TagTestSpec {
configureWithOverrides(releaseBranch = "trunk", warningsAsErrors = true)

val originDirectory = createTempDirectory()
val originGrgit = Grgit.init(fun InitOp.() {
this.dir = originDirectory.absolutePathString()
})
val originGitAdapter = GitAdapter(originDirectory.absolutePathString())
originGitAdapter.init()
originGitAdapter.config("receive.denyCurrentBranch", "ignore")
originGitAdapter.disableGpgSign()
originGrgit.commit(fun CommitOp.() {
this.message = "init"
})
originGitAdapter.addCommitWithMessage("init")
val gitAdapter = initializeGitRepo(
listOf("init", "[patch] commit 1", "[patch] commit 2"),
remoteUrl = originDirectory.absolutePathString(),
Expand All @@ -185,14 +171,11 @@ interface TagTestSpec {
configureWithOverrides(releaseBranch = "trunk", warningsAsErrors = false)

val originDirectory = createTempDirectory()
val originGrgit = Grgit.init(fun InitOp.() {
this.dir = originDirectory.absolutePathString()
})
val originGitAdapter = GitAdapter(originDirectory.absolutePathString())
originGitAdapter.init()
originGitAdapter.config("receive.denyCurrentBranch", "ignore")
originGitAdapter.disableGpgSign()
originGrgit.commit(fun CommitOp.() {
this.message = "init"
})
originGitAdapter.addCommitWithMessage("init")
val gitAdapter = initializeGitRepo(
listOf("init", "[patch] commit 1", "[patch] commit 2"),
remoteUrl = originDirectory.absolutePathString(),
Expand Down

0 comments on commit c20f04c

Please sign in to comment.