Skip to content

Commit ea76d28

Browse files
committed
chore: docs + colors + --opengl flag on run
Minor style changes there and there.
1 parent 1d570a2 commit ea76d28

File tree

11 files changed

+27
-8
lines changed

11 files changed

+27
-8
lines changed

cmd/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func buildNormal(targetOS string, vmArguments []string) {
285285
ignoreWarning := os.Getenv("HOVER_IGNORE_CHANNEL_WARNING")
286286
if match[1] != "beta" && ignoreWarning != "true" {
287287
log.Warnf("⚠ The go-flutter project tries to stay compatible with the beta channel of Flutter.")
288-
log.Warnf("⚠ It's advised to use the beta channel: %s", log.Au().Magenta("flutter channel beta"))
288+
log.Warnf("⚠ It's advised to use the beta channel: `%s`", log.Au().Magenta("flutter channel beta"))
289289
}
290290
} else {
291291
log.Warnf("Failed to check your flutter channel: Unrecognized output format")

cmd/packaging/linux-deb.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import (
99
"github.com/otiai10/copy"
1010

1111
"github.com/go-flutter-desktop/hover/internal/build"
12-
"github.com/go-flutter-desktop/hover/internal/pubspec"
1312
"github.com/go-flutter-desktop/hover/internal/log"
13+
"github.com/go-flutter-desktop/hover/internal/pubspec"
1414
)
1515

16+
// InitLinuxDeb initialize the a linux deb packagingFormat.
1617
func InitLinuxDeb() {
1718
projectName := pubspec.GetPubSpec().Name
1819
packagingFormat := "linux-deb"
@@ -126,6 +127,7 @@ func InitLinuxDeb() {
126127
printInitFinished(packagingFormat)
127128
}
128129

130+
// BuildLinuxDeb uses the InitLinuxDeb template to create a deb package.
129131
func BuildLinuxDeb() {
130132
projectName := pubspec.GetPubSpec().Name
131133
packagingFormat := "linux-deb"

cmd/packaging/linux-snap.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import (
88
"github.com/otiai10/copy"
99

1010
"github.com/go-flutter-desktop/hover/internal/build"
11-
"github.com/go-flutter-desktop/hover/internal/pubspec"
1211
"github.com/go-flutter-desktop/hover/internal/log"
12+
"github.com/go-flutter-desktop/hover/internal/pubspec"
1313
)
1414

15+
// InitLinuxSnap initialize the a linux snap packagingFormat
1516
func InitLinuxSnap() {
1617
projectName := pubspec.GetPubSpec().Name
1718
packagingFormat := "linux-snap"
@@ -92,6 +93,7 @@ func InitLinuxSnap() {
9293
printInitFinished(packagingFormat)
9394
}
9495

96+
// BuildLinuxSnap uses the InitLinuxSnap template to create a snap package.
9597
func BuildLinuxSnap() {
9698
projectName := pubspec.GetPubSpec().Name
9799
packagingFormat := "linux-snap"

cmd/packaging/packaging.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func createPackagingFormatDirectory(packagingFormat string) {
3838
}
3939
}
4040

41+
// AssertPackagingFormatInitialized exits hover if the requested
42+
// packagingFormat isn't initialized.
4143
func AssertPackagingFormatInitialized(packagingFormat string) {
4244
if _, err := os.Stat(packagingFormatPath(packagingFormat)); os.IsNotExist(err) {
4345
log.Errorf("%s is not initialized for packaging. Please run `hover init-packaging %s` first.", packagingFormat, packagingFormat)
@@ -51,7 +53,7 @@ func removeDashesAndUnderscores(projectName string) string {
5153

5254
func printInitFinished(packagingFormat string) {
5355
log.Infof("go/packaging/%s has been created. You can modify the configuration files and add it to git.", packagingFormat)
54-
log.Infof("You now can package the %s using `hover build %s`", strings.Split(packagingFormat, "-")[0], packagingFormat)
56+
log.Infof(fmt.Sprintf("You now can package the %s using `%s`", strings.Split(packagingFormat, "-")[0], log.Au().Magenta("hover build "+packagingFormat)))
5557
}
5658

5759
func printPackagingFinished(packagingFormat string) {
@@ -67,6 +69,7 @@ func getTemporaryBuildDirectory(projectName string, packagingFormat string) stri
6769
return tmpPath
6870
}
6971

72+
// DockerInstalled check if docker is installed on the host os.
7073
func DockerInstalled() bool {
7174
if build.DockerBin == "" {
7275
log.Warnf("To use packaging, Docker needs to be installed.\nhttps://docs.docker.com/install")

cmd/plugins.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func hoverPluginGet(dryRun bool) bool {
318318

319319
// if local plugin
320320
if dep.path != "" {
321-
path, err := filepath.Abs(filepath.Join(dep.path, "go"))
321+
path, err := filepath.Abs(filepath.Join(dep.path, build.BuildPath))
322322
if err != nil {
323323
log.Errorf("Failed to resolve absolute path for plugin '%s': %v", dep.name, err)
324324
os.Exit(1)

cmd/publish-plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var publishPluginCmd = &cobra.Command{
6060
}
6161

6262
// check if one of the git remote urls equals the package import 'url'
63-
pluginImportStr, err := readPluginGoImport(filepath.Join("go", "import.go.tmpl"), pubspec.GetPubSpec().Name)
63+
pluginImportStr, err := readPluginGoImport(filepath.Join(build.BuildPath, "import.go.tmpl"), pubspec.GetPubSpec().Name)
6464
if err != nil {
6565
log.Errorf("Failed to read the plugin import url: %v", err)
6666
log.Infof("The file go/import.go.tmpl should look something like this:")

cmd/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
"github.com/spf13/cobra"
1414

15+
"github.com/go-flutter-desktop/hover/internal/build"
1516
"github.com/go-flutter-desktop/hover/internal/log"
1617
"github.com/go-flutter-desktop/hover/internal/pubspec"
17-
"github.com/go-flutter-desktop/hover/internal/build"
1818
)
1919

2020
var runObservatoryPort string
@@ -23,6 +23,7 @@ func init() {
2323
runCmd.Flags().StringVarP(&buildTarget, "target", "t", "lib/main_desktop.dart", "The main entry-point file of the application.")
2424
runCmd.Flags().StringVarP(&buildBranch, "branch", "b", "", "The 'go-flutter' version to use. (@master or @v0.20.0 for example)")
2525
runCmd.Flags().StringVarP(&buildCachePath, "cache-path", "", "", "The path that hover uses to cache dependencies such as the Flutter engine .so/.dll (defaults to the standard user cache directory)")
26+
runCmd.Flags().StringVar(&buildOpenGlVersion, "opengl", "3.3", "The OpenGL version specified here is only relevant for external texture plugin (i.e. video_plugin).\nIf 'none' is provided, texture won't be supported. Note: the Flutter Engine still needs a OpenGL compatible context.")
2627
runCmd.Flags().StringVarP(&runObservatoryPort, "observatory-port", "", "50300", "The observatory port used to connect hover to VM services (hot-reload/debug/..)")
2728
runCmd.Flags().BoolVar(&buildOmitEmbedder, "omit-embedder", false, "Don't (re)compile 'go-flutter' source code, useful when only working with Dart code")
2829
runCmd.Flags().BoolVar(&buildOmitFlutterBundle, "omit-flutter", false, "Don't (re)compile the current Flutter project, useful when only working with Golang code (plugin)")

internal/build/binaries.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package build
22

3+
// Path to external tools used by hover
34
var (
45
GoBin string
56
FlutterBin string

internal/build/build.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ import (
77
"github.com/go-flutter-desktop/hover/internal/log"
88
)
99

10+
// BuildPath sets the name of the directory used to store the go-flutter project.
11+
// Much like android and ios are already used.
1012
const BuildPath = "go"
1113

14+
// OutputDirectoryPath returns the path where the go-flutter binary and flutter
15+
// binaries blobs will be stored for a particular platform.
16+
// If needed, the directory is create at the returned path.
1217
func OutputDirectoryPath(targetOS string) string {
1318
outputDirectoryPath, err := filepath.Abs(filepath.Join(BuildPath, "build", "outputs", targetOS))
1419
if err != nil {
@@ -25,6 +30,8 @@ func OutputDirectoryPath(targetOS string) string {
2530
return outputDirectoryPath
2631
}
2732

33+
// OutputBinaryName returns the string of the executable used to launch the
34+
// main desktop app. (appends .exe for windows)
2835
func OutputBinaryName(projectName string, targetOS string) string {
2936
var outputBinaryName = projectName
3037
switch targetOS {
@@ -41,6 +48,8 @@ func OutputBinaryName(projectName string, targetOS string) string {
4148
return outputBinaryName
4249
}
4350

51+
// OutputBinaryPath returns the path to the go-flutter Application for a
52+
// specified platform.
4453
func OutputBinaryPath(projectName string, targetOS string) string {
4554
outputBinaryPath := filepath.Join(OutputDirectoryPath(targetOS), OutputBinaryName(projectName, targetOS))
4655
return outputBinaryPath

internal/pubspec/pubspec.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/pkg/errors"
1111
)
1212

13+
// PubSpec contains the parsed contents of pubspec.yaml
1314
type PubSpec struct {
1415
Name string
1516
Description string

internal/versioncheck/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func CheckForGoFlutterUpdate(goDirectoryPath string, currentTag string) {
8888
}
8989
if res.Outdated {
9090
log.Infof("The core library 'go-flutter' has an update available. (%s -> %s)", currentTag, res.Current)
91-
log.Infof(" To update 'go-flutter' in this project run: $ hover upgrade")
91+
log.Infof(" To update 'go-flutter' in this project run: `%s`", log.Au().Magenta("hover upgrade"))
9292
}
9393

9494
if now.Sub(lastUpdateTimeStamp).Hours() > checkRate {

0 commit comments

Comments
 (0)