Add KeePassGO branding assets

This commit is contained in:
Joe Julian
2026-03-31 22:34:36 -07:00
parent beefd51b15
commit eb73cab155
15 changed files with 262 additions and 11 deletions
+12
View File
@@ -15,6 +15,7 @@ const (
DefaultVersion = "0.1.0.1"
DefaultMinSDK = "28"
DefaultTargetSDK = "35"
DefaultIconPath = "assets/keepassgo-icon.png"
)
type Config struct {
@@ -26,6 +27,7 @@ type Config struct {
Version string
MinSDK string
TargetSDK string
IconPath string
}
func DefaultConfig() Config {
@@ -38,6 +40,7 @@ func DefaultConfig() Config {
Version: DefaultVersion,
MinSDK: DefaultMinSDK,
TargetSDK: DefaultTargetSDK,
IconPath: DefaultIconPath,
}
}
@@ -50,6 +53,7 @@ func (c Config) GogioArgs() []string {
"-version", c.Version,
"-minsdk", c.MinSDK,
"-targetsdk", c.TargetSDK,
"-icon", c.IconPath,
".",
}
}
@@ -73,6 +77,9 @@ func (c Config) Validate() error {
if !isDir(filepath.Join(c.SDKRoot, "build-tools")) {
return fmt.Errorf("Android build-tools are missing")
}
if !isFile(c.IconPath) {
return fmt.Errorf("Android icon asset is missing: %s", c.IconPath)
}
return nil
}
@@ -88,3 +95,8 @@ func isExecutable(path string) bool {
}
return info.Mode()&0o111 != 0
}
func isFile(path string) bool {
info, err := os.Stat(path)
return err == nil && !info.IsDir()
}
+6
View File
@@ -19,6 +19,7 @@ func TestDefaultConfigGogioArgs(t *testing.T) {
"-version", DefaultVersion,
"-minsdk", DefaultMinSDK,
"-targetsdk", DefaultTargetSDK,
"-icon", DefaultIconPath,
".",
}
@@ -53,6 +54,11 @@ func TestValidateAcceptsCompleteAndroidToolchainLayout(t *testing.T) {
Version: DefaultVersion,
MinSDK: DefaultMinSDK,
TargetSDK: DefaultTargetSDK,
IconPath: filepath.Join(root, "icon.png"),
}
if err := os.WriteFile(cfg.IconPath, []byte("png"), 0o644); err != nil {
t.Fatalf("WriteFile(%q) error = %v", cfg.IconPath, err)
}
if err := cfg.Validate(); err != nil {