Skip to content

Commit

Permalink
Convert Gradle scripts to Kotlin (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
markwhitaker authored Jul 7, 2024
1 parent 23080eb commit 6387ab1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 35 deletions.
33 changes: 0 additions & 33 deletions build.gradle

This file was deleted.

35 changes: 35 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.io.BufferedReader
import java.io.InputStreamReader

plugins {
`java-library`
}

val junitVersion = "4.13.2"

repositories {
mavenCentral()
}

group = "uk.co.mainwave.mimetypes"
version = getVersionFromGit()

java.sourceCompatibility = JavaVersion.VERSION_1_8

dependencies {
testImplementation("junit:junit:$junitVersion")
}

fun getVersionFromGit(): String {
val processBuilder = ProcessBuilder(listOf("git", "describe", "--tags", "--always"))
try {
val process = processBuilder.start()
val reader = BufferedReader(InputStreamReader(process.inputStream))
val output = StringBuilder()
output.append(reader.readLine())
process.waitFor()
return output.toString()
} catch (e: Exception) {
return "1.0.0"
}
}
2 changes: 0 additions & 2 deletions settings.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = "mimetypes"

0 comments on commit 6387ab1

Please sign in to comment.