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
out="${DIST_DIR}/keepassgo-${goos}-${goarch}${ext}"
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
- name: Build APK
+1 -1
View File
@@ -1,6 +1,6 @@
build/
*.apk
keepassgo
/keepassgo
android/keepassgo-android.jar
packaging/archlinux/keepassgo-git/*.pkg.tar.zst
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:
```sh
go tool gogio -target android ...
go tool gogio -target android ./cmd/keepassgo ...
```
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_VERSION ?= 0.1.0.1
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_TARGET_SDK ?= 35
SIGNKEY ?=
@@ -48,7 +48,7 @@ apk: android/keepassgo-android.jar
-minsdk $(ANDROID_MIN_SDK) \
-targetsdk $(ANDROID_TARGET_SDK) \
-icon assets/keepassgo-icon.png \
.
./cmd/keepassgo
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; }
+3 -3
View File
@@ -38,14 +38,14 @@ KDBX security and KDF compatibility notes are documented in [`docs/kdbx-compatib
Desktop build:
```bash
go build ./...
go build ./cmd/keepassgo
```
By default, build outputs stamp the app version from `git describe --tags --always --dirty`.
You can override the version shown in KeePassGO with:
```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
@@ -89,7 +89,7 @@ go get -tool gioui.org/cmd/gogio@latest
Package:
```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.
+1 -1
View File
@@ -1,6 +1,6 @@
//go:build android
package main
package keepassgo
/*
#cgo CFLAGS: -Werror
+1 -1
View File
@@ -1,6 +1,6 @@
//go:build !android
package main
package keepassgo
func newPlatformVaultSharer(goos string) vaultSharer {
return nil
+2 -2
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"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")
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")
+2 -2
View File
@@ -13,7 +13,7 @@ const (
DefaultAppID = "org.julianfamily.keepassgo"
DefaultAPKOut = "build/keepassgo.apk"
DefaultVersion = "0.1.0.1"
DefaultLdflags = "-X main.appVersion=dev"
DefaultLdflags = "-X git.julianfamily.org/keepassgo.appVersion=dev"
DefaultMinSDK = "28"
DefaultTargetSDK = "35"
DefaultIconPath = "assets/keepassgo-icon.png"
@@ -58,7 +58,7 @@ func (c Config) GogioArgs() []string {
"-minsdk", c.MinSDK,
"-targetsdk", c.TargetSDK,
"-icon", c.IconPath,
".",
"./cmd/keepassgo",
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ func TestDefaultConfigGogioArgs(t *testing.T) {
"-minsdk", DefaultMinSDK,
"-targetsdk", DefaultTargetSDK,
"-icon", DefaultIconPath,
".",
"./cmd/keepassgo",
}
if got := cfg.GogioArgs(); !slices.Equal(got, want) {
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"io"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"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 (
"bytes"
@@ -41,7 +41,7 @@ build() {
export GOFLAGS="-trimpath"
local app_version
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() {
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"image"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"gioui.org/layout"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"encoding/json"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"strings"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"image/color"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package keepassgo
import (
"runtime"