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

feat: add intermediates directory. Copy file when get plugins and build #59

Merged
merged 4 commits into from Nov 15, 2019

Conversation

@befovy
Copy link
Contributor

befovy commented Nov 13, 2019

copy files from plugin's go/dlib folder to intermediates folder
when 'hover plugins get'.

copy files in intermediates to binary output folder before build.

implement and finish #296

copy files from plugin's go/dlib folder to intermediates folder
when 'hover plugins get'.

copy files in intermediates to binary output folder before build.

implement and finish #296
@befovy

This comment has been minimized.

Copy link
Contributor Author

befovy commented Nov 13, 2019

@jld3103 jld3103 self-requested a review Nov 13, 2019
cmd/build.go Show resolved Hide resolved
internal/build/build.go Show resolved Hide resolved
@pchampio

This comment has been minimized.

Copy link
Member

pchampio commented Nov 14, 2019

Oups forgot, hover plugins tidy --purge should delete the go/build/intermediates dir.
I also think it could be good to generate the directory layout dlib/{linux, darwin, windows} when running hover init-plugin.
A readme describing what is the purpose of this directory can then be added to the dlib directory.

Otherwise it's LGTM.
Tested on linux with the following files:

// file hello.c
#include <stdio.h>
void hello()
{
    printf("Hello world!\n");
}

// compiled with: gcc -shared -o libhello.so -fPIC hello.c
// libhello.so placed under plugin_name/dlib/linux
package test_hover

// example from `hover init-plugin` //
// with CGO call on the above lib  //

// #cgo linux LDFLAGS: -lhello
// void hello();
import "C"
import (
	flutter "github.com/go-flutter-desktop/go-flutter"
	"github.com/go-flutter-desktop/go-flutter/plugin"
)

const channelName = "test_hover"

// TestHoverPlugin implements flutter.Plugin and handles method.
type TestHoverPlugin struct{}

var _ flutter.Plugin = &TestHoverPlugin{} // compile-time type check

// InitPlugin initializes the plugin.
func (p *TestHoverPlugin) InitPlugin(messenger plugin.BinaryMessenger) error {
	channel := plugin.NewMethodChannel(messenger, channelName, plugin.StandardMethodCodec{})
	channel.HandleFunc("getPlatformVersion", p.handlePlatformVersion)
	return nil
}

func (p *TestHoverPlugin) handlePlatformVersion(arguments interface{}) (reply interface{}, err error) {
	C.hello()
	return "go-flutter " + flutter.PlatformVersion, nil
}

hover plugins get and hover build linux and exec works!

@befovy

This comment has been minimized.

Copy link
Contributor Author

befovy commented Nov 15, 2019

Please take a look.
Add the missing dlib operator for hover init-plugin and hover plugins tidy --purge

@pchampio pchampio merged commit 633f639 into go-flutter-desktop:master Nov 15, 2019
@pchampio

This comment has been minimized.

Copy link
Member

pchampio commented Nov 15, 2019

Awesome! Thank for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.