1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
import qbs.File
import qbs.FileInfo
import qbs.Probes
Project {
references: ["man/man.qbs"]
Product {
name: "qbs documentation"
builtByDefault: false
type: Qt.core.config.contains("cross_compile") ?
["qbsdoc.qdoc-html-fixed"] : [ "qbsdoc.qdoc-html-fixed", "qch"]
property string fixedHtmlDir: FileInfo.joinPaths(buildDirectory, "qdoc-html-fixed")
Depends { name: "Qt.core" }
Depends { name: "qbsbuildconfig" }
Depends { name: "qbsversion" }
Probes.BinaryProbe {
id: pythonProbe
names: ["python3", "python"] // on Windows, there's no python3
}
property string pythonPath: pythonProbe.found ? pythonProbe.filePath : undefined
files: [
"../README.md",
"../CONTRIBUTING.md",
"classic.css",
"external-resources.qdoc",
"fixnavi.pl",
"howtos.qdoc",
"qbs.qdoc",
"tutorial.qdoc",
"qbs-online.qdocconf",
"config/*.qdocconf",
"config/style/qt5-sidebar.html",
"appendix/**/*",
"reference/**/*",
"templates/**/*",
"images/**",
"targets/**",
]
Group {
name: "main qdocconf file"
files: "qbs.qdocconf"
fileTags: "qdocconf-main"
}
Group {
name: "fix-imports script"
files: ["fix-qmlimports.py"]
fileTags: ["qbsdoc.fiximports"]
}
property string versionTag: qbsversion.version.replace(/\.|-/g, "")
Qt.core.qdocEnvironment: [
"QBS_VERSION=" + qbsversion.version,
"SRCDIR=" + path,
"QT_INSTALL_DOCS=" + Qt.core.docPath,
"QBS_VERSION_TAG=" + versionTag
]
Rule {
inputs: ["qdoc-png"]
explicitlyDependsOn: ["qbsdoc.fiximports"]
multiplex: true
outputFileTags: ["qdoc-html", "qbsdoc.dummy"] // TODO: Hack. Rule injection to the rescue?
outputArtifacts: [{filePath: "dummy", fileTags: ["qbsdoc.dummy"]}]
prepare: {
if (!product.pythonPath)
throw "Python executable was not found";
var scriptPath = explicitlyDependsOn["qbsdoc.fiximports"][0].filePath;
var htmlDir = FileInfo.path(FileInfo.path(inputs["qdoc-png"][0].filePath));
var fixCmd = new Command(product.pythonPath, [scriptPath, htmlDir]);
fixCmd.description = "fixing bogus QML import statements";
return [fixCmd];
}
}
Rule {
inputs: ["qdoc-html"]
Artifact {
filePath: FileInfo.joinPaths(product.fixedHtmlDir, input.fileName)
fileTags: ["qbsdoc.qdoc-html-fixed"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }
return [cmd];
}
}
Group {
fileTagsFilter: ["qbsdoc.qdoc-html-fixed"]
qbs.install: qbsbuildconfig.installHtml
qbs.installDir: qbsbuildconfig.docInstallDir
qbs.installSourceBase: product.fixedHtmlDir
}
Group {
fileTagsFilter: ["qdoc-css", "qdoc-png"]
qbs.install: qbsbuildconfig.installHtml
qbs.installDir: qbsbuildconfig.docInstallDir
qbs.installSourceBase: Qt.core.qdocOutputDir
}
Group {
fileTagsFilter: ["qch"]
qbs.install: qbsbuildconfig.installQch
qbs.installDir: qbsbuildconfig.docInstallDir
}
}
}
|