Skip to content
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

hover auto-import! #153

Merged
merged 1 commit into from
Oct 6, 2019
Merged

hover auto-import! #153

merged 1 commit into from
Oct 6, 2019

Conversation

pchampio
Copy link
Contributor

@pchampio pchampio commented Oct 6, 2019

This template is used to auto-import plugin upon hover plugins get.
Adding this file to your project, enables users to easily import this
plugin into their go-flutter/hover project.

How to test this:

go to the example of this project

Init the hover project:

$ hover init
go: creating new go.mod: module file_picker_example/go
hover: You can add the '/tmp/flutter_file_picker/example/go' directory to git.
hover: Available plugin for this project:
     - file_picker
         version:   1.4.2
         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!

Note that the plugin is in 'dev' move, it's because we are using the Golang source code located on the filesystem for dev purposes.

The check for plugins can be also made by running hover plugins list.

import missing plugins (file_picker)

$ hover plugins get
       plugin: [file_picker] imported

Run!

$ hover run

And test the desktop plugin!


Version management! (optional, very recommended)

https://pub.dev/ is inherently versioning any plugin, as go-flutter-desktop/go-flutter#191 (comment) inform, we cannot plug external build tool (like hover) into flutter and thus pub.dev.
To handle plugin version management for go-flutter/hover plugins, you must use the built-in golang module system.
It's very simple, golang wiki, TL;DR: create a tag named go/$VERSION.

To create and push this tag you can use hover:

hover publish:

$ hover publish-plugin
hover: At least one git remote urls must matchs the plugin golang import URL.
hover: go import URL: github.com/miguelpruivo/plugins_flutter_file_picker/go
hover: git remote -v:
origin  git@github.com:Drakirus/flutter_file_picker.git (fetch)
origin  git@github.com:Drakirus/flutter_file_picker.git (push)

hover: Assuming origin is where the plugin code is stored
hover:  This warning can occur because the git repo name dosn't match the plugin name in pubspec.yaml
hover: Your plugin at version '1.4.2' is ready to be publish as a golang module.
hover: Please run: `git tag go/v1.4.2`
hover:             `git push origin go/v1.4.2`
hover: Let hover run those commands?
hover: [y/N]? y
Énumération des objets: 9, fait.
Décompte des objets: 100% (9/9), fait.
Compression par delta en utilisant jusqu'à 4 fils d'exécution
Compression des objets: 100% (5/5), fait.
Écriture des objets: 100% (5/5), 1.15 Kio | 1.15 Mio/s, fait.
Total 5 (delta 4), réutilisés 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:Drakirus/flutter_file_picker.git
 * [new tag]         go/v1.4.2 -> go/v1.4.2

or simply create a github release flutter_file_picker/releases named go/v1.4.2 (just like done in https://github.com/Drakirus/flutter_file_picker/releases)

This template is used to auto-import plugin upon `flutter plugins get`.
Adding this file to your project, enables users to easily import this
plugin into they go-flutter/hover project.
@pchampio pchampio marked this pull request as ready for review October 6, 2019 21:01
@pchampio pchampio changed the base branch from master to beta October 6, 2019 21:04
@miguelpruivo
Copy link
Owner

Hi, thank you for keeping this updated @Drakirus. Do you think that additional information related to this, should be added to the Wiki?

@pchampio
Copy link
Contributor Author

pchampio commented Oct 6, 2019

Hi, thank you for keeping this updated @Drakirus. Do you think that additional information related to this, should be added to the Wiki?

Humm, that a great question.

Maybe change the bullet 4 in https://github.com/miguelpruivo/flutter_file_picker/wiki/Setup#--desktop-go-flutter and tell people to add this plugin by using: hover plugins get.
I guess the current bullet 4, could be renamed 4-legacy.

@miguelpruivo
Copy link
Owner

@Drakirus so basically all line from that bullet snippet should be removed as well in place of hover plugins get right? I don't know if a legacy may be suitable after merging. Are you suggesting to keep both steps? Won't plugins get replace completely that?

@pchampio
Copy link
Contributor Author

pchampio commented Oct 6, 2019

all line from that bullet snippet should be removed as well in place of hover plugins get right?

YES.

I don't know if a legacy may be suitable after merging.

When running hover plugins get similar code to:

package main

import (
	... other imports ....
	
      file_picker "github.com/miguelpruivo/plugins_flutter_file_picker/go"
)

var options = []flutter.Option{
	... other plugins and options ...

	flutter.AddPlugin(&file_picker.FilePickerPlugin{}),
}

is injected, so both approach will work.

Are you suggesting to keep both steps?

While we could keep both steps, this is really not necessary, I'd say (changed my mind after your comment), removing the legacy is better, the steps to install this plugin are much easier.

Won't plugins get replace completely that?

Not replace, it's another way to import plugins, an automatic one.

If you have any other questions (was the Versioning part clear?) please let me know!

@miguelpruivo
Copy link
Owner

All clear @Drakirus. Merging into beta now. Once more, thank you for contributing.

@miguelpruivo miguelpruivo merged commit c5e23c4 into miguelpruivo:beta Oct 6, 2019
miguelpruivo pushed a commit that referenced this pull request Nov 17, 2019
This template is used to auto-import plugin upon `flutter plugins get`.
Adding this file to your project, enables users to easily import this
plugin into they go-flutter/hover project.
miguelpruivo added a commit that referenced this pull request Nov 17, 2019
* Better handling on Android of buggy file managers that return no intent when canceling the file selection even though it returns Activity.RESULT_OK (#111)

* removes deprecated Android SDK code and fixes an issue that could prevent some downloaded files from being picked

* adds getMultiFile and prevents UI blocking when picking large remote files

* updates readme file

* fixes an issue that could prevent internal storage files from being properly picked

* Update go/go.mod dependency versions (#144)

* feat: go-flutter, add hover plugin template (#153)

This template is used to auto-import plugin upon `flutter plugins get`.
Adding this file to your project, enables users to easily import this
plugin into they go-flutter/hover project.

* Update go-flutter dependencies (#162)

* Update issue templates

* Update go-flutter dependencies

* Updates version and README file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants