@@ -257,11 +257,16 @@ export class CodeQLCliServer implements Disposable {
257
257
*/
258
258
private async launchProcess ( ) : Promise < child_process . ChildProcessWithoutNullStreams > {
259
259
const codeQlPath = await this . getCodeQlPath ( ) ;
260
+ const args = [ ] ;
261
+ if ( shouldDebugCliServer ( ) ) {
262
+ args . push ( '-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9012,server=n,suspend=y,quiet=y' ) ;
263
+ }
264
+
260
265
return await spawnServer (
261
266
codeQlPath ,
262
267
'CodeQL CLI Server' ,
263
268
[ 'execute' , 'cli-server' ] ,
264
- [ ] ,
269
+ args ,
265
270
this . logger ,
266
271
_data => { /**/ }
267
272
) ;
@@ -605,7 +610,7 @@ export class CodeQLCliServer implements Disposable {
605
610
if ( target ) subcommandArgs . push ( '--target' , target ) ;
606
611
if ( name ) subcommandArgs . push ( '--name' , name ) ;
607
612
subcommandArgs . push ( archivePath ) ;
608
-
613
+
609
614
return await this . runCodeQlCliCommand ( [ 'database' , 'unbundle' ] , subcommandArgs , `Extracting ${ archivePath } to directory ${ target } ` ) ;
610
615
}
611
616
@@ -1049,6 +1054,12 @@ export function shouldDebugQueryServer() {
1049
1054
&& process . env . QUERY_SERVER_JAVA_DEBUG ?. toLocaleLowerCase ( ) !== 'false' ;
1050
1055
}
1051
1056
1057
+ export function shouldDebugCliServer ( ) {
1058
+ return 'CLI_SERVER_JAVA_DEBUG' in process . env
1059
+ && process . env . CLI_SERVER_JAVA_DEBUG !== '0'
1060
+ && process . env . CLI_SERVER_JAVA_DEBUG ?. toLocaleLowerCase ( ) !== 'false' ;
1061
+ }
1062
+
1052
1063
export class CliVersionConstraint {
1053
1064
1054
1065
/**
@@ -1088,6 +1099,16 @@ export class CliVersionConstraint {
1088
1099
*/
1089
1100
public static CLI_VERSION_WITH_DATABASE_UNBUNDLE = new SemVer ( '2.6.0' ) ;
1090
1101
1102
+ /**
1103
+ * CLI version where the `--no-precompile` option for pack creation was introduced.
1104
+ */
1105
+ public static CLI_VERSION_WITH_NO_PRECOMPILE = new SemVer ( '2.7.0' ) ;
1106
+
1107
+ /**
1108
+ * CLI version where `pack packlist` layout changed from array to object
1109
+ */
1110
+ public static CLI_VERSION_PACK_PACKLIST_LAYOUT_CHANGE = new SemVer ( '2.7.0' ) ;
1111
+
1091
1112
constructor ( private readonly cli : CodeQLCliServer ) {
1092
1113
/**/
1093
1114
}
@@ -1124,4 +1145,11 @@ export class CliVersionConstraint {
1124
1145
return this . isVersionAtLeast ( CliVersionConstraint . CLI_VERSION_WITH_DATABASE_UNBUNDLE ) ;
1125
1146
}
1126
1147
1148
+ async supportsNoPrecompile ( ) {
1149
+ return this . isVersionAtLeast ( CliVersionConstraint . CLI_VERSION_WITH_NO_PRECOMPILE ) ;
1150
+ }
1151
+
1152
+ async usesNewPackPacklistLayout ( ) {
1153
+ return this . isVersionAtLeast ( CliVersionConstraint . CLI_VERSION_PACK_PACKLIST_LAYOUT_CHANGE ) ;
1154
+ }
1127
1155
}
0 commit comments