Skip to content

Commit 5d6abbb

Browse files
committed
Improves schema error reporting.
1 parent 1ca67c9 commit 5d6abbb

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

compile.js

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
const {execSync, spawnSync} = require("child_process");
1+
const {execSync} = require("child_process");
22
const path = require("path");
33
const process = require("process");
44
const fs = require("fs");
5+
56
qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
67
extend: qx.tool.cli.api.LibraryApi,
78

@@ -61,7 +62,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
6162
this.__deleteFolderRecursiveSync(targetDir);
6263
}
6364
fs.mkdirSync(targetDir);
64-
console.log(`>>> Starting compilation of all compatible packages...`);
65+
console.log(`>>> Installing all compatible packages...`);
6566
let stdout = execSync(`qx pkg list --uris-only`);
6667
let packages =
6768
stdout
@@ -75,6 +76,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
7576
`qx create ${containerPath} -I`,
7677
`Creating container application...`
7778
);
79+
console.log(`>>> The following packages will be installed:\n - ${packages.join("\n - ")}`);
7880
for (let pkg of packages) {
7981
this.__addCmd(`qx pkg install ${pkg}`, `Installing ${pkg}...`, containerPath);
8082
}
@@ -89,19 +91,40 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
8991
continue;
9092
}
9193
let install_data = lockfile_data.libraries.find(d => d.uri === pkg_data.uri);
92-
if (! install_data) {
93-
console.log(`${pkg_data.uri} is not installed (maybe internal or incompatible).`);
94+
if (!install_data) {
95+
console.log(`>>> ${pkg_data.name} (${pkg_data.uri}) has not been installed, skipping...`);
9496
delete packages_data[index];
9597
continue;
9698
}
9799
let pkg_dir = path.join(containerPath, install_data.path);
98100
let manifest;
99101
let compileData;
102+
const compileDataPath = path.join(pkg_dir, "compile.json");
100103
try {
101-
manifest = await this.__loadJson(path.join(pkg_dir, "Manifest.json"));
102-
compileData = await this.__loadJson(path.join(pkg_dir, "compile.json"));
104+
const manifestInstance = new qx.tool.config.Manifest();
105+
manifestInstance.set({
106+
baseDir: pkg_dir,
107+
validate: false
108+
});
109+
await manifestInstance.load();
110+
manifest = manifestInstance.getData();
111+
if (!fs.existsSync(compileDataPath)) {
112+
console.log(`>>> ${manifest.info.name} does not contain a compilable application.`);
113+
// reload & check manifest
114+
manifestInstance.set({
115+
loaded: false,
116+
validate: true
117+
});
118+
await manifestInstance.load();
119+
continue;
120+
}
121+
compileData = await this.__loadJson(compileDataPath);
103122
} catch (e) {
104123
console.warn(e.message);
124+
packages_data[index].data = {
125+
problems: true,
126+
compilation_log: e.message
127+
};
105128
continue;
106129
}
107130
// compile the application
@@ -112,7 +135,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
112135
(stdout, stderr) => {
113136
let compilation_log = stdout + "\n\n" +stderr;
114137
packages_data[index].data = {
115-
problems: Boolean(compilation_log.match(/(error|warn|missing|cannot find|unresolved|unexpected|deprecated)/i)),
138+
problems: Boolean(compilation_log.match(/(error|warn|missing|failed|cannot find|unresolved|unexpected|deprecated)/i)),
116139
compilation_log
117140
};
118141
let target = compileData.targets.find(target => target.type === targetType) || compileData.targets[0];

source/class/qxl/packagebrowser/PackageBrowser.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@
2020
2121
************************************************************************ */
2222

23-
/* ************************************************************************
24-
25-
26-
************************************************************************ */
2723

2824
/**
29-
* The GUI definition of the qooxdoo unit test runner.
25+
* The GUI + business logic of the package browser.
3026
*
3127
* @asset(qx/icon/Tango/16/actions/edit-find.png)
3228
* @asset(qx/icon/Tango/16/actions/edit-delete.png)

0 commit comments

Comments
 (0)