Skip to content

feature plugin dependency management #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 3, 2019
Merged

Conversation

pchampio
Copy link
Member

@pchampio pchampio commented Sep 26, 2019

Feature run-down

  • hover init-plugin github.com/my-organization/plugin_name initialize the current directory (must be a flutter plugin) with go support.

    The files added are:
    go.mod go.sum import.go.tmpl plugin.go README.md

    All of them (except go.mod|sum) are generated based on the current pubspec.yaml.

    • plugin.go:
      • The golang plugin package equals pubspec.yaml/name
      • The golang plugin interface equals ToCamelCase(pubspec.yaml/name) (like Android).
      • The golang plugin import equals github.com/my-organization/plugin_name/go (hover will look for a go directory, it's now a convention)
    • The import.go.tmpl file is used for 'auto' import, and will be copied (with rename) to the application go/cmd upon plugin import.
  • hover init will check for 'lib/main_desktop.dart' file and add it if asked.

  • hover init execute hover plugins list

  • hover plugins list list golang platform plugin available (--all to also show the one without golang support)

  • hover plugins get will add go platform plugin by using the import.go.tmpl of that plugin (--force to re-add plugins) (respect flutter pubspec.yaml/dev_dependencies/plugin_name/path, by adding the correct replace in the 'go.mod' file (this part is done by applying a regex on the import.go.tmpl file in order to obtain the go module name)) (--dry-run performs a trial run with no changes made.)

  • hover plugins clean will remove unused plugin (has been added and removed from pubspec.yaml) (--purge to remove used plugin) (try to clean the 'go.mod' file, but it's not mandatory, as it doesn't affect golang compilation) (--dry-run performs a trial run with no changes made.)

  • hover run will apply the same check as flutter build .. do with the automatic Running "flutter pub get" in .... This check is used to suggest go platform plugin import.

  • hover plugins uses the local pub cache & a hosted json mapping list to look for golang plugin

fixes: go-flutter-desktop/go-flutter#260
fixes: go-flutter-desktop/go-flutter#143

@pchampio pchampio changed the title fix review comments & support for colors feature plugin dependency management Sep 26, 2019
@pchampio pchampio mentioned this pull request Sep 26, 2019
@pchampio
Copy link
Member Author

pchampio commented Sep 26, 2019

The following workflow works:
flutter create --template=plugin test_hover
cd test_hover
hover init-plugin github.com/my-organization/test_hover
cd example
hover init example

hover: Available plugin for this project:
     - test_hover
         version:   0.0.1
         platforms: [android, ios, go]
         import:    [Missing] The plugin can be imported by hover.
         dev:       Plugin replaced in go.mod to path: '..'

hover: run `hover plugins get` to import the missing plugins!

hover plugins get

       plugin: [test_hover] imported

hover run

hover: Target file "lib/main_desktop.dart" not found.
hover: Let hover add the "lib/main_desktop.dart" file? [y/N]: y
       Depending on your project, you might want to tweak it.
hover: Using engine from cache
hover: Cleaning the build directory
hover: Bundling flutter app
hover: Compiling 'go-flutter' and plugins
(fix it manually)

Tada the platform version is displayed!

@pchampio
Copy link
Member Author

PTAL

Copy link
Member

@GeertJohan GeertJohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions. LGTM.


var publishPluginCmd = &cobra.Command{
Use: "publish-plugin",
Short: "Assert that your go-flutter plugin can be pushed as golang module in your github repo.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short description is misleading. We don't just assert, we actually run the commands to publish (after confirmation).

@pchampio pchampio requested a review from GeertJohan October 1, 2019 21:58
@GeertJohan GeertJohan merged commit 00cc8b4 into master Oct 3, 2019
@GeertJohan GeertJohan deleted the feature/init-plugin branch October 3, 2019 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

hover: init-plugin scaffolding Let hover suggest plugins
2 participants