From 07fdbae23d7b7880510b8de20d2937aad4f28b7c Mon Sep 17 00:00:00 2001 From: Gokhun Celik Date: Mon, 13 Feb 2023 01:01:50 +0100 Subject: [PATCH] Fix homebrew install directory --- README.md | 12 ++++++++++++ build.gradle | 24 +++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9f0077f..1c232c3 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,18 @@ This is a data file converter that supports following files: - [TOML](https://toml.io/en/) - [properties](https://en.wikipedia.org/wiki/.properties) +## Install + +```shell +brew install ghokun/tap/convert + +# or +brew tap ghokun/tap +brew install convert + +# Windows users can download from releases page +``` + ## Usage ```bash diff --git a/build.gradle b/build.gradle index c40d97e..5c3bc32 100644 --- a/build.gradle +++ b/build.gradle @@ -67,16 +67,30 @@ final class VersionProvider implements picocli.CommandLine.IVersionProvider { } } -tasks.register("generatePackage", Zip) { +def osName = os.isMacOsX() ? os.getNativePrefix() : os.getFamilyName() +def arch = System.getProperty("os.arch") +def archiveName = "${project.name}-${project.version}-${osName}-${arch == 'amd64' ? 'x86_64' : arch}" + +tasks.register("copyBinaries", Copy) { group = taskGroup dependsOn("nativeCompile") - def osName = os.isMacOsX() ? os.getNativePrefix() : os.getFamilyName() - def arch = System.getProperty("os.arch") - archiveFileName = "${project.name}-${project.version}-${osName}-${arch == 'amd64' ? 'x86_64' : arch}.zip" + def binDir = file("${buildDir}/native/${archiveName}/bin/") + binDir.parentFile.mkdirs() + + from os.isWindows() ? "${buildDir}/native/nativeCompile/convert.exe" : "${buildDir}/native/nativeCompile/convert" + into binDir +} + +tasks.register("generatePackage", Zip) { + group = taskGroup + dependsOn("copyBinaries") + + archiveFileName = "${archiveName}.zip" destinationDirectory = layout.buildDirectory.dir("dist") - from layout.buildDirectory.files("native/nativeCompile/convert", "native/nativeCompile/convert.exe") + from layout.buildDirectory.dir("native") + include "${archiveName}/**" } sourceSets.main.java.srcDirs += generatedSources