support for quickcompiler + minor cleanup + qtmoc speedup

This commit is contained in:
therecipe 2019-05-01 02:39:02 +02:00
parent 746779e4c0
commit 9f97258ffe
26 changed files with 244 additions and 164 deletions

View file

@ -62,6 +62,9 @@ func main() {
var comply bool
flag.BoolVar(&comply, "comply", false, "dump object code to make it easier to comply with LGPL obligations for proprietary developments")
var quickcompiler bool
flag.BoolVar(&quickcompiler, "quickcompiler", false, "use the quickcompiler")
if cmd.ParseFlags() {
flag.Usage()
}
@ -110,7 +113,7 @@ func main() {
if err != nil || !utils.ExistsDir(path) {
utils.Log.WithError(err).WithField("path", path).Debug("can't resolve absolute path")
dirFunc := func() (string, error) {
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir")
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath, "-find"), "get pkg dir")
return strings.TrimSpace(out), err
}
if dir, err := dirFunc(); err != nil || len(dir) == 0 {
@ -129,5 +132,5 @@ func main() {
fast = false
}
deploy.Deploy(mode, target, path, docker, ldFlags, tags, fast, device, vagrant, vagrant_system, comply)
deploy.Deploy(mode, target, path, docker, ldFlags, tags, fast, device, vagrant, vagrant_system, comply, quickcompiler)
}

View file

@ -77,7 +77,7 @@ func main() {
if err != nil || !utils.ExistsDir(path) {
utils.Log.WithError(err).WithField("path", path).Debug("can't resolve absolute path")
dirFunc := func() (string, error) {
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir")
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath, "-find"), "get pkg dir")
return strings.TrimSpace(out), err
}
if dir, err := dirFunc(); err != nil || len(dir) == 0 {

View file

@ -83,7 +83,7 @@ func main() {
if err != nil || !utils.ExistsDir(path) {
utils.Log.WithError(err).WithField("path", path).Debug("can't resolve absolute path")
dirFunc := func() (string, error) {
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir")
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath, "-find"), "get pkg dir")
return strings.TrimSpace(out), err
}
if dir, err := dirFunc(); err != nil || len(dir) == 0 {

View file

@ -41,6 +41,9 @@ func main() {
var tags string
flag.StringVar(&tags, "tags", "", "a list of build tags to consider satisfied during the build")
var quickcompiler bool
flag.BoolVar(&quickcompiler, "quickcompiler", false, "use the quickcompiler")
if cmd.ParseFlags() {
flag.Usage()
}
@ -80,7 +83,7 @@ func main() {
if err != nil || !utils.ExistsDir(path) {
utils.Log.WithError(err).WithField("path", path).Debug("can't resolve absolute path")
dirFunc := func() (string, error) {
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir")
out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath, "-find"), "get pkg dir")
return strings.TrimSpace(out), err
}
if dir, err := dirFunc(); err != nil || len(dir) == 0 {
@ -104,6 +107,6 @@ func main() {
case vagrant:
cmd.Vagrant([]string{"qtrcc", "-debug"}, target, path, false, vagrant_system)
default:
rcc.Rcc(path, target, tags, output)
rcc.Rcc(path, target, tags, output, quickcompiler)
}
}

View file

@ -424,51 +424,42 @@ var (
)
func GetCustomLibs(target string, env map[string]string, tags []string) map[string]string {
wg := new(sync.WaitGroup)
wc := make(chan bool, 50)
out := make(map[string]string)
outMutex := new(sync.Mutex)
getCustomLibsCacheMutex.Lock()
defer getCustomLibsCacheMutex.Unlock()
lookup := func(lm map[string]*Class) {
out := make(map[string]string)
var modules []string
var pkgs []string
for _, lm := range []map[string]*Class{State.ClassMap, State.GoClassMap} {
for _, c := range lm {
if c.Pkg == "" {
continue
}
wg.Add(1)
wc <- true
go func(c *Class) {
getCustomLibsCacheMutex.Lock()
path, ok := getCustomLibsCache[c.Pkg]
getCustomLibsCacheMutex.Unlock()
if !ok {
cmd := utils.GoList("{{.ImportPath}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
cmd.Dir = c.Pkg
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", k, v))
}
path = strings.TrimSpace(utils.RunCmd(cmd, "get import path"))
getCustomLibsCacheMutex.Lock()
getCustomLibsCache[c.Pkg] = path
getCustomLibsCacheMutex.Unlock()
if path, ok := getCustomLibsCache[c.Pkg]; !ok {
if _, ok = out[c.Module]; !ok {
out[c.Module] = c.Pkg
modules = append(modules, c.Module)
pkgs = append(pkgs, c.Pkg)
}
outMutex.Lock()
} else {
out[c.Module] = path
outMutex.Unlock()
<-wc
wg.Done()
}(c)
}
}
}
lookup(State.ClassMap)
lookup(State.GoClassMap)
if len(modules) > 0 {
cmd := utils.GoList(append([]string{"{{.ImportPath}}", "-find", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \""))}, pkgs...)...)
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", k, v))
}
wg.Wait()
for i, path := range strings.Split(strings.TrimSpace(utils.RunCmd(cmd, "get import path")), "\n") {
path = strings.TrimSpace(path)
getCustomLibsCache[pkgs[i]] = path
out[modules[i]] = path
}
}
return out
}

View file

@ -71,39 +71,39 @@ func LoadModule(m string) *Module {
var err error
switch {
case utils.QT_WEBKIT() && m == "WebKit":
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/5.8.0", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/5.8.0", "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_MXE():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_HOMEBREW():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_MACPORTS(), utils.QT_NIX(), utils.QT_FELGO():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.11.1"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.11.1"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_MSYS2():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.12.0"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_UBPORTS_VERSION() == "xenial":
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.9.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.9.0"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_SAILFISH():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.6.3"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.6.3"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_RPI():
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.7.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API("5.7.0"), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
case utils.QT_PKG_CONFIG():
if utils.QT_API("") != "" {
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
} else {
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.QT_DOC_DIR(), fmt.Sprintf("qt%v", strings.ToLower(m)), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
}
default:
if utils.QT_API("") != "" {
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
} else {
path := filepath.Join(utils.QT_DIR(), "Docs", fmt.Sprintf("Qt-%v", utils.QT_VERSION_MAJOR()), fmt.Sprintf("qt%v", strings.ToLower(m)), fmt.Sprintf("qt%v.index", strings.ToLower(m)))
if !utils.ExistsDir(filepath.Join(utils.QT_DIR(), "Docs", fmt.Sprintf("Qt-%v", utils.QT_VERSION_MAJOR()))) {
@ -111,7 +111,7 @@ func LoadModule(m string) *Module {
}
err = xml.Unmarshal([]byte(utils.LoadOptional(path)), &module)
if err != nil {
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+utils.QT_API(utils.QT_VERSION()), "-find", "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
}
}
}

View file

@ -201,9 +201,7 @@ func createProject(module, path, target string, mode int, libs []string) {
var out []string
switch {
case mode == RCC:
out = []string{"Core"}
case mode == MOC, module == "build_static":
case mode == RCC, mode == MOC, module == "build_static":
out = libs
case mode == MINIMAL, mode == NONE:
out = append([]string{module}, libs...)

View file

@ -563,15 +563,15 @@ func preambleCpp(module string, input []byte, mode int, target, tags string) []b
var classes = make([]string, 0)
for _, class := range parser.State.ClassMap {
if (strings.Contains(string(input), class.Name+";") ||
strings.Contains(string(input), class.Name+":") ||
strings.Contains(string(input), class.Name+"*") ||
strings.Contains(string(input), class.Name+" ") ||
strings.Contains(string(input), class.Name+"<") ||
strings.Contains(string(input), class.Name+">") ||
strings.Contains(string(input), class.Name+"(") ||
strings.Contains(string(input), class.Name+")") ||
strings.Contains(string(input), class.Name+"_")) && class.Module != parser.MOC {
if (bytes.Contains(input, []byte(class.Name+";")) ||
bytes.Contains(input, []byte(class.Name+":")) ||
bytes.Contains(input, []byte(class.Name+"*")) ||
bytes.Contains(input, []byte(class.Name+" ")) ||
bytes.Contains(input, []byte(class.Name+"<")) ||
bytes.Contains(input, []byte(class.Name+">")) ||
bytes.Contains(input, []byte(class.Name+"(")) ||
bytes.Contains(input, []byte(class.Name+")")) ||
bytes.Contains(input, []byte(class.Name+"_"))) && class.Module != parser.MOC {
classes = append(classes, class.Name)
}
}
@ -765,6 +765,10 @@ func preambleCpp(module string, input []byte, mode int, target, tags string) []b
}
}
if mode == MOC {
fmt.Fprint(bb, "\n#ifdef QT_QML_LIB\n\t#include <QQmlEngine>\n#endif\n")
}
fmt.Fprint(bb, "\n")
for _, class := range parser.State.ClassMap {

View file

@ -292,12 +292,6 @@ func (ptr *%[1]v) Destroy%[1]v() {
if f.Target == "" {
fmt.Fprintf(bb, "this.Connect%v(this.%v)\n", strings.Title(name), name)
} else {
t := f.Target
if strings.Count(t, ".") != 2 {
if !(len(strings.Split(f.Target, ".")) == 2 && strings.Split(f.Target, ".")[0] != "this" && strings.Split(f.Target, ".")[1][:1] == strings.ToLower(strings.Split(f.Target, ".")[1][:1])) {
t = f.Target + "." + name
}
}
tUpper := strings.Split(f.Target, ".")
tUpper[len(tUpper)-1] = strings.Title(tUpper[len(tUpper)-1])
@ -309,12 +303,6 @@ func (ptr *%[1]v) Destroy%[1]v() {
}
} else {
if f.Target != "" {
t := f.Target
if strings.Count(t, ".") != 2 {
if !(len(strings.Split(f.Target, ".")) == 2 && strings.Split(f.Target, ".")[0] != "this" && strings.Split(f.Target, ".")[1][:1] == strings.ToLower(strings.Split(f.Target, ".")[1][:1])) {
t = f.Target + "." + name
}
}
tCon := strings.Split(f.Target, ".")
tCon[len(tCon)-1] = "Connect" + strings.Title(tCon[len(tCon)-1])

View file

@ -48,7 +48,7 @@ func GenModule(m, target string, mode int) {
}
if m == "AndroidExtras" {
utils.Save(utils.GoQtPkgPath(strings.ToLower(m), "utils-androidextras_android.go"), utils.Load(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal", "get files dir")), "/binding/files/utils-androidextras_android.go")))
utils.Save(utils.GoQtPkgPath(strings.ToLower(m), "utils-androidextras_android.go"), utils.Load(filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal", "-find", "get files dir")), "/binding/files/utils-androidextras_android.go")))
}
if !UseStub(false, "Qt"+m, mode) {

View file

@ -45,11 +45,11 @@ func ParseFlags() bool {
}
if api := utils.QT_API(""); api != "" {
if utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+api, "get doc dir") == "" {
if utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+api, "-find", "get doc dir") == "" {
utils.Log.Errorf("invalid api version provided: '%v'", api)
fmt.Println("valid api versions are:")
if !utils.UseGOMOD("") {
if o := utils.GoListOptional("'{{ join .Imports \"|\" }}'", "github.com/therecipe/qt/internal/binding/files/docs", "get doc dir"); o != "" {
if o := utils.GoListOptional("{{join .Imports \"|\"}}", "github.com/therecipe/qt/internal/binding/files/docs", "get doc dir"); o != "" {
for _, v := range strings.Split(o, "|") {
fmt.Println(strings.TrimPrefix(strings.TrimSpace(strings.Replace(v, "'", "", -1)), "github.com/therecipe/qt/internal/binding/files/docs/"))
}
@ -61,7 +61,7 @@ func ParseFlags() bool {
wg.Add(1)
go func(mid, min int) {
v := fmt.Sprintf("5.%v.%v", mid, min)
if utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+v, "get doc dir") != "" {
if utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/"+v, "-find", "get doc dir") != "" {
fmt.Println(v)
}
wg.Done()
@ -142,7 +142,7 @@ func InitEnv(target string) {
}
if !utils.ExistsDir(utils.QT_DIR()) {
qt_dir := strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", "github.com/therecipe/env_"+runtime.GOOS+"_amd64_"+strconv.Itoa(utils.QT_VERSION_NUM())[:3]), "get env dir"))
qt_dir := strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", "github.com/therecipe/env_"+runtime.GOOS+"_amd64_"+strconv.Itoa(utils.QT_VERSION_NUM())[:3], "-find"), "get env dir"))
switch runtime.GOOS {
case "linux", "darwin", "windows":
@ -168,7 +168,7 @@ func InitEnv(target string) {
if err == nil {
link = filepath.Join("C:\\", "Users", "Public", "env_windows_amd64_Tools")
utils.RemoveAll(link)
_, err = utils.RunCmdOptionalError(exec.Command("cmd", "/C", "mklink", "/J", link, strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", "github.com/therecipe/env_"+runtime.GOOS+"_amd64_"+strconv.Itoa(utils.QT_VERSION_NUM())[:3]+"/Tools"), "get env dir"))), "create symlink for env")
_, err = utils.RunCmdOptionalError(exec.Command("cmd", "/C", "mklink", "/J", link, strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", "github.com/therecipe/env_"+runtime.GOOS+"_amd64_"+strconv.Itoa(utils.QT_VERSION_NUM())[:3]+"/Tools", "-find"), "get env dir"))), "create symlink for env")
}
}
if err != nil {

View file

@ -176,11 +176,15 @@ func ios_c_main_wrapper() string {
bb := new(bytes.Buffer)
bb.WriteString("#include \"libgo.h\"\n")
for _, n := range rcc.ResourceNames {
fmt.Fprintf(bb, "extern int qInitResources_%v();\n", n)
for _, n = range strings.Split(n, "|") {
fmt.Fprintf(bb, "extern int qInitResources_%v();\n", n)
}
}
bb.WriteString("int main(int argc, char *argv[]) {\n")
for _, n := range rcc.ResourceNames {
fmt.Fprintf(bb, "qInitResources_%v();\n", n)
for _, n = range strings.Split(n, "|") {
fmt.Fprintf(bb, "qInitResources_%v();\n", n)
}
}
bb.WriteString("go_main_wrapper(argc, argv);\n}")
return bb.String()
@ -750,11 +754,15 @@ func js_c_main_wrapper(target string) string {
bb := new(bytes.Buffer)
bb.WriteString("#include <emscripten.h>\n")
for _, n := range rcc.ResourceNames {
fmt.Fprintf(bb, "extern int qInitResources_%v();\n", n)
for _, n = range strings.Split(n, "|") {
fmt.Fprintf(bb, "extern int qInitResources_%v();\n", n)
}
}
bb.WriteString("int main(int argc, char *argv[]) {\n")
for _, n := range rcc.ResourceNames {
fmt.Fprintf(bb, "qInitResources_%v();\n", n)
for _, n = range strings.Split(n, "|") {
fmt.Fprintf(bb, "qInitResources_%v();\n", n)
}
}
//TODO: use emscripten_sync_run_in_main_runtime_thread once thread support is there ?

View file

@ -763,7 +763,7 @@ func bundle(mode, target, path, name, depPath string, tagsCustom string, fast bo
if tagsCustom != "" {
tags = append(tags, strings.Split(tagsCustom, " ")...)
}
lcmd := utils.GoList("{{ join .Deps \"|\" }}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
lcmd := utils.GoList("{{join .Deps \"|\"}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
lcmd.Dir = path
for k, v := range env {
lcmd.Env = append(lcmd.Env, fmt.Sprintf("%v=%v", k, v))

View file

@ -14,7 +14,7 @@ import (
"github.com/therecipe/qt/internal/utils"
)
func Deploy(mode, target, path string, docker bool, ldFlags, tags string, fast bool, device string, vagrant bool, vagrantsystem string, comply bool) {
func Deploy(mode, target, path string, docker bool, ldFlags, tags string, fast bool, device string, vagrant bool, vagrantsystem string, comply bool, quickcompiler bool) {
utils.Log.WithField("mode", mode).WithField("target", target).WithField("path", path).WithField("docker", docker).WithField("ldFlags", ldFlags).WithField("fast", fast).WithField("comply", comply).Debug("running Deploy")
name := filepath.Base(path)
switch name {
@ -69,7 +69,7 @@ func Deploy(mode, target, path string, docker bool, ldFlags, tags string, fast b
utils.RemoveAll(depPath + "_obj")
}
rcc.Rcc(path, target, tags, os.Getenv("QTRCC_OUTPUT_DIR"))
rcc.Rcc(path, target, tags, os.Getenv("QTRCC_OUTPUT_DIR"), quickcompiler)
if !fast {
moc.Moc(path, target, tags, false, false)
}

View file

@ -30,7 +30,7 @@ func Minimal(path, target, tags string) {
if !(target == "js" || target == "wasm" || utils.QT_NOT_CACHED()) { //TODO: remove for module support + resolve dependencies
env, tagsEnv, _, _ := cmd.BuildEnv(target, "", "")
scmd := utils.GoList("'{{.Stale}}':'{{.StaleReason}}'")
scmd := utils.GoList("{{.Stale}}{{.StaleReason}}")
scmd.Dir = path
tagsEnv = append(tagsEnv, "minimal")
@ -195,6 +195,7 @@ func Minimal(path, target, tags string) {
delete(parser.State.ClassMap, bl)
}
}
parser.State.ClassMap["QSvgWidget"].Export = true
case "rpi1", "rpi2", "rpi3":
if !utils.QT_RPI() {
@ -231,6 +232,9 @@ func Minimal(path, target, tags string) {
case "js", "wasm":
parser.State.ClassMap["QSvgWidget"].Export = true
}
if utils.QT_STATIC() {
parser.State.ClassMap["QSvgWidget"].Export = true
}
wg.Add(len(files))
for _, f := range files {

View file

@ -71,7 +71,7 @@ func moc(path, target, tags string, fast, slow, root bool, l int, dirty bool) {
if !dirty {
env, tagsEnv, _, _ := cmd.BuildEnv(target, "", "")
scmd := utils.GoList("'{{.Stale}}':'{{.StaleReason}}'")
scmd := utils.GoList("{{.Stale}}{{.StaleReason}}")
scmd.Dir = path
if !fast && !utils.QT_FAT() {
@ -338,7 +338,7 @@ func moc(path, target, tags string, fast, slow, root bool, l int, dirty bool) {
var staleCheck string
if !(target == "js" || target == "wasm" || utils.QT_NOT_CACHED()) { //TODO: remove for module support + resolve dependencies
env, tagsEnv, _, _ := cmd.BuildEnv(target, "", "")
scmd := utils.GoList("'{{.Stale}}':'{{.StaleReason}}'")
scmd := utils.GoList("{{.Stale}}{{.StaleReason}}")
scmd.Dir = path
if !fast && !utils.QT_FAT() {
@ -374,17 +374,11 @@ func moc(path, target, tags string, fast, slow, root bool, l int, dirty bool) {
rootWg.Add(1)
go func() {
defer rootWg.Done()
var fix []byte
var err error
for i := 0; i < 5; i++ {
fix, err = imports.Process("moc.go", fixR, nil)
if err != nil {
utils.Log.WithError(err).Error("failed to fix go imports")
fix = fixR
}
fix, err := imports.Process("moc.go", fixR, nil)
if err != nil {
utils.Log.WithError(err).Error("failed to fix go imports")
fix = fixR
}
if err := utils.SaveBytes(filepath.Join(path, "moc.go"), fix); err != nil {
return
}
@ -544,7 +538,7 @@ func parse(path string) ([]*parser.Class, string, error) {
if n, ok := goNameCache[imp.Path.Value]; ok {
name = n
} else {
name = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Name}}", strings.Replace(imp.Path.Value, "\"", "", -1)), "get import name"))
name = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Name}}", strings.Replace(imp.Path.Value, "\"", "", -1), "-find"), "get import name"))
goNameCache[imp.Path.Value] = name
}
goNameCacheMutex.Unlock()
@ -554,7 +548,7 @@ func parse(path string) ([]*parser.Class, string, error) {
if d, ok := goDirCache[imp.Path.Value]; ok {
dir = d
} else {
dir = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", strings.Replace(imp.Path.Value, "\"", "", -1)), "get import dir"))
dir = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", strings.Replace(imp.Path.Value, "\"", "", -1), "-find"), "get import dir"))
goDirCache[imp.Path.Value] = dir
}
goDirCacheMutex.Unlock()
@ -584,7 +578,7 @@ func parse(path string) ([]*parser.Class, string, error) {
if n, ok := goNameCache[imp.Path.Value]; ok {
name = n
} else {
name = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Name}}", strings.Replace(imp.Path.Value, "\"", "", -1)), "get import name"))
name = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Name}}", strings.Replace(imp.Path.Value, "\"", "", -1), "-find"), "get import name"))
goNameCache[imp.Path.Value] = name
}
goNameCacheMutex.Unlock()
@ -598,7 +592,7 @@ func parse(path string) ([]*parser.Class, string, error) {
if d, ok := goDirCache[imp.Path.Value]; ok {
dir = d
} else {
dir = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", strings.Replace(imp.Path.Value, "\"", "", -1)), "get import dir"))
dir = strings.TrimSpace(utils.RunCmd(utils.GoList("{{.Dir}}", strings.Replace(imp.Path.Value, "\"", "", -1), "-find"), "get import dir"))
goDirCache[imp.Path.Value] = dir
}
goDirCacheMutex.Unlock()

View file

@ -22,7 +22,7 @@ var (
ResourceNamesMutex = new(sync.Mutex)
)
func Rcc(path, target, tagsCustom, output_dir string) {
func Rcc(path, target, tagsCustom, output_dir string, quickcompiler bool) {
if utils.UseGOMOD(path) {
if !utils.ExistsDir(filepath.Join(path, "vendor")) {
cmd := exec.Command("go", "mod", "vendor")
@ -31,10 +31,10 @@ func Rcc(path, target, tagsCustom, output_dir string) {
}
}
rcc(path, target, tagsCustom, output_dir, true)
rcc(path, target, tagsCustom, output_dir, quickcompiler, true)
}
func rcc(path, target, tagsCustom, output_dir string, root bool) {
func rcc(path, target, tagsCustom, output_dir string, quickcompiler bool, root bool) {
utils.Log.WithField("path", path).WithField("target", target).Debug("start Rcc")
//TODO: cache non go asset (*.qml, ...) hashes in rcc.go files to indentify staled assets in cached go packages
@ -47,7 +47,7 @@ func rcc(path, target, tagsCustom, output_dir string, root bool) {
wg.Add(len(allImports))
for _, path := range allImports {
go func(path string) {
rcc(path, target, tagsCustom, path, false)
rcc(path, target, tagsCustom, path, quickcompiler, false)
wg.Done()
}(path)
}
@ -85,7 +85,7 @@ func rcc(path, target, tagsCustom, output_dir string, root bool) {
tags = append(tags, strings.Split(tagsCustom, " ")...)
}
pkgCmd := utils.GoList("{{.Name}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
pkgCmd := utils.GoList("{{.Name}}", "-find", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
pkgCmd.Dir = path
for k, v := range env {
pkgCmd.Env = append(pkgCmd.Env, fmt.Sprintf("%v=%v", k, v))
@ -96,12 +96,16 @@ func rcc(path, target, tagsCustom, output_dir string, root bool) {
pkg = filepath.Base(path)
}
libs := []string{"Core"}
if quickcompiler {
libs = append(libs, "Qml")
}
rccCpp := filepath.Join(path, "rcc.cpp")
if output_dir != "" {
rccCpp = filepath.Join(output_dir, "rcc.cpp")
templater.CgoTemplateSafe(pkg, output_dir, target, templater.RCC, "", "", []string{"Core"})
templater.CgoTemplateSafe(pkg, output_dir, target, templater.RCC, "", "", libs)
} else {
templater.CgoTemplateSafe(pkg, path, target, templater.RCC, "", "", []string{"Core"})
templater.CgoTemplateSafe(pkg, path, target, templater.RCC, "", "", libs)
}
if dir := filepath.Join(path, "qml"); utils.ExistsDir(dir) {
@ -114,6 +118,9 @@ func rcc(path, target, tagsCustom, output_dir string, root bool) {
if utils.ExistsFile(filepath.Join(path, "qtquickcontrols2.conf")) {
content = strings.Replace(content, "<qresource>", "<qresource>\n<file>qtquickcontrols2.conf</file>", -1)
}
//TODO: filter out duplicate assets
utils.Save(rccQrc, content)
}
@ -123,29 +130,118 @@ func rcc(path, target, tagsCustom, output_dir string, root bool) {
}
var fileList []string
for _, file := range files {
if !file.IsDir() && filepath.Ext(file.Name()) == ".qrc" {
if !file.IsDir() && filepath.Ext(file.Name()) == ".qrc" && !strings.HasSuffix(file.Name(), "_qml_cache.qrc") {
//TODO: check for buildTags
fileList = append(fileList, filepath.Join(path, file.Name()))
}
}
nameCmd := utils.GoList("{{.ImportPath}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
nameCmd := utils.GoList("{{.ImportPath}}", "-find", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
nameCmd.Dir = path
for k, v := range env {
nameCmd.Env = append(nameCmd.Env, fmt.Sprintf("%v=%v", k, v))
}
name := strings.TrimSpace(utils.RunCmd(nameCmd, "run go list"))
name := "rcc_" + strings.TrimSpace(utils.RunCmd(nameCmd, "run go list"))
for _, s := range []string{"/", ".", "-"} {
name = strings.Replace(name, s, "_", -1)
}
ResourceNamesMutex.Lock()
ResourceNames[rccCpp] = name
ResourceNamesMutex.Unlock()
rcc := exec.Command(utils.ToolPath("rcc", target), "-name", name, "-o", rccCpp)
rcc.Args = append(rcc.Args, fileList...)
utils.RunCmd(rcc, fmt.Sprintf("execute rcc *.cpp on %v for %v", runtime.GOOS, target))
if cachgen := utils.ToolPath("qmlcachegen", target); utils.ExistsFile(cachgen) && quickcompiler {
utils.RemoveAll(rccCpp)
var filteredFiles []string
var possibleMixedFiles []string
var pureFiles []string
for _, f := range fileList {
newName := filepath.Join(filepath.Dir(f), name+"_"+strings.TrimSuffix(filepath.Base(f), ".qrc")+"_qml_cache.qrc")
utils.RunCmd(exec.Command(cachgen, "--filter-resource-file", "-o", newName, f), fmt.Sprintf("execute qmlcachegen filter on %v for %v", runtime.GOOS, target))
for _, tBC := range strings.Split(strings.TrimSpace(utils.RunCmd(exec.Command(utils.ToolPath("rcc", target), "-list", f), "execute rcc")), "\n") {
tBC = strings.TrimSpace(tBC)
if strings.HasSuffix(tBC, ".qml") || strings.HasSuffix(tBC, ".js") {
tBCT := strings.Replace(tBC, ".", "_", -1)
cmd := exec.Command(cachgen)
/* TODO: re-enable to warn about duplicate assets?
for _, fl := range fileList {
cmd.Args = append(cmd.Args, []string{"--resource", fl}...)
}
*/
cmd.Args = append(cmd.Args, []string{"--resource", f}...)
cmd.Args = append(cmd.Args, []string{"-o", filepath.Join(filepath.Dir(f), "rcc_"+strings.TrimSuffix(filepath.Base(f), ".qrc")+"_"+filepath.Base(filepath.Dir(tBCT))+"_"+filepath.Base(tBCT+"_qml_cache.cpp")), tBC}...)
utils.RunCmd(cmd, fmt.Sprintf("execute qmlcachegen cache on %v for %v", runtime.GOOS, target))
}
}
tmpName := filepath.Join(filepath.Dir(f), name+"_"+filepath.Base(f))
if utils.ExistsFile(newName) {
filteredFiles = append(filteredFiles, newName)
utils.Save(tmpName, utils.Load(f))
possibleMixedFiles = append(possibleMixedFiles, tmpName)
defer func() { utils.RemoveAll(newName) }()
} else {
utils.Save(tmpName, utils.Load(f))
pureFiles = append(pureFiles, tmpName)
}
defer func() { utils.RemoveAll(tmpName) }()
}
if len(possibleMixedFiles) > 0 || len(pureFiles) > 0 {
cmd := exec.Command(utils.ToolPath("qmlcachegen", target))
cmd.Dir = path
for i, _ := range possibleMixedFiles {
cmd.Args = append(cmd.Args, fmt.Sprintf("--resource-file-mapping=%v=%v", possibleMixedFiles[i], filteredFiles[i]))
}
for _, f := range pureFiles {
cmd.Args = append(cmd.Args, fmt.Sprintf("--resource-file-mapping=%v", f))
}
cmd.Args = append(cmd.Args, []string{"-o", "rcc_qmlcache_loader.cpp"}...)
cmd.Args = append(cmd.Args, possibleMixedFiles...)
cmd.Args = append(cmd.Args, pureFiles...)
var initNameList []string
for _, f := range append(possibleMixedFiles, pureFiles...) {
initNameList = append(initNameList, strings.TrimSuffix(filepath.Base(f), ".qrc"))
}
ResourceNamesMutex.Lock()
ResourceNames[filepath.Join(path, "rcc_qmlcache_loader.cpp")] = strings.Join(initNameList, "|")
ResourceNamesMutex.Unlock()
utils.RunCmd(cmd, fmt.Sprintf("execute qmlcachegen loader on %v for %v", runtime.GOOS, target))
}
for _, f := range filteredFiles {
rcc := exec.Command(utils.ToolPath("rcc", target), "-name", strings.TrimSuffix(filepath.Base(f), ".qrc"), "-o", strings.Replace(filepath.Base(strings.TrimSuffix(f, ".qrc")), name, "rcc", -1)+".cpp")
rcc.Dir = path
rcc.Args = append(rcc.Args, f)
utils.RunCmd(rcc, fmt.Sprintf("execute per file rcc *.cpp on %v for %v", runtime.GOOS, target))
ResourceNamesMutex.Lock()
ResourceNames[f+".cpp"] = strings.TrimSuffix(filepath.Base(f), ".qrc")
ResourceNamesMutex.Unlock()
}
} else {
ResourceNamesMutex.Lock()
ResourceNames[rccCpp] = name
ResourceNamesMutex.Unlock()
rcc := exec.Command(utils.ToolPath("rcc", target), "-name", name, "-o", rccCpp)
rcc.Args = append(rcc.Args, fileList...)
utils.RunCmd(rcc, fmt.Sprintf("execute rcc *.cpp on %v for %v", runtime.GOOS, target))
}
if utils.QT_DEBUG_QML() {
utils.Save("debug.pro", fmt.Sprintf("RESOURCES += %v", strings.Join(fileList, " ")))

View file

@ -136,7 +136,7 @@ func Test(target string, docker, vagrant bool, vagrantsystem string) {
example := filepath.Join(cat, example)
path := filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/examples", "get doc dir")), example)
path := filepath.Join(strings.TrimSpace(utils.GoListOptional("{{.Dir}}", "github.com/therecipe/qt/internal/examples", "-find", "get doc dir")), example)
utils.Log.Infof("testing %v", example)
deploy.Deploy(
mode,
@ -150,6 +150,7 @@ func Test(target string, docker, vagrant bool, vagrantsystem string) {
vagrant,
vagrantsystem,
false,
false,
)
templater.CleanupDepsForCI()
templater.CleanupDepsForCI = func() {}

View file

@ -57,17 +57,13 @@ func GetImports(path, target, tagsCustom string, level int, onlyDirect, moc bool
}
//TODO: cache
cmd := utils.GoList("'{{ join .TestImports \"|\" }}':'{{ join .XTestImports \"|\" }}':'{{ join ."+imp+" \"|\" }}'", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
cmd := utils.GoList("{{join .TestImports \"|\"}}|{{join .XTestImports \"|\"}}|{{join ."+imp+" \"|\"}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
cmd.Dir = path
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", k, v))
}
out := strings.TrimSpace(utils.RunCmd(cmd, "go list deps"))
out = strings.Replace(out, "'", "", -1)
out = strings.Replace(out, ":", "|", -1)
libs := strings.Split(out, "|")
libs := strings.Split(strings.TrimSpace(utils.RunCmd(cmd, "go list deps")), "|")
for i := len(libs) - 1; i >= 0; i-- {
if strings.TrimSpace(libs[i]) == "" {
libs = append(libs[:i], libs[i+1:]...)
@ -106,7 +102,7 @@ func GetImports(path, target, tagsCustom string, level int, onlyDirect, moc bool
return
}
cmd := utils.GoList("{{.Dir}}", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")), l)
cmd := utils.GoList("{{.Dir}}", "-find", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")), l)
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", k, v))
}
@ -140,18 +136,14 @@ func GetGoFiles(path, target, tagsCustom string) []string {
}
//TODO: cache
cmd := utils.GoList("'{{ join .GoFiles \"|\" }}':'{{ join .CgoFiles \"|\" }}':'{{ join .TestGoFiles \"|\" }}':'{{ join .XTestGoFiles \"|\" }}'", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
cmd := utils.GoList("{{join .GoFiles \"|\"}}|{{join .CgoFiles \"|\"}}|{{join .TestGoFiles \"|\"}}|{{join .XTestGoFiles \"|\"}}", "-find", fmt.Sprintf("-tags=\"%v\"", strings.Join(tags, "\" \"")))
cmd.Dir = path
for k, v := range env {
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", k, v))
}
out := strings.TrimSpace(utils.RunCmd(cmd, "go list gofiles"))
out = strings.Replace(out, "'", "", -1)
out = strings.Replace(out, ":", "|", -1)
importMap := make(map[string]struct{})
for _, v := range strings.Split(out, "|") {
for _, v := range strings.Split(strings.TrimSpace(utils.RunCmd(cmd, "go list gofiles")), "|") {
if strings.TrimSpace(v) != "" {
importMap[v] = struct{}{}
}

View file

@ -8,29 +8,32 @@ import (
"github.com/therecipe/qt/qml"
)
type Application struct {
var Application *application
type application struct {
core.QObject
_ func() `constructor:"init"`
_ func() `slot:"initializeQML,auto"`
_ func() `signal:"onPermissionsGranted,auto(this.Application_PTR().initializeQML)"`
_ func() `signal:"onPermissionsDenied,auto(this.Application_PTR().initializeQML)"`
_ func() `signal:"onPermissionsGranted"`
_ func() `signal:"onPermissionsDenied"`
engine *qml.QQmlApplicationEngine
}
func (a *Application) init() {
NativeHelper.registerApplicationInstance(a.QObject_PTR())
func (a *application) init() {
Application = a
a.engine = qml.NewQQmlApplicationEngine(nil)
a.ConnectOnPermissionsGranted(a.initializeQML)
a.ConnectOnPermissionsDenied(a.initializeQML)
}
func (a *Application) initializeQML() {
func (a *application) initializeQML() {
a.engine.Load(core.NewQUrl3("qrc:/main.qml", 0))
}
func (a *Application) checkPermissions() {
func (a *application) checkPermissions() {
if runtime.GOOS == "android" {
//intentionally called in the C++ thread since it is blocking and will continue after the check
println("About to request permissions")

View file

@ -1,15 +0,0 @@
package main
import "github.com/therecipe/qt/core"
var NativeHelper = new(nativeHelpers)
type nativeHelpers struct{ application_p_ *core.QObject }
func (nh *nativeHelpers) registerApplicationInstance(app_p *core.QObject) {
nh.application_p_ = app_p
}
func (nh *nativeHelpers) getApplicationInstance() *core.QObject {
return nh.application_p_
}

View file

@ -11,11 +11,11 @@ import (
//export Java_org_ftylitak_qzxing_NativeFunctions_onPermissionsGranted
func Java_org_ftylitak_qzxing_NativeFunctions_onPermissionsGranted(_, _ unsafe.Pointer) {
println("permission granted callback")
NewApplicationFromPointer(NativeHelper.getApplicationInstance().Pointer()).OnPermissionsGranted()
Application.OnPermissionsGranted()
}
//export Java_org_ftylitak_qzxing_NativeFunctions_onPermissionsDenied
func Java_org_ftylitak_qzxing_NativeFunctions_onPermissionsDenied(_, _ unsafe.Pointer) {
println("permission denied callback")
NewApplicationFromPointer(NativeHelper.getApplicationInstance().Pointer()).OnPermissionsDenied()
Application.OnPermissionsDenied()
}

View file

@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strconv"
)
func main() {
@ -80,7 +81,7 @@ func main() {
}
println("generated makefile for", target)
iCmd := exec.Command("make")
iCmd := exec.Command("make", "-j", strconv.Itoa(runtime.NumCPU()))
iCmd.Dir = filepath.Join(pwd, "qzxing", "src", target)
if ndkOK {
iCmd.Env = append(iCmd.Env, "ANDROID_NDK_ROOT="+ndkPATH)

View file

@ -345,6 +345,15 @@ func GoList(args ...string) *exec.Cmd {
cmd.Args = append(cmd.Args, GOFLAGS())
}
}
for i := len(args) - 1; i >= 0; i-- {
a := args[i]
if strings.HasPrefix(a, "-") {
args = append(args[:i], args[i+1:]...)
cmd.Args = append(cmd.Args, a)
}
}
cmd.Args = append(cmd.Args, "-e", "-f")
cmd.Args = append(cmd.Args, args...)
cmd.Env = append(os.Environ(), []string{"CGO_ENABLED=0"}...)

View file

@ -28,7 +28,7 @@ func MustGoPath() string {
mustGoPathMutex.Lock()
if len(mustGoPath) == 0 {
if _, err := exec.LookPath("go"); err == nil {
mustGoPath = strings.TrimSpace(RunCmd(GoList("{{.Root}}", "github.com/therecipe/qt"), "get list gopath"))
mustGoPath = strings.TrimSpace(RunCmd(GoList("{{.Root}}", "github.com/therecipe/qt", "-find"), "get list gopath"))
}
if len(mustGoPath) == 0 {
mustGoPath = GOPATH()

View file

@ -92,7 +92,7 @@ var (
func GoQtPkgPath(s ...string) (r string) {
goQtPkgPathMutex.Lock()
if len(goQtPkgPath) == 0 {
goQtPkgPath = strings.TrimSpace(RunCmd(GoList("{{.Dir}}", packageName), "utils.GoQtPkgPath"))
goQtPkgPath = strings.TrimSpace(RunCmd(GoList("{{.Dir}}", packageName, "-find"), "utils.GoQtPkgPath"))
}
r = goQtPkgPath
goQtPkgPathMutex.Unlock()