Skip to content

Commit

Permalink
Use metaborg-git
Browse files Browse the repository at this point in the history
  • Loading branch information
Virtlink committed Jul 24, 2024
1 parent fb992a0 commit 48b98bd
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 1,047 deletions.
14 changes: 14 additions & 0 deletions example/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
dependencyResolutionManagement {
repositories {
maven("https://artifacts.metaborg.org/content/groups/public/")
mavenCentral()
}
}

pluginManagement {
repositories {
maven("https://artifacts.metaborg.org/content/groups/public/")
gradlePluginPortal()
}
}

rootProject.name = "gitonium-example-project"

includeBuild("../plugin/")
Expand Down
12 changes: 8 additions & 4 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ plugins {
description = "A Git-based versioning plugin for Gradle."

dependencies {
testImplementation (libs.kotest)
testImplementation (libs.kotest.assertions)
testImplementation (libs.kotest.datatest)
testImplementation (libs.kotest.property)
implementation(platform(libs.metaborg.platform))

implementation(libs.metaborg.git)
implementation(testFixtures(libs.metaborg.git))
testImplementation(libs.kotest)
testImplementation(libs.kotest.assertions)
testImplementation(libs.kotest.datatest)
testImplementation(libs.kotest.property)
}

gradlePlugin {
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/kotlin/mb/gitonium/CommandUtils.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mb.gitonium

import mb.gitonium.git.CommandException
import org.metaborg.git.CommandException
import java.io.File
import java.io.IOException
import kotlin.jvm.Throws
Expand Down
12 changes: 6 additions & 6 deletions plugin/src/main/kotlin/mb/gitonium/GitoniumVersion.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package mb.gitonium

import mb.gitonium.git.CommandException
import mb.gitonium.git.GitRepo
import mb.gitonium.git.NativeGitRepo
import org.gradle.api.Project
import org.metaborg.git.CommandException
import org.metaborg.git.GitRepo
import org.metaborg.git.NativeGit
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.io.File
Expand Down Expand Up @@ -130,16 +130,16 @@ data class GitoniumVersion(
* @throws IOException If an I/O error occurs, or if Git is not available.
*/
private fun getGitRepo(repoDirectory: File): GitRepo? {
val repo = NativeGitRepo(repoDirectory)

// Ensure Git is available
val git = NativeGit()
try {
repo.getGitVersion() ?: throw IOException("Git is not available.")
git.getGitVersion() ?: throw IOException("Git is not available.")
} catch (e: IOException) {
throw IOException("Git is not available.", e)
}

// Ensure the directory exists and is a Git repository
val repo = git.open(repoDirectory)
try {
repo.getStatus()
} catch (e: CommandException) {
Expand Down
17 changes: 0 additions & 17 deletions plugin/src/main/kotlin/mb/gitonium/git/CommandException.kt

This file was deleted.

150 changes: 0 additions & 150 deletions plugin/src/main/kotlin/mb/gitonium/git/GitRepo.kt

This file was deleted.

152 changes: 0 additions & 152 deletions plugin/src/main/kotlin/mb/gitonium/git/NativeGitRepo.kt

This file was deleted.

Loading

0 comments on commit 48b98bd

Please sign in to comment.