Split command entrypoint from app package

This commit is contained in:
Joe Julian
2026-04-08 23:36:22 -07:00
parent 74d10535a1
commit b256a77d0c
28 changed files with 39 additions and 32 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ jobs:
fi fi
out="${DIST_DIR}/keepassgo-${goos}-${goarch}${ext}" out="${DIST_DIR}/keepassgo-${goos}-${goarch}${ext}"
GOOS="${goos}" GOARCH="${goarch}" CGO_ENABLED="${cgo_enabled}" \ GOOS="${goos}" GOARCH="${goarch}" CGO_ENABLED="${cgo_enabled}" \
go build -ldflags "-X main.appVersion=${app_version}" -o "${out}" . go build -ldflags "-X git.julianfamily.org/keepassgo.appVersion=${app_version}" -o "${out}" ./cmd/keepassgo
done done
- name: Build APK - name: Build APK
+1 -1
View File
@@ -1,6 +1,6 @@
build/ build/
*.apk *.apk
keepassgo /keepassgo
android/keepassgo-android.jar android/keepassgo-android.jar
packaging/archlinux/keepassgo-git/*.pkg.tar.zst packaging/archlinux/keepassgo-git/*.pkg.tar.zst
packaging/archlinux/keepassgo-git/PKGBUILD packaging/archlinux/keepassgo-git/PKGBUILD
+1 -1
View File
@@ -29,7 +29,7 @@ Installed machine prerequisites expected by this repo:
The repo tracks `gogio` as a Go tool, so the build runs through: The repo tracks `gogio` as a Go tool, so the build runs through:
```sh ```sh
go tool gogio -target android ... go tool gogio -target android ./cmd/keepassgo ...
``` ```
The Android build uses the branded icon asset at: The Android build uses the branded icon asset at:
+2 -2
View File
@@ -6,7 +6,7 @@ APP_ID ?= org.julianfamily.keepassgo
APK_OUT ?= build/keepassgo.apk APK_OUT ?= build/keepassgo.apk
APK_VERSION ?= 0.1.0.1 APK_VERSION ?= 0.1.0.1
APP_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) APP_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
GO_LDFLAGS ?= -X main.appVersion=$(APP_VERSION) GO_LDFLAGS ?= -X git.julianfamily.org/keepassgo.appVersion=$(APP_VERSION)
ANDROID_MIN_SDK ?= 28 ANDROID_MIN_SDK ?= 28
ANDROID_TARGET_SDK ?= 35 ANDROID_TARGET_SDK ?= 35
SIGNKEY ?= SIGNKEY ?=
@@ -48,7 +48,7 @@ apk: android/keepassgo-android.jar
-minsdk $(ANDROID_MIN_SDK) \ -minsdk $(ANDROID_MIN_SDK) \
-targetsdk $(ANDROID_TARGET_SDK) \ -targetsdk $(ANDROID_TARGET_SDK) \
-icon assets/keepassgo-icon.png \ -icon assets/keepassgo-icon.png \
. ./cmd/keepassgo
android/keepassgo-android.jar: $(shell find androidsrc -type f | sort) android/keepassgo-android.jar: $(shell find androidsrc -type f | sort)
@test -x "$(JAVA_HOME)/bin/javac" || { echo "JAVA_HOME must point to a working JDK install"; exit 1; } @test -x "$(JAVA_HOME)/bin/javac" || { echo "JAVA_HOME must point to a working JDK install"; exit 1; }
+3 -3
View File
@@ -38,14 +38,14 @@ KDBX security and KDF compatibility notes are documented in [`docs/kdbx-compatib
Desktop build: Desktop build:
```bash ```bash
go build ./... go build ./cmd/keepassgo
``` ```
By default, build outputs stamp the app version from `git describe --tags --always --dirty`. By default, build outputs stamp the app version from `git describe --tags --always --dirty`.
You can override the version shown in KeePassGO with: You can override the version shown in KeePassGO with:
```bash ```bash
go build -ldflags "-X main.appVersion=v0.0.1" ./... go build -ldflags "-X git.julianfamily.org/keepassgo.appVersion=v0.0.1" ./cmd/keepassgo
``` ```
## Arch Linux Package ## Arch Linux Package
@@ -89,7 +89,7 @@ go get -tool gioui.org/cmd/gogio@latest
Package: Package:
```bash ```bash
go tool gogio -target android -icon assets/keepassgo-icon.png . go tool gogio -target android -icon assets/keepassgo-icon.png ./cmd/keepassgo
``` ```
You will need the Android SDK and NDK installed and configured for real device or release packaging. You will need the Android SDK and NDK installed and configured for real device or release packaging.
+1 -1
View File
@@ -1,6 +1,6 @@
//go:build android //go:build android
package main package keepassgo
/* /*
#cgo CFLAGS: -Werror #cgo CFLAGS: -Werror
+1 -1
View File
@@ -1,6 +1,6 @@
//go:build !android //go:build !android
package main package keepassgo
func newPlatformVaultSharer(goos string) vaultSharer { func newPlatformVaultSharer(goos string) vaultSharer {
return nil return nil
+2 -2
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"crypto/sha256" "crypto/sha256"
@@ -6917,7 +6917,7 @@ func fill(c color.NRGBA) layout.Widget {
} }
} }
func main() { func Main() {
mode := flag.String("mode", "", "window mode: desktop or phone") mode := flag.String("mode", "", "window mode: desktop or phone")
stateDir := flag.String("state-dir", "", "directory for KeePassGO state such as recent-vault history and default save targets") stateDir := flag.String("state-dir", "", "directory for KeePassGO state such as recent-vault history and default save targets")
grpcAddr := flag.String("grpc-addr", "", "address for the local gRPC API listener; use 'off' to disable") grpcAddr := flag.String("grpc-addr", "", "address for the local gRPC API listener; use 'off' to disable")
+2 -2
View File
@@ -13,7 +13,7 @@ const (
DefaultAppID = "org.julianfamily.keepassgo" DefaultAppID = "org.julianfamily.keepassgo"
DefaultAPKOut = "build/keepassgo.apk" DefaultAPKOut = "build/keepassgo.apk"
DefaultVersion = "0.1.0.1" DefaultVersion = "0.1.0.1"
DefaultLdflags = "-X main.appVersion=dev" DefaultLdflags = "-X git.julianfamily.org/keepassgo.appVersion=dev"
DefaultMinSDK = "28" DefaultMinSDK = "28"
DefaultTargetSDK = "35" DefaultTargetSDK = "35"
DefaultIconPath = "assets/keepassgo-icon.png" DefaultIconPath = "assets/keepassgo-icon.png"
@@ -58,7 +58,7 @@ func (c Config) GogioArgs() []string {
"-minsdk", c.MinSDK, "-minsdk", c.MinSDK,
"-targetsdk", c.TargetSDK, "-targetsdk", c.TargetSDK,
"-icon", c.IconPath, "-icon", c.IconPath,
".", "./cmd/keepassgo",
} }
} }
+1 -1
View File
@@ -21,7 +21,7 @@ func TestDefaultConfigGogioArgs(t *testing.T) {
"-minsdk", DefaultMinSDK, "-minsdk", DefaultMinSDK,
"-targetsdk", DefaultTargetSDK, "-targetsdk", DefaultTargetSDK,
"-icon", DefaultIconPath, "-icon", DefaultIconPath,
".", "./cmd/keepassgo",
} }
if got := cfg.GogioArgs(); !slices.Equal(got, want) { if got := cfg.GogioArgs(); !slices.Equal(got, want) {
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"io" "io"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"slices" "slices"
+7
View File
@@ -0,0 +1,7 @@
package main
import keepassgo "git.julianfamily.org/keepassgo"
func main() {
keepassgo.Main()
}
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"bytes" "bytes"
@@ -41,7 +41,7 @@ build() {
export GOFLAGS="-trimpath" export GOFLAGS="-trimpath"
local app_version local app_version
app_version="$(git describe --tags --always --dirty)" app_version="$(git describe --tags --always --dirty)"
go build -ldflags "-X main.appVersion=${app_version}" -o keepassgo . go build -ldflags "-X git.julianfamily.org/keepassgo.appVersion=${app_version}" -o keepassgo ./cmd/keepassgo
} }
package() { package() {
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"image" "image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"image" "image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"image" "image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"gioui.org/layout" "gioui.org/layout"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"encoding/json" "encoding/json"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"strings" "strings"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"image/color" "image/color"
+1 -1
View File
@@ -1,4 +1,4 @@
package main package keepassgo
import ( import (
"runtime" "runtime"