diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0145d6f..0000000 --- a/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -buildscript { - ext.junit_version = "4.13.2" -} - -plugins { - id 'java-library' -} - -repositories { - mavenCentral() -} - -group 'uk.co.mainwave.mimetypes' -version getVersionFromGit() - -sourceCompatibility = JavaVersion.VERSION_1_8 - -dependencies { - testImplementation "junit:junit:$junit_version" -} - -def getVersionFromGit() { - try { - def stdout = new ByteArrayOutputStream() - exec { - commandLine "git", "describe", "--tags", "--always" - standardOutput = stdout - } - return stdout.toString().trim() - } catch (ignored) { - return "1.0.0" - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..b018450 --- /dev/null +++ b/build.gradle.kts @@ -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" + } +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index f5acecc..0000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'mimetypes' - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..c99f91e --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "mimetypes" +