diff --git a/cmd/qtdeploy/main.go b/cmd/qtdeploy/main.go index b613f1f35..411d796f0 100644 --- a/cmd/qtdeploy/main.go +++ b/cmd/qtdeploy/main.go @@ -110,7 +110,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(exec.Command("go", "list", "-f", "{{.Dir}}", oPath), "get pkg dir") + out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir") return strings.TrimSpace(out), err } if dir, err := dirFunc(); err != nil { diff --git a/cmd/qtminimal/main.go b/cmd/qtminimal/main.go index 802418e47..a1ef69835 100644 --- a/cmd/qtminimal/main.go +++ b/cmd/qtminimal/main.go @@ -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(exec.Command("go", "list", "-f", "{{.Dir}}", oPath), "get pkg dir") + out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir") return strings.TrimSpace(out), err } if dir, err := dirFunc(); err != nil { diff --git a/cmd/qtmoc/main.go b/cmd/qtmoc/main.go index 097052221..e43eee33d 100644 --- a/cmd/qtmoc/main.go +++ b/cmd/qtmoc/main.go @@ -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(exec.Command("go", "list", "-f", "{{.Dir}}", oPath), "get pkg dir") + out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir") return strings.TrimSpace(out), err } if dir, err := dirFunc(); err != nil { diff --git a/cmd/qtrcc/main.go b/cmd/qtrcc/main.go index 7225806e9..6bdf0e288 100644 --- a/cmd/qtrcc/main.go +++ b/cmd/qtrcc/main.go @@ -80,7 +80,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(exec.Command("go", "list", "-f", "{{.Dir}}", oPath), "get pkg dir") + out, err := utils.RunCmdOptionalError(utils.GoList("{{.Dir}}", oPath), "get pkg dir") return strings.TrimSpace(out), err } if dir, err := dirFunc(); err != nil { diff --git a/internal/binding/converter/helper.go b/internal/binding/converter/helper.go index 2de9b9e90..5dbf025fd 100644 --- a/internal/binding/converter/helper.go +++ b/internal/binding/converter/helper.go @@ -240,7 +240,10 @@ func IsPrivateSignal(f *parser.Function) bool { } } } else { - fData = utils.Load(filepath.Join(utils.QT_DARWIN_DIR(), "lib", fmt.Sprintf("%v.framework", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule)), "Versions", "5", "Headers", fPath)) + fData = utils.LoadOptional(filepath.Join(utils.QT_DARWIN_DIR(), "lib", fmt.Sprintf("%v.framework", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule)), "Versions", "5", "Headers", fPath)) + if len(fData) == 0 { + fData = utils.LoadOptional(filepath.Join(utils.QT_DARWIN_DIR(), "lib", fmt.Sprintf("%v.framework", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule)), "Headers", fPath)) + } } } diff --git a/internal/binding/parser/parser.go b/internal/binding/parser/parser.go index 1683f210c..4c80ae816 100644 --- a/internal/binding/parser/parser.go +++ b/internal/binding/parser/parser.go @@ -69,39 +69,39 @@ func LoadModule(m string) *Module { var err error switch { case utils.QT_WEBKIT() && m == "WebKit": - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", "5.8.0", fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.Dir}}", "github.com/therecipe/qt/internal/binding/files/docs/5.8.0"), "get doc dir")), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) case utils.QT_MXE(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.12.0"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_HOMEBREW(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.12.0"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_MACPORTS(), utils.QT_NIX(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.11.1"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_MSYS2(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.12.0"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_UBPORTS_VERSION() == "xenial": - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.9.0"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_SAILFISH(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.6.3"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_RPI(): - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API("5.7.0"), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) case utils.QT_PKG_CONFIG(): if utils.QT_API("") != "" { - err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API(utils.QT_VERSION()), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) } 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(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_API(utils.QT_VERSION()), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module) + err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.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) } 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()))) { diff --git a/internal/binding/templater/templater.go b/internal/binding/templater/templater.go index 77581269e..457b547c5 100644 --- a/internal/binding/templater/templater.go +++ b/internal/binding/templater/templater.go @@ -3,6 +3,7 @@ package templater import ( "os" "os/exec" + "path/filepath" "strings" "github.com/therecipe/qt/internal/binding/parser" @@ -47,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(utils.GoQtPkgPath("internal", "binding", "files", "utils-androidextras_android.go"))) + utils.Save(utils.GoQtPkgPath(strings.ToLower(m), "utils-androidextras_android.go"), utils.Load(filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.Dir}}", "github.com/therecipe/qt/internal"), "get files dir")), "/binding/files/utils-androidextras_android.go"))) } if !UseStub(false, "Qt"+m, mode) { diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index e1b39299d..227cb5cb4 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -136,6 +136,12 @@ func InitEnv(target string) { link = filepath.Join("C:\\", "Users", "Public", "env_windows_amd64") utils.RemoveAll(link) _, err = utils.RunCmdOptionalError(exec.Command("cmd", "/C", "mklink", "/J", link, qt_dir), "create symlink for env") + + 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") + } } if err != nil { if !(utils.ExistsFile(link) || utils.ExistsDir(link)) { diff --git a/internal/cmd/deploy/build.go b/internal/cmd/deploy/build.go index ee2aef5a7..409e7ed0f 100644 --- a/internal/cmd/deploy/build.go +++ b/internal/cmd/deploy/build.go @@ -46,7 +46,7 @@ func build(mode, target, path, ldFlagsCustom, tagsCustom, name, depPath string, case "wasm": ending = ".wasm" case "linux": - if fast { + if fast || utils.QT_PKG_CONFIG() { delete(env, "CGO_LDFLAGS") } } diff --git a/internal/cmd/deploy/bundle.go b/internal/cmd/deploy/bundle.go index 1319d7dee..8810e7329 100644 --- a/internal/cmd/deploy/bundle.go +++ b/internal/cmd/deploy/bundle.go @@ -157,7 +157,7 @@ func bundle(mode, target, path, name, depPath string, tagsCustom string, fast bo } if utils.ExistsFile(filepath.Join(libraryPath, libName)) { - utils.RunCmd(exec.Command("cp", "-L", filepath.Join(libraryPath, libName), filepath.Join(depPath, libDir, libName)), fmt.Sprintf("copy %v for %v on %v", libName, target, runtime.GOOS)) + utils.RunCmd(exec.Command("cp", "-L", strings.TrimSuffix(filepath.Join(libraryPath, libName), ".5"), filepath.Join(depPath, libDir, libName)), fmt.Sprintf("copy %v for %v on %v", libName, target, runtime.GOOS)) } if strings.Contains(dep, "WebEngine") || strings.Contains(dep, "WebView") { @@ -177,8 +177,8 @@ func bundle(mode, target, path, name, depPath string, tagsCustom string, fast bo libs = append(libs, []string{"WebEngine", "WebEngineCore", "WebChannel", "Positioning"}...) } for _, libName := range libs { - if utils.ExistsFile(filepath.Join(libraryPath, fmt.Sprintf("libQt5%v.so.5", libName))) { - utils.RunCmd(exec.Command("cp", "-L", filepath.Join(libraryPath, fmt.Sprintf("libQt5%v.so.5", libName)), filepath.Join(depPath, libDir, fmt.Sprintf("libQt5%v.so.5", libName))), fmt.Sprintf("copy %v for %v on %v", libName, target, runtime.GOOS)) + if utils.ExistsFile(filepath.Join(libraryPath, fmt.Sprintf("libQt5%v.so", libName))) { + utils.RunCmd(exec.Command("cp", "-L", filepath.Join(libraryPath, fmt.Sprintf("libQt5%v.so", libName)), filepath.Join(depPath, libDir, fmt.Sprintf("libQt5%v.so.5", libName))), fmt.Sprintf("copy %v for %v on %v", libName, target, runtime.GOOS)) } } if utils.ExistsFile(filepath.Join(libraryPath, "libqgsttools_p.so.1.0.0")) { diff --git a/internal/cmd/setup/test.go b/internal/cmd/setup/test.go index cd55db39b..8349c33a1 100644 --- a/internal/cmd/setup/test.go +++ b/internal/cmd/setup/test.go @@ -140,7 +140,8 @@ func Test(target string, docker, vagrant bool, vagrantsystem string) { } example := filepath.Join(cat, example) - path := utils.GoQtPkgPath("internal", "examples", example) + + path := filepath.Join(strings.TrimSpace(utils.RunCmdOptional(utils.GoList("{{.Dir}}", "github.com/therecipe/qt/internal/examples"), "get doc dir")), example) utils.Log.Infof("testing %v", example) deploy.Deploy( mode, diff --git a/internal/cmd/tools.go b/internal/cmd/tools.go index cdab759e6..09a9d56e9 100644 --- a/internal/cmd/tools.go +++ b/internal/cmd/tools.go @@ -1,10 +1,8 @@ -// +build tools - package cmd import ( //only needed for module support -> - _ "github.com/gopherjs/gopherjs" + _ "github.com/gopherjs/gopherjs/js" _ "github.com/therecipe/qt/internal/binding/files/docs" //<- ) diff --git a/internal/docker/docker_pipelines_template.yml b/internal/docker/docker_pipelines_template.yml index 077d0c94b..d9de881ab 100644 --- a/internal/docker/docker_pipelines_template.yml +++ b/internal/docker/docker_pipelines_template.yml @@ -104,13 +104,13 @@ jobs: file: windows_32_static/Dockerfile tag: windows_32_static dep: - - windows_32_static_base +# - windows_32_static_base - linux - - - template: docker_job_template.yml - parameters: - file: windows_32_static/Dockerfile.base - tag: windows_32_static_base +# - +# template: docker_job_template.yml +# parameters: +# file: windows_32_static/Dockerfile.base +# tag: windows_32_static_base - template: docker_job_template.yml parameters: @@ -130,13 +130,13 @@ jobs: file: windows_64_static/Dockerfile tag: windows_64_static dep: - - windows_64_static_base +# - windows_64_static_base - linux - - - template: docker_job_template.yml - parameters: - file: windows_64_static/Dockerfile.base - tag: windows_64_static_base +# - +# template: docker_job_template.yml +# parameters: +# file: windows_64_static/Dockerfile.base +# tag: windows_64_static_base # - # template: docker_job_template.yml # parameters: diff --git a/internal/examples/mod.go b/internal/examples/mod.go new file mode 100644 index 000000000..c7842af75 --- /dev/null +++ b/internal/examples/mod.go @@ -0,0 +1 @@ +package examples diff --git a/internal/mod.go b/internal/mod.go new file mode 100644 index 000000000..5bf0569ce --- /dev/null +++ b/internal/mod.go @@ -0,0 +1 @@ +package internal diff --git a/internal/utils/env.go b/internal/utils/env.go index 3f7b3f2bb..02f4565c7 100644 --- a/internal/utils/env.go +++ b/internal/utils/env.go @@ -293,11 +293,15 @@ func QT_GEN_OPENGL() bool { func GoList(args ...string) *exec.Cmd { cmd := exec.Command("go", "list") if UseGOMOD("") { - if !strings.Contains(strings.Join(args, "|"), "github.com/therecipe/env_"+runtime.GOOS+"_amd64") { + if /*strings.Contains(strings.Join(args, "|"), "github.com/therecipe/env_"+runtime.GOOS+"_amd64") ||*/ strings.Contains(strings.Join(args, "|"), "github.com/therecipe/qt/internal") { + //TODO: make env readonly if it can't be found inside ./vendor ... + cmd.Args = append(cmd.Args, "-mod=readonly") + } else { cmd.Args = append(cmd.Args, GOFLAGS()) } } cmd.Args = append(cmd.Args, "-e", "-f") cmd.Args = append(cmd.Args, args...) + cmd.Env = append(os.Environ(), []string{"CGO_ENABLED=0", "GOPROXY=disallow"}...) return cmd }