Skip to content

Commit 248da4a

Browse files
author
jld3103
authored
Merge pull request #209 from go-flutter-desktop/config/organization-name
Introduce organization name field to hover config
2 parents 4b5223a + 54cdd82 commit 248da4a

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

assets/app/hover.yaml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#application-name: "{{.applicationName}}" # Uncomment to modify this value.
22
#executable-name: "{{.executableName}}" # Uncomment to modify this value. Only lowercase a-z, numbers, underscores and no spaces
33
#package-name: "{{.packageName}}" # Uncomment to modify this value. Only lowercase a-z, numbers and no underscores or spaces
4+
organization-name: "com.{{.packageName}}"
45
license: "" # MANDATORY: Fill in your SPDX license name: https://spdx.org/licenses
56
target: lib/main_desktop.dart
67
# opengl: "none" # Uncomment this line if you have trouble with your OpenGL driver (https://github.com/go-flutter-desktop/go-flutter/issues/272)

cmd/build.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/spf13/cobra"
1414

1515
"github.com/go-flutter-desktop/hover/cmd/packaging"
16-
"github.com/go-flutter-desktop/hover/internal/androidmanifest"
1716
"github.com/go-flutter-desktop/hover/internal/build"
1817
"github.com/go-flutter-desktop/hover/internal/config"
1918
"github.com/go-flutter-desktop/hover/internal/darwinhacks"
@@ -787,7 +786,7 @@ func buildCommand(targetOS string, vmArguments []string, outputBinaryPath string
787786
buildVersionNumber,
788787
currentTag,
789788
config.GetConfig().GetApplicationName(pubspec.GetPubSpec().Name),
790-
androidmanifest.AndroidOrganizationName()))
789+
config.GetConfig().GetOrganizationName()))
791790

792791
outputCommand := []string{
793792
"go",

cmd/packaging/packaging.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package packaging
33
import (
44
"bytes"
55
"fmt"
6-
"github.com/go-flutter-desktop/hover/internal/androidmanifest"
76
"github.com/go-flutter-desktop/hover/internal/pubspec"
87
"io/ioutil"
98
"os"
@@ -153,8 +152,8 @@ func (t *packagingTask) Pack(fullVersion string, mode build.Mode) {
153152
release = strings.ReplaceAll(fullVersion, ".", "")
154153
}
155154
description := pubspec.GetPubSpec().GetDescription()
156-
organizationName := androidmanifest.AndroidOrganizationName()
157155
author := pubspec.GetPubSpec().GetAuthor()
156+
organizationName := config.GetConfig().GetOrganizationName()
158157
applicationName := config.GetConfig().GetApplicationName(projectName)
159158
executableName := config.GetConfig().GetExecutableName(projectName)
160159
packageName := config.GetConfig().GetPackageName(projectName)

internal/config/config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/pkg/errors"
1010
"gopkg.in/yaml.v2"
1111

12+
"github.com/go-flutter-desktop/hover/internal/androidmanifest"
1213
"github.com/go-flutter-desktop/hover/internal/build"
1314
"github.com/go-flutter-desktop/hover/internal/log"
1415
)
@@ -27,6 +28,7 @@ type Config struct {
2728
ApplicationName string `yaml:"application-name"`
2829
ExecutableName string `yaml:"executable-name"`
2930
PackageName string `yaml:"package-name"`
31+
OrganizationName string `yaml:"organization-name"`
3032
License string
3133
Target string
3234
BranchREMOVED string `yaml:"branch"`
@@ -56,6 +58,16 @@ func (c Config) GetPackageName(projectName string) string {
5658
return c.PackageName
5759
}
5860

61+
func (c Config) GetOrganizationName() string {
62+
if len(c.OrganizationName) == 0 {
63+
PrintMissingField("organization-name", "go/hover.yaml", c.OrganizationName)
64+
// It would be nicer to not load a value from the AndroidManifest.xml and instead define a default value here,
65+
// but then older apps might break so for compatibility reasons it's done this way.
66+
c.OrganizationName = androidmanifest.AndroidOrganizationName()
67+
}
68+
return c.OrganizationName
69+
}
70+
5971
func (c Config) GetLicense() string {
6072
if len(c.License) == 0 {
6173
c.License = "NOASSERTION"

internal/fileutils/rice-box.go

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)