File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -142,3 +142,4 @@ native/
142
142
vendor /ocaml
143
143
jscomp /.lsp
144
144
.vscode /launch.json
145
+ tracing * .json
Original file line number Diff line number Diff line change @@ -160,14 +160,14 @@ function category(target, obj) {
160
160
return obj ;
161
161
}
162
162
/**
163
- *
163
+ * @param { string } file
164
164
* @param {boolean } showAll
165
165
*/
166
- function readTargets ( showAll ) {
166
+ function readTargets ( file , showAll ) {
167
167
let lastEndSeen = 0 ;
168
168
let targets = new Map ( ) ;
169
169
processEntry (
170
- path . join ( "lib" , "bs" , ".ninja_log" ) ,
170
+ file ,
171
171
line => {
172
172
let lineTrim = line . trim ( ) ;
173
173
if ( lineTrim . startsWith ( "#" ) ) {
@@ -207,5 +207,37 @@ function readTargets(showAll) {
207
207
}
208
208
) ;
209
209
}
210
+ let logName = ".ninja_log" ;
210
211
211
- readTargets ( false ) ;
212
+ /**
213
+ * @type {string }
214
+ */
215
+ var file ;
216
+ /**
217
+ *
218
+ * @param ps {string[]}
219
+ */
220
+ function tryLocation ( ps ) {
221
+ for ( let p of ps ) {
222
+ let log = path . join ( p , logName ) ;
223
+ if ( fs . existsSync ( log ) ) {
224
+ file = log ;
225
+ return ;
226
+ }
227
+ }
228
+ console . error (
229
+ `no .ninja_log found in specified paths, make sure you set bstracing to the proper directory`
230
+ ) ;
231
+ process . exit ( 2 ) ;
232
+ }
233
+ {
234
+ let index = process . argv . indexOf ( `-C` ) ;
235
+ if ( index >= 0 ) {
236
+ let p = process . argv [ index + 1 ] ;
237
+ tryLocation ( [ p ] ) ;
238
+ } else {
239
+ tryLocation ( [ path . join ( "lib" , "bs" ) , "." ] ) ;
240
+ }
241
+ }
242
+ console . log ( "loading build log" , file , "is used" ) ;
243
+ readTargets ( file , false ) ;
You can’t perform that action at this time.
0 commit comments