I am trying to subclass Probe to clone custom repositories from the net before starting the build.
GitProbe:
import qbs
import qbs.File
import qbs.Process
Probe {
property string gitUrl
property string wd
property string name
property string dir: wd + "/" + name
configure: {
try {
if(File.directoryEntries(dir, File.AllEntries).length > 0){
File.remove(dir)
}
var gitProcess = Process()
gitProcess.setWorkingDirectory(wd)
gitProcess.exec("git", ["clone", gitUrl], true)
found = true
} catch(err) {
console.warn("GitProbe : could not clone repository " + gitUrl)
console.error("GitProbe : " + err)
found = false
}
}
}
I did put the GitProbe.qbs
in dir/imports/
, and in my project I did qbsSearchPath: "path-to-dir"
, but qbs tell me when parsing the file Unexpected item type 'GitProbe'
.
This is a known limitation: The search path needs to be set already when the current file is parsed. So the workaround is to reference your file from a Project item in another file and set the search path there. You might want to vote on https://bugreports.qt.io/browse/QBS-667.