Add KeePassGO branding assets
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user