make qtdeploy less verbose

This commit is contained in:
therecipe 2017-01-04 00:01:13 +01:00
parent c69117432a
commit acb48c8d7f
6 changed files with 31 additions and 15 deletions

View file

@ -233,13 +233,17 @@ func IsPrivateSignal(f *parser.Function) bool {
switch runtime.GOOS {
case "darwin":
{
if utils.UseHomeBrew() {
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))
} 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))
}
}
case "windows":
{
if utils.UseMsys2() {
fData = utils.Load(filepath.Join(utils.QT_MSYS2_DIR(), "include", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
fData = utils.LoadOptional(filepath.Join(utils.QT_MSYS2_DIR(), "include", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
} else {
fData = utils.Load(filepath.Join(utils.QT_DIR(), "5.7", "mingw53_32", "include", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
}
@ -248,7 +252,7 @@ func IsPrivateSignal(f *parser.Function) bool {
case "linux":
{
if utils.UsePkgConfig() {
fData = utils.Load(filepath.Join(strings.TrimSpace(utils.RunCmd(exec.Command("pkg-config", "--variable=includedir", "Qt5Core"), "convert.IsPrivateSignal_includeDir")), strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
fData = utils.LoadOptional(filepath.Join(strings.TrimSpace(utils.RunCmd(exec.Command("pkg-config", "--variable=includedir", "Qt5Core"), "convert.IsPrivateSignal_includeDir")), strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
} else {
fData = utils.Load(filepath.Join(utils.QT_DIR(), "5.7", "gcc_64", "include", strings.Title(parser.State.ClassMap[f.ClassName()].DocModule), fPath))
}
@ -257,7 +261,6 @@ func IsPrivateSignal(f *parser.Function) bool {
if fData != "" {
if strings.Contains(fData, fmt.Sprintf("%v(", f.Name)) {
return strings.Contains(strings.Split(strings.Split(fData, fmt.Sprintf("%v(", f.Name))[1], ")")[0], "QPrivateSignal")
}

View file

@ -33,7 +33,7 @@ func (c *Class) register(m string) {
State.ClassMap[c.Name] = c
for _, sc := range c.Classes {
if sc.Name != "PaintContext" { //TODO: remove
if sc.Name != "PaintContext" { //TODO: remove and support all sub classes
continue
}

View file

@ -191,7 +191,7 @@ func (c *Class) fixBases() {
case "QUiLoader", "QEGLNativeContext", "QWGLNativeContext", "QGLXNativeContext", "QEglFSFunctions", "QWindowsWindowFunctions", "QCocoaNativeContext", "QXcbWindowFunctions", "QCocoaWindowFunctions":
{
if utils.UsePkgConfig() {
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, c.Module, strings.ToLower(c.Name)+".h")), c.Name, c.Module)
c.Bases = getBasesFromHeader(utils.LoadOptional(filepath.Join(prefixPath, c.Module, strings.ToLower(c.Name)+".h")), c.Name, c.Module)
} else {
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, "include", c.Module, strings.ToLower(c.Name)+".h")), c.Name, c.Module)
}
@ -201,7 +201,7 @@ func (c *Class) fixBases() {
case "QPlatformSystemTrayIcon", "QPlatformGraphicsBuffer":
{
if utils.UsePkgConfig() {
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, c.Module, utils.QT_VERSION(), c.Module, "qpa", strings.ToLower(c.Name)+".h")), c.Name, c.Module)
c.Bases = getBasesFromHeader(utils.LoadOptional(filepath.Join(prefixPath, c.Module, utils.QT_VERSION(), c.Module, "qpa", strings.ToLower(c.Name)+".h")), c.Name, c.Module)
} else {
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, infixPath, c.Module+suffixPath+utils.QT_VERSION(), "QtGui", "qpa", strings.ToLower(c.Name)+".h")), c.Name, c.Module)
}
@ -214,7 +214,7 @@ func (c *Class) fixBases() {
m = fmt.Sprintf("Qt%v", m)
if utils.UsePkgConfig() {
if utils.ExistsFile(filepath.Join(prefixPath, m, strings.ToLower(c.Name)+".h")) {
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, m, strings.ToLower(c.Name)+".h")), c.Name, c.Module)
c.Bases = getBasesFromHeader(utils.LoadOptional(filepath.Join(prefixPath, m, strings.ToLower(c.Name)+".h")), c.Name, c.Module)
return
}
} else {
@ -241,10 +241,10 @@ func (c *Class) fixBases() {
if utils.UsePkgConfig() {
if utils.ExistsFile(filepath.Join(prefixPath, m, c.Name)) {
var f = utils.Load(filepath.Join(prefixPath, m, c.Name))
var f = utils.LoadOptional(filepath.Join(prefixPath, m, c.Name))
if f != "" {
found = true
c.Bases = getBasesFromHeader(utils.Load(filepath.Join(prefixPath, m, strings.Split(f, "\"")[1])), c.Name, m)
c.Bases = getBasesFromHeader(utils.LoadOptional(filepath.Join(prefixPath, m, strings.Split(f, "\"")[1])), c.Name, m)
}
break
}

View file

@ -45,12 +45,12 @@ func LoadModule(m string) error {
switch {
case utils.UseHomeBrew(), utils.UseMsys2():
{
err = xml.Unmarshal([]byte(utils.Load(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_VERSION(), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
err = xml.Unmarshal([]byte(utils.LoadOptional(filepath.Join(utils.MustGoPath(), "src", "github.com", "therecipe", "qt", "internal", "binding", "files", "docs", utils.QT_VERSION(), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
}
case utils.UsePkgConfig():
{
err = xml.Unmarshal([]byte(utils.Load(filepath.Join(utils.QT_DOC_DIR(), fmt.Sprintf("qt%v", strings.ToLower(m)), fmt.Sprintf("qt%v.index", strings.ToLower(m))))), &module)
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:
@ -59,7 +59,11 @@ func LoadModule(m string) error {
}
}
if err != nil {
if m != "datavisualization" && m != "charts" {
utils.Log.WithFields(logFields).WithError(err).Warn(logName)
} else {
utils.Log.WithFields(logFields).WithError(err).Debug(logName)
}
return err
}

View file

@ -303,11 +303,11 @@ func (m *appMoc) generate() error {
structsSize := len(m.module.Namespace.Classes)
if structsSize == 0 {
utils.Log.WithFields(fields).Warning("failed to find moc structs")
utils.Log.WithFields(fields).Debug("failed to find moc structs")
return nil
}
fields["structs"] = structsSize
utils.Log.WithFields(fields).Debug("Found moc structs")
utils.Log.WithFields(fields).Debug("found moc structs")
if err = cacheModules(); err != nil {
return err

View file

@ -61,6 +61,15 @@ func Load(name string) string {
return string(out)
}
//TODO: export error
func LoadOptional(name string) string {
var out, err = ioutil.ReadFile(name)
if err != nil {
Log.WithError(err).Debugf("failed to load (optional) %v", name)
}
return string(out)
}
func Abs(appPath string) (string, error) {
var path, err = filepath.Abs(appPath)
if err != nil {