1
- const { execSync, spawnSync } = require ( "child_process" ) ;
1
+ const { execSync} = require ( "child_process" ) ;
2
2
const path = require ( "path" ) ;
3
3
const process = require ( "process" ) ;
4
4
const fs = require ( "fs" ) ;
5
+
5
6
qx . Class . define ( "qxl.packagebrowser.compile.LibraryApi" , {
6
7
extend : qx . tool . cli . api . LibraryApi ,
7
8
@@ -61,7 +62,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
61
62
this . __deleteFolderRecursiveSync ( targetDir ) ;
62
63
}
63
64
fs . mkdirSync ( targetDir ) ;
64
- console . log ( `>>> Starting compilation of all compatible packages...` ) ;
65
+ console . log ( `>>> Installing all compatible packages...` ) ;
65
66
let stdout = execSync ( `qx pkg list --uris-only` ) ;
66
67
let packages =
67
68
stdout
@@ -75,6 +76,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
75
76
`qx create ${ containerPath } -I` ,
76
77
`Creating container application...`
77
78
) ;
79
+ console . log ( `>>> The following packages will be installed:\n - ${ packages . join ( "\n - " ) } ` ) ;
78
80
for ( let pkg of packages ) {
79
81
this . __addCmd ( `qx pkg install ${ pkg } ` , `Installing ${ pkg } ...` , containerPath ) ;
80
82
}
@@ -89,19 +91,40 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
89
91
continue ;
90
92
}
91
93
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.. .` ) ;
94
96
delete packages_data [ index ] ;
95
97
continue ;
96
98
}
97
99
let pkg_dir = path . join ( containerPath , install_data . path ) ;
98
100
let manifest ;
99
101
let compileData ;
102
+ const compileDataPath = path . join ( pkg_dir , "compile.json" ) ;
100
103
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 ) ;
103
122
} catch ( e ) {
104
123
console . warn ( e . message ) ;
124
+ packages_data [ index ] . data = {
125
+ problems : true ,
126
+ compilation_log : e . message
127
+ } ;
105
128
continue ;
106
129
}
107
130
// compile the application
@@ -112,7 +135,7 @@ qx.Class.define("qxl.packagebrowser.compile.LibraryApi", {
112
135
( stdout , stderr ) => {
113
136
let compilation_log = stdout + "\n\n" + stderr ;
114
137
packages_data [ index ] . data = {
115
- problems : Boolean ( compilation_log . match ( / ( e r r o r | w a r n | m i s s i n g | c a n n o t f i n d | u n r e s o l v e d | u n e x p e c t e d | d e p r e c a t e d ) / i) ) ,
138
+ problems : Boolean ( compilation_log . match ( / ( e r r o r | w a r n | m i s s i n g | f a i l e d | c a n n o t f i n d | u n r e s o l v e d | u n e x p e c t e d | d e p r e c a t e d ) / i) ) ,
116
139
compilation_log
117
140
} ;
118
141
let target = compileData . targets . find ( target => target . type === targetType ) || compileData . targets [ 0 ] ;
0 commit comments