From 03abf45bebb2964e1081ccff47cf372aed953b56 Mon Sep 17 00:00:00 2001 From: Cardinal Date: Thu, 7 Mar 2024 00:33:11 +0100 Subject: [PATCH] gh actions --- .github/workflows/release.yml | 82 +++++++++++++++++++++ .github/workflows/test.yml | 21 ++++++ Dockerfile | 39 ---------- Makefile | 6 +- assets/embded_linux.go | 2 +- build.sh | 5 +- build/cmd/main.go | 101 -------------------------- build/cmd/path.go | 40 ---------- build/cmd/sub_cmd.go | 47 ------------ build/go.mod | 21 ------ build/go.sum | 26 ------- build/internal/consts/target.go | 16 ---- build/internal/docker/docker_run.go | 30 -------- build/internal/docker/imagemagick.go | 70 ------------------ build/internal/fsutil/copy_file.go | 36 --------- build/internal/fsutil/rename_file.go | 15 ---- build/internal/go_build.go | 105 --------------------------- build/internal/iconset.go | 37 ---------- build/internal/macos/bundle_path.go | 21 ------ build/internal/pack_macos.go | 44 ----------- build/internal/win_res.go | 33 --------- cmd/.gitignore | 1 + cmd/cliagent/main.go | 1 - cmd/internal/.gitignore | 1 - cmd/internal/syso.go | 6 -- cmd/testagent/main.go | 7 -- cmd/trayagent/main.go | 1 - go.mod | 20 ++--- go.sum | 46 ++++++------ xgo-pack-config.yaml | 55 ++++++++++++++ 30 files changed, 195 insertions(+), 740 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml delete mode 100644 Dockerfile delete mode 100644 build/cmd/main.go delete mode 100644 build/cmd/path.go delete mode 100644 build/cmd/sub_cmd.go delete mode 100644 build/go.mod delete mode 100644 build/go.sum delete mode 100644 build/internal/consts/target.go delete mode 100644 build/internal/docker/docker_run.go delete mode 100644 build/internal/docker/imagemagick.go delete mode 100644 build/internal/fsutil/copy_file.go delete mode 100644 build/internal/fsutil/rename_file.go delete mode 100644 build/internal/go_build.go delete mode 100644 build/internal/iconset.go delete mode 100644 build/internal/macos/bundle_path.go delete mode 100644 build/internal/pack_macos.go delete mode 100644 build/internal/win_res.go create mode 100644 cmd/.gitignore delete mode 100644 cmd/internal/.gitignore delete mode 100644 cmd/internal/syso.go delete mode 100644 cmd/testagent/main.go create mode 100755 xgo-pack-config.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8ba7bd1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: test + +on: + push: + tags: + - "*.*.*" + workflow_dispatch: + pull_request: +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - run: go mod download + - run: go test ./... + - run: go generate ./... + - run: bash build.sh + + - name: Create a Release + id: create_release + uses: shogo82148/actions-create-release@v1 + + - name: Upload Windows amd64 binary + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/windows_amd64/vlc-sync-play.exe + asset_name: vlc-sync-play_win_x64.exe + asset_content_type: application/vnd.microsoft.portable-executable + + - name: Upload MacOS amd64 dmg + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/darwin_amd64/vlc-sync-play.dmg + asset_name: vlc-sync-play_intel.dmg + asset_content_type: application/x-apple-diskimage + + - name: Upload MacOS arm64 dmg + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/darwin_arm64/vlc-sync-play.dmg + asset_name: vlc-sync-play_apple_silicon.dmg + asset_content_type: application/x-apple-diskimage + + - name: Upload Linux x64 bin + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/linux_amd64/vlc-sync-play + asset_name: vlc-sync-play_linux_x64 + asset_content_type: application/x-executable + + - name: Upload Linux x64 deb + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/linux_amd64/vlc-sync-play.deb + asset_name: vlc-sync-play_linux_x64.deb + asset_content_type: application/vnd.debian.binary-package + + - name: Upload Linux arm64 bin + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/linux_arm64/vlc-sync-play + asset_name: vlc-sync-play_linux_arm64 + asset_content_type: application/x-executable + + - name: Upload Linux arm64 deb + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/linux_arm64/vlc-sync-play.deb + asset_name: vlc-sync-play_linux_arm64.deb + asset_content_type: application/vnd.debian.binary-package diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e1aa7ec --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: test + +on: + push: + branches: + - "**" + workflow_dispatch: + pull_request: +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - run: go mod download + - run: go test ./... + - run: bash build.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9cd0c81..0000000 --- a/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM alpine:latest as zigbuild - -RUN apk update && \ - apk add \ - curl \ - xz \ - tar - -ARG ZIGTAR=zig-linux-x86_64-0.12.0-dev.2285+b80cad248.tar.xz - -RUN mkdir -p /deps/zig - -RUN curl -L https://ziglang.org/builds/$ZIGTAR | \ - tar -xJ --strip-components=1 -C /deps/zig/ - -FROM crazymax/osxcross:latest-alpine AS osxcross - -FROM --platform=linux/amd64 golang:1.21 - -COPY /zigtool /zigtool -RUN cd /zigtool/zigcc && go install -RUN cd /zigtool/zigcpp && go install - -COPY --from=zigbuild /deps/zig/ /deps/zig/ - -COPY --from=osxcross /osxcross/SDK/MacOSX13.1.sdk /osxsdk - -ENV PATH="${PATH}:/deps/zig/" -ENV CGO_CPPFLAGS="-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wdeprecated-declarations" - -# MACOS -ENV OSXSDK="/osxsdk" -ENV CC="zigcc --sysroot=${OSXSDK} -I${OSXSDK}/usr/include -L${OSXSDK}/usr/lib -F${OSXSDK}/System/Library/Frameworks" -ENV CXX="zigcpp --sysroot=${OSXSDK} -I${OSXSDK}/usr/include -L${OSXSDK}/usr/lib -F${OSXSDK}/System/Library/Frameworks" -ENV CGO_CPPFLAGS="-w" -# -framework Cocoa -# LINUX -#ENV CC="zigcc" -#ENV CXX="zigcpp" \ No newline at end of file diff --git a/Makefile b/Makefile index 28bc877..c88d59f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,4 @@ SHELL = bash go_generate: - go generate ./... - -build: - cd build/cmd - go run . \ No newline at end of file + go generate ./... \ No newline at end of file diff --git a/assets/embded_linux.go b/assets/embded_linux.go index 64165d1..4608a5e 100644 --- a/assets/embded_linux.go +++ b/assets/embded_linux.go @@ -8,7 +8,7 @@ import "embed" var IconFS embed.FS func GetTrayIcon() []byte { - data, err := IconFS.ReadFile("icons/tray_icon.png") + data, err := IconFS.ReadFile("generated/tray_icon.png") if err != nil { panic(err) } diff --git a/build.sh b/build.sh index 54eade3..13e4aee 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,4 @@ #!/bin/bash -bash ./go_generate.sh -#cd build/cmd || exit -#VLCSP_ROOT="../.." go run . +go install github.com/cardinalby/xgo-pack +xgo-pack build diff --git a/build/cmd/main.go b/build/cmd/main.go deleted file mode 100644 index cac6805..0000000 --- a/build/cmd/main.go +++ /dev/null @@ -1,101 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - "path" - - commands "github.com/cardinalby/vlc-sync-play/build/internal" - "github.com/cardinalby/vlc-sync-play/build/internal/consts" - "github.com/cardinalby/vlc-sync-play/build/internal/macos" -) - -var rootPath = getRootPath() -var distDir = path.Join(rootPath, "dist") -var tmpDir = path.Join(distDir, "tmp") - -var srcPsdIconPath = path.Join(rootPath, "assets/icons/icon.psd") -var winManifestPath = path.Join(rootPath, "assets/manifest/exe.manifest") -var plistManifestPath = path.Join(rootPath, "assets/manifest/Info.plist") - -const macosBundleFileName = "VLC Sync Play.app" - -var macosBundles = map[consts.Arch]macos.BundlePath{ - consts.ArchAmd64: macos.BundlePath(path.Join(distDir, "macos_amd64", macosBundleFileName)), - consts.ArchArm64: macos.BundlePath(path.Join(distDir, "macos_arm64", macosBundleFileName)), -} - -var dstWinSysoPath = path.Join(rootPath, "cmd/internal/rsrc_windows_amd64.syso") -var iconSetDstFileName = "icon.icns" - -// var trayAgentMainPkgRelPath = path.Join("cmd/trayagent") -var trayAgentMainPkgRelPath = path.Join("cmd/cliagent") - -const binFileName = "vlc-sync-play" - -var windowsAmd64BinPath = path.Join(distDir, "windows_amd64", binFileName+".exe") -var macosAmd64BinPath = path.Join(macosBundles[consts.ArchAmd64].GetBinDir(), binFileName) -var macosArm64BinPath = path.Join(macosBundles[consts.ArchArm64].GetBinDir(), binFileName) -var linuxAmd64BinPath = path.Join(distDir, "linux_amd64", binFileName) -var linuxArm64BinPath = path.Join(distDir, "linux_arm64", binFileName) - -func getCmd(logger *log.Logger) cmd { - return sequential{ - "win_syso": cmdFunc(func() error { - return commands.GenerateWindowsSysoFile( - srcPsdIconPath, winManifestPath, tmpDir, dstWinSysoPath, logger, - ) - }), - "go_build": cmdFunc(func() error { - return commands.GoBuild( - rootPath, - trayAgentMainPkgRelPath, - map[commands.Target]string{ - //{Os: consts.OsWindows, Arch: consts.ArchAmd64}: windowsAmd64BinPath, - //{Os: consts.OsDarwin, Arch: consts.ArchAmd64}: macosAmd64BinPath, - //{Os: consts.OsDarwin, Arch: consts.ArchArm64}: macosArm64BinPath, - //{Os: consts.OsLinux, Arch: consts.ArchAmd64}: linuxAmd64BinPath, - {Os: consts.OsLinux, Arch: consts.ArchArm64}: linuxArm64BinPath, - }, - tmpDir, - logger, - ) - }), - "mac_bundles": cmdFunc(func() error { - return commands.PackMacosBundles( - macosBundles, - srcPsdIconPath, - plistManifestPath, - iconSetDstFileName, - tmpDir, - ) - }), - } -} - -func getLogger() *log.Logger { - isDebug := flag.Bool("debug", false, "enable debug logging") - flag.Parse() - if *isDebug { - return log.New(os.Stdout, "", 1) - } else { - return log.New(io.Discard, "", 0) - } -} - -func main() { - logger := getLogger() - - err := getCmd(logger).run() - if err := os.RemoveAll(tmpDir); err != nil { - logger.Printf("error removing tmp '%s': %v", tmpDir, err) - } - - if err != nil { - _, _ = fmt.Fprintf(os.Stderr, err.Error()) - os.Exit(1) - } -} diff --git a/build/cmd/path.go b/build/cmd/path.go deleted file mode 100644 index e6bff5e..0000000 --- a/build/cmd/path.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "bufio" - "os" - "path" - "path/filepath" -) - -func getWd() string { - wd, err := os.Getwd() - if err != nil { - panic(err) - } - return wd -} - -func getRootPath() (res string) { - defer func() { - doModFilePath := filepath.Join(res, "go.mod") - f, err := os.Open(doModFilePath) - if err != nil { - panic(doModFilePath + " not found") - } - defer func() { - _ = f.Close() - }() - scanner := bufio.NewScanner(f) - if !scanner.Scan() { - panic(doModFilePath + " is empty") - } - if scanner.Text() != "module github.com/cardinalby/vlc-sync-play" { - panic(doModFilePath + " has wrong module name: " + scanner.Text()) - } - }() - if vlcspRoot, ok := os.LookupEnv("VLCSP_ROOT"); ok { - return path.Join(getWd(), vlcspRoot) - } - return path.Join(getWd(), "..") -} diff --git a/build/cmd/sub_cmd.go b/build/cmd/sub_cmd.go deleted file mode 100644 index 1100036..0000000 --- a/build/cmd/sub_cmd.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "fmt" - - "golang.org/x/sync/errgroup" -) - -type cmd interface { - run() error -} - -type concurrent map[string]cmd - -func (c concurrent) run() error { - errGr := errgroup.Group{} - - for name, c := range c { - name := name - c := c - errGr.Go(func() error { - if err := c.run(); err != nil { - return fmt.Errorf("%s: %w", name, err) - } - return nil - }) - } - - return errGr.Wait() -} - -type sequential map[string]cmd - -func (s sequential) run() error { - for name, c := range s { - if err := c.run(); err != nil { - return fmt.Errorf("%s: %w", name, err) - } - } - return nil -} - -type cmdFunc func() error - -func (f cmdFunc) run() error { - return f() -} diff --git a/build/go.mod b/build/go.mod deleted file mode 100644 index dd473db..0000000 --- a/build/go.mod +++ /dev/null @@ -1,21 +0,0 @@ -module github.com/cardinalby/vlc-sync-play/build - -go 1.20 - -require golang.org/x/sync v0.6.0 - -require ( - github.com/jackmordaunt/icns v1.0.0 - github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 - golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e -) - -require ( - github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 // indirect - github.com/akavel/rsrc v0.10.2 // indirect - github.com/cardinalby/xgo-as-library v1.1.3 // indirect - github.com/crazy-max/xgo v0.31.0 // indirect - github.com/pkg/errors v0.9.1 // indirect -) - -replace github.com/cardinalby/xgo-as-library => ../../xgo-as-library diff --git a/build/go.sum b/build/go.sum deleted file mode 100644 index aaf5f40..0000000 --- a/build/go.sum +++ /dev/null @@ -1,26 +0,0 @@ -github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 h1:1ltqoej5GtaWF8jaiA49HwsZD459jqm9YFz9ZtMFpQA= -github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I= -github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= -github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= -github.com/cardinalby/xgo-as-library v1.0.0 h1:U2zli8tpXFBMlQZGp6ybCAl/77pxjx7Za6f8RzEGjus= -github.com/cardinalby/xgo-as-library v1.0.0/go.mod h1:9mLjEJtdtJ8PkqXAqMojm0ES0sFIlBrJzluN7GkszJo= -github.com/cardinalby/xgo-as-library v1.0.1 h1:DY3TQ2TyZDpcP6Tp3exTUy3L237Ks5jVPs17LgXCBZo= -github.com/cardinalby/xgo-as-library v1.0.1/go.mod h1:9mLjEJtdtJ8PkqXAqMojm0ES0sFIlBrJzluN7GkszJo= -github.com/cardinalby/xgo-as-library v1.1.0 h1:pF10r0tnC9zQPAeCJFURxOXcwRAC3/N9YKyrTvkmHlc= -github.com/cardinalby/xgo-as-library v1.1.0/go.mod h1:9mLjEJtdtJ8PkqXAqMojm0ES0sFIlBrJzluN7GkszJo= -github.com/cardinalby/xgo-as-library v1.1.1 h1:0MbWvpIScrMe7DOX2AD26EjEsui3H71eUwmCaVoUWZo= -github.com/cardinalby/xgo-as-library v1.1.1/go.mod h1:9mLjEJtdtJ8PkqXAqMojm0ES0sFIlBrJzluN7GkszJo= -github.com/cardinalby/xgo-as-library v1.1.2 h1:uFQRrHF5wS/SbelNY1KsAKJW17fMmK7JU1y99fM16Ms= -github.com/cardinalby/xgo-as-library v1.1.2/go.mod h1:9mLjEJtdtJ8PkqXAqMojm0ES0sFIlBrJzluN7GkszJo= -github.com/crazy-max/xgo v0.31.0 h1:JE2PKXBQ6cYpcMSVBuo7WmYy3elKiNHaLv9YXCSsRug= -github.com/crazy-max/xgo v0.31.0/go.mod h1:m/aqfKaN/cYzfw+Pzk7Mk0tkmShg3/rCS4Zdhdugi4o= -github.com/jackmordaunt/icns v1.0.0 h1:RYSxplerf/l/DUd09AHtITwckkv/mqjVv4DjYdPmAMQ= -github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE= -golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= diff --git a/build/internal/consts/target.go b/build/internal/consts/target.go deleted file mode 100644 index 3ab567c..0000000 --- a/build/internal/consts/target.go +++ /dev/null @@ -1,16 +0,0 @@ -package consts - -type Os string - -const ( - OsWindows Os = "windows" - OsDarwin Os = "darwin" - OsLinux Os = "linux" -) - -type Arch string - -const ( - ArchAmd64 Arch = "amd64" - ArchArm64 Arch = "arm64" -) diff --git a/build/internal/docker/docker_run.go b/build/internal/docker/docker_run.go deleted file mode 100644 index 7cbe659..0000000 --- a/build/internal/docker/docker_run.go +++ /dev/null @@ -1,30 +0,0 @@ -package docker - -import ( - "errors" - "fmt" - "os/exec" -) - -func RunImage(image string, volumes map[string]string, args []string) error { - allArgs := append([]string{"run", "--rm"}) - var volumeArgs []string - for src, dst := range volumes { - volumeArgs = append(volumeArgs, "-v", fmt.Sprintf(`%s:%s`, src, dst)) - } - allArgs = append(allArgs, volumeArgs...) - allArgs = append(allArgs, image) - allArgs = append(allArgs, args...) - - cmd := exec.Command( - "docker", - allArgs..., - ) - out, err := cmd.CombinedOutput() - if err != nil { - return errors.Join( - fmt.Errorf("%w. Command: docker %v", err, allArgs), - errors.New(string(out))) - } - return nil -} diff --git a/build/internal/docker/imagemagick.go b/build/internal/docker/imagemagick.go deleted file mode 100644 index c703422..0000000 --- a/build/internal/docker/imagemagick.go +++ /dev/null @@ -1,70 +0,0 @@ -package docker - -import ( - "path/filepath" - "strconv" - "strings" -) - -func imageMagicConvert(volumes map[string]string, args []string) error { - return RunImage("dpokidov/imagemagick", volumes, args) -} - -func imageMagickVolumes(srcPath, dstPath string) ( - vols map[string]string, - srcInContainer, - dstInContainer string, -) { - return map[string]string{ - srcPath: "/src_f", - filepath.Dir(dstPath): "/dst", - }, - "/src_f", - "/dst/" + filepath.Base(dstPath) -} - -func ImageMagicPsdToPng(srcPath, dstPath string) error { - vols, src, dst := imageMagickVolumes(srcPath, dstPath) - return imageMagicConvert( - vols, - []string{ - src + "[0]", - "PNG:" + dst, - }) -} - -func ImageMagicPsdToIco(srcPath, dstPath string, icoSizes []int) error { - var sizesStrArr []string - for _, size := range icoSizes { - sizesStrArr = append(sizesStrArr, strconv.Itoa(size)) - } - sizesStr := strings.Join(sizesStrArr, ",") - vols, src, dst := imageMagickVolumes(srcPath, dstPath) - - return imageMagicConvert( - vols, - []string{ - src + "[0]", - "-define", - "icon:auto-resize=" + sizesStr, - "ICO:" + dst, - }) -} - -func ImageMagicPngToIco(srcPath, dstPath string, icoSizes []int) error { - var sizesStrArr []string - for _, size := range icoSizes { - sizesStrArr = append(sizesStrArr, strconv.Itoa(size)) - } - sizesStr := strings.Join(sizesStrArr, ",") - vols, src, dst := imageMagickVolumes(srcPath, dstPath) - - return imageMagicConvert( - vols, - []string{ - src, - "-define", - "icon:auto-resize=" + sizesStr, - "ICO:" + dst, - }) -} diff --git a/build/internal/fsutil/copy_file.go b/build/internal/fsutil/copy_file.go deleted file mode 100644 index 0792fdf..0000000 --- a/build/internal/fsutil/copy_file.go +++ /dev/null @@ -1,36 +0,0 @@ -package fsutil - -import ( - "fmt" - "io" - "os" - "path/filepath" -) - -func CopyFile(src, dst string) (err error) { - in, err := os.Open(src) - if err != nil { - return - } - defer func() { - _ = in.Close() - }() - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return fmt.Errorf("error creating dst dir: %w", err) - } - out, err := os.Create(dst) - if err != nil { - return - } - defer func() { - cerr := out.Close() - if err == nil { - err = cerr - } - }() - if _, err = io.Copy(out, in); err != nil { - return - } - err = out.Sync() - return -} diff --git a/build/internal/fsutil/rename_file.go b/build/internal/fsutil/rename_file.go deleted file mode 100644 index cbc8746..0000000 --- a/build/internal/fsutil/rename_file.go +++ /dev/null @@ -1,15 +0,0 @@ -package fsutil - -import ( - "fmt" - "os" - "path/filepath" -) - -func RenameFile(src, dst string) error { - dstDir := filepath.Dir(dst) - if err := os.MkdirAll(dstDir, 0755); err != nil { - return fmt.Errorf("error creating dst dir: %w", err) - } - return os.Rename(src, dst) -} diff --git a/build/internal/go_build.go b/build/internal/go_build.go deleted file mode 100644 index c7c0921..0000000 --- a/build/internal/go_build.go +++ /dev/null @@ -1,105 +0,0 @@ -package commands - -import ( - "fmt" - "log" - "os" - "path" - - "github.com/cardinalby/vlc-sync-play/build/internal/consts" - "github.com/cardinalby/vlc-sync-play/build/internal/fsutil" - xgolib "github.com/cardinalby/xgo-as-library" - "golang.org/x/sync/errgroup" -) - -type Target struct { - Os consts.Os - Arch consts.Arch -} - -func (t Target) String() string { - return fmt.Sprintf("%s/%s", t.Os, t.Arch) -} - -type Targets []Target - -func (t Targets) Strings() []string { - res := make([]string, len(t)) - for i, target := range t { - res[i] = target.String() - } - return res -} - -// ldFlags -> targets -type buildOptions map[string]Targets - -func getLdFlags(target Target) string { - if target.Os == consts.OsWindows { - return "-H=windowsgui" - } - return "" -} - -func getXgoOutBinPath( - binTmpDir string, - outPrefix string, - target Target, -) string { - res := path.Join(binTmpDir, fmt.Sprintf("%s-%s-%s", outPrefix, target.Os, target.Arch)) - if target.Os == consts.OsWindows { - res += ".exe" - } - return res -} - -func GoBuild( - rootPath string, - cmdPkgPath string, - outPaths map[Target]string, // "os/arch" -> out path - tmpDir string, - logger *log.Logger, -) error { - options := make(buildOptions) - for target := range outPaths { - ldFlags := getLdFlags(target) - options[ldFlags] = append(options[ldFlags], target) - } - - binTmpDir := path.Join(tmpDir, "bin") - defer func() { - if err := os.RemoveAll(binTmpDir); err != nil { - logger.Printf("error removing tmp '%s': %v", binTmpDir, err) - } - }() - - errGr := errgroup.Group{} - outPrefix := "vlcsp" - - for ldFlags, targets := range options { - targets := targets - args := xgolib.Args{ - Repository: rootPath, - SrcPackage: cmdPkgPath, - OutFolder: binTmpDir, - OutPrefix: outPrefix, - Build: xgolib.BuildArgs{ - LdFlags: ldFlags, - }, - Targets: targets.Strings(), - } - errGr.Go(func() error { - if err := xgolib.StartBuild(args, logger); err != nil { - return err - } - for _, target := range targets { - outBinPath := getXgoOutBinPath(binTmpDir, outPrefix, target) - if err := fsutil.RenameFile(outBinPath, outPaths[target]); err != nil { - return err - } - } - return nil - }) - } - return errGr.Wait() -} diff --git a/build/internal/iconset.go b/build/internal/iconset.go deleted file mode 100644 index 7fb9eb8..0000000 --- a/build/internal/iconset.go +++ /dev/null @@ -1,37 +0,0 @@ -package commands - -import ( - "fmt" - "image" - "os" - "path/filepath" - - "github.com/jackmordaunt/icns" -) - -func generateIconSet(srcIconPath, dstIconSetPath string) error { - pngf, err := os.Open(srcIconPath) - if err != nil { - return fmt.Errorf("error opening file: %w", err) - } - defer func() { - _ = pngf.Close() - }() - srcImg, _, err := image.Decode(pngf) - if err != nil { - return fmt.Errorf("error decoding png: %w", err) - } - if err := os.MkdirAll(filepath.Dir(dstIconSetPath), 0755); err != nil { - return fmt.Errorf("error creating output dir: %w", err) - } - dest, err := os.Create(dstIconSetPath) - if err != nil { - return fmt.Errorf("error creating file: %w", err) - } - - if err := icns.Encode(dest, srcImg); err != nil { - _ = dest.Close() - return fmt.Errorf("error encoding icns: %w", err) - } - return dest.Close() -} diff --git a/build/internal/macos/bundle_path.go b/build/internal/macos/bundle_path.go deleted file mode 100644 index 5650900..0000000 --- a/build/internal/macos/bundle_path.go +++ /dev/null @@ -1,21 +0,0 @@ -package macos - -import "path/filepath" - -type BundlePath string - -func (p BundlePath) GetContentsPath() string { - return filepath.Join(string(p), "Contents") -} - -func (p BundlePath) GetBinDir() string { - return filepath.Join(p.GetContentsPath(), "MacOS") -} - -func (p BundlePath) GetPlistPath() string { - return filepath.Join(p.GetContentsPath(), "Info.plist") -} - -func (p BundlePath) GetResourcesPath() string { - return filepath.Join(p.GetContentsPath(), "Resources") -} diff --git a/build/internal/pack_macos.go b/build/internal/pack_macos.go deleted file mode 100644 index a305437..0000000 --- a/build/internal/pack_macos.go +++ /dev/null @@ -1,44 +0,0 @@ -package commands - -import ( - "os" - "path/filepath" - - "github.com/cardinalby/vlc-sync-play/build/internal/consts" - "github.com/cardinalby/vlc-sync-play/build/internal/docker" - "github.com/cardinalby/vlc-sync-play/build/internal/fsutil" - "github.com/cardinalby/vlc-sync-play/build/internal/macos" - "golang.org/x/sync/errgroup" -) - -func PackMacosBundles( - bundles map[consts.Arch]macos.BundlePath, - srcPsdIconPath string, - plistSrcPath string, - bundleIconSetFileName string, - tmpDir string, -) error { - tmpPngIconFilePath := filepath.Join(tmpDir, "icon.png") - if err := docker.ImageMagicPsdToPng(srcPsdIconPath, tmpPngIconFilePath); err != nil { - return err - } - defer func() { - _ = os.Remove(tmpPngIconFilePath) - }() - - plistRelPath := filepath.Join("Info.plist") - - errGroup := errgroup.Group{} - for _, bundle := range bundles { - bundle := bundle - errGroup.Go(func() error { - if err := generateIconSet( - tmpPngIconFilePath, filepath.Join(bundle.GetResourcesPath(), bundleIconSetFileName), - ); err != nil { - return err - } - return fsutil.CopyFile(plistSrcPath, filepath.Join(bundle.GetContentsPath(), plistRelPath)) - }) - } - return errGroup.Wait() -} diff --git a/build/internal/win_res.go b/build/internal/win_res.go deleted file mode 100644 index 5f863c1..0000000 --- a/build/internal/win_res.go +++ /dev/null @@ -1,33 +0,0 @@ -package commands - -import ( - "fmt" - "log" - "os" - "path/filepath" - - "github.com/akavel/rsrc/rsrc" - "github.com/cardinalby/vlc-sync-play/build/internal/docker" -) - -func GenerateWindowsSysoFile( - srcPsdIconPath string, - manifestPath string, - tmpDir string, - outputPath string, - logger *log.Logger, -) error { - tmpIconPath := filepath.Join(tmpDir, "tmp-vlc-sync-play-icon.ico") - - err := docker.ImageMagicPsdToIco(srcPsdIconPath, tmpIconPath, []int{16, 32, 48, 64, 128, 256}) - if err != nil { - return fmt.Errorf("error generating temporary ico file: %w", err) - } - defer func() { - if err := os.Remove(tmpIconPath); err != nil { - logger.Printf("error removing temporary '%s': %v", tmpIconPath, err) - } - }() - - return rsrc.Embed(outputPath, "amd64", manifestPath, tmpIconPath) -} diff --git a/cmd/.gitignore b/cmd/.gitignore new file mode 100644 index 0000000..47255c2 --- /dev/null +++ b/cmd/.gitignore @@ -0,0 +1 @@ +**/*.syso \ No newline at end of file diff --git a/cmd/cliagent/main.go b/cmd/cliagent/main.go index a88432c..85170ec 100644 --- a/cmd/cliagent/main.go +++ b/cmd/cliagent/main.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - _ "github.com/cardinalby/vlc-sync-play/cmd/internal" "github.com/cardinalby/vlc-sync-play/internal/cli" ) diff --git a/cmd/internal/.gitignore b/cmd/internal/.gitignore deleted file mode 100644 index cbca797..0000000 --- a/cmd/internal/.gitignore +++ /dev/null @@ -1 +0,0 @@ -rsrc_windows_amd64.syso \ No newline at end of file diff --git a/cmd/internal/syso.go b/cmd/internal/syso.go deleted file mode 100644 index a79815c..0000000 --- a/cmd/internal/syso.go +++ /dev/null @@ -1,6 +0,0 @@ -package internal - -func init() { - // this file is required to make go build link generated rsrc_windows_amd64.syso file - // Build can be performed without this file, but it contains an icon and a manifest -} diff --git a/cmd/testagent/main.go b/cmd/testagent/main.go deleted file mode 100644 index 16a4239..0000000 --- a/cmd/testagent/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Printf("Hello, world!\n") -} diff --git a/cmd/trayagent/main.go b/cmd/trayagent/main.go index 38f75aa..eaf6c9f 100644 --- a/cmd/trayagent/main.go +++ b/cmd/trayagent/main.go @@ -6,7 +6,6 @@ import ( "fmt" "os" - _ "github.com/cardinalby/vlc-sync-play/cmd/internal" "github.com/cardinalby/vlc-sync-play/internal/app" "github.com/cardinalby/vlc-sync-play/internal/args" "github.com/cardinalby/vlc-sync-play/internal/trayagent" diff --git a/go.mod b/go.mod index bb195b4..8d422e2 100644 --- a/go.mod +++ b/go.mod @@ -6,26 +6,26 @@ toolchain go1.21.6 require ( fyne.io/systray v1.10.1-0.20240111184411-11c585fff98d - github.com/cardinalby/go-struct-flags v1.0.4 + github.com/cardinalby/go-struct-flags v1.1.0 github.com/gammazero/deque v0.2.1 github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f - github.com/rivo/tview v0.0.0-20231206124440-5f078138442e - github.com/stretchr/testify v1.8.4 - golang.org/x/exp v0.0.0-20231226003508-02704c960a9b - golang.org/x/sync v0.5.0 - golang.org/x/sys v0.16.0 + github.com/rivo/tview v0.0.0-20240225120200-5605142ca62e + github.com/stretchr/testify v1.9.0 + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/sync v0.6.0 + golang.org/x/sys v0.18.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/gdamore/encoding v1.0.0 // indirect - github.com/gdamore/tcell/v2 v2.6.1-0.20231203215052-2917c3801e73 // indirect + github.com/gdamore/tcell/v2 v2.7.4 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - golang.org/x/term v0.15.0 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1e4b908..187de45 100644 --- a/go.sum +++ b/go.sum @@ -1,38 +1,38 @@ fyne.io/systray v1.10.1-0.20240111184411-11c585fff98d h1:NjHwOOuOgGswUOPzDlsEDJOqKdjOjwL8Vi1mj9qx9+o= fyne.io/systray v1.10.1-0.20240111184411-11c585fff98d/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= -github.com/cardinalby/go-struct-flags v1.0.4 h1:TAbA8CUy3cgbuAuAOzA6fN6B2374Fg7uydDEsFUySnQ= -github.com/cardinalby/go-struct-flags v1.0.4/go.mod h1:MVLcavayBM13oZBPT8IkQcPSAWqfyPlITRREnGDYtKs= +github.com/cardinalby/go-struct-flags v1.1.0 h1:eYo8ke80WMQddRV6pDaDIC71SGmi7wV+Juymdp2Tjbk= +github.com/cardinalby/go-struct-flags v1.1.0/go.mod h1:MVLcavayBM13oZBPT8IkQcPSAWqfyPlITRREnGDYtKs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0= github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.6.1-0.20231203215052-2917c3801e73 h1:SeDV6ZUSVlTAUUPdMzPXgMyj96z+whQJRRUff8dIeic= -github.com/gdamore/tcell/v2 v2.6.1-0.20231203215052-2917c3801e73/go.mod h1:pwzJMyH4Hd0AZMJkWQ+/g01dDvYWEvmJuaiRU71Xl8k= +github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU= +github.com/gdamore/tcell/v2 v2.7.4/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f h1:dKccXx7xA56UNqOcFIbuqFjAWPVtP688j5QMgmo6OHU= github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f/go.mod h1:4rEELDSfUAlBSyUjPG0JnaNGjf13JySHFeRdD/3dLP0= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/tview v0.0.0-20231206124440-5f078138442e h1:mPy47VW9tkqImnSPgcjnEHJuG3XHDBtXj2hDb1qBrRs= -github.com/rivo/tview v0.0.0-20231206124440-5f078138442e/go.mod h1:c0SPlNPXkM+/Zgjn/0vD3W0Ds1yxstN7lpquqLDpWCg= +github.com/rivo/tview v0.0.0-20240225120200-5605142ca62e h1:7ubTieBkl4KCz5ABZzh0zPkBYWPguSOHUundUsorIzQ= +github.com/rivo/tview v0.0.0-20240225120200-5605142ca62e/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= -golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -42,29 +42,27 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/xgo-pack-config.yaml b/xgo-pack-config.yaml new file mode 100755 index 0000000..f339edf --- /dev/null +++ b/xgo-pack-config.yaml @@ -0,0 +1,55 @@ +$schema: https://raw.githubusercontent.com/cardinalby/xgo-pack/master/config_schema/config.schema.v1.json +presets: + - xgo-pack:tray_icon +dist_dir: dist +tmp_dir: dist/tmp +src: + main_pkg: cmd/trayagent + icon: assets/icons/icon.psd[0] +targets: + common: + identifier: com.github.cardinalby.vlc-sync-play + bin_name: vlc-sync-play + product_name: VLC Sync Play + version: 1.0.0 + copyright: © 2024, cardinalby + windows: + amd64: + out_dir: windows_amd64 + build_bin: true # Build and keep binary + macos: + common: + bundle: + bundle_name: vlc-sync-play.app + dmg: + dmg_name: vlc-sync-play.dmg + arm64: + out_dir: darwin_arm64 + build_bin: true # Build and keep binary + build_bundle: true # Build and keep app bundle + build_dmg: true # Build and keep dmg image with bundle + amd64: + out_dir: darwin_amd64 + build_bin: true # Build and keep binary + build_bundle: true # Build and keep app bundle + build_dmg: true # Build and keep dmg image with bundle + linux: + common: + deb: + deb_name: vlc-sync-play.deb + name: vlc-sync-play + maintainer: https://github.com/cardinalby + dst_bin_path: /usr/bin/vlc-sync-play + desktop_entry: + add_desktop_entry: true + add_icon: true + dst_icon_path: /usr/share/icons/com.github.cardinalby.vlc-sync-play.png + name: vlc-sync-play + arm64: + out_dir: linux_arm64 + build_bin: true # Build and keep binary + build_deb: true # Build and keep deb package + amd64: + out_dir: linux_amd64 + build_bin: true # Build and keep binary + build_deb: true # Build and keep deb package