@@ -380,8 +380,8 @@ async function rescanProject (bitBakeProjectScanner: BitBakeProjectScanner): Pro
380380}
381381
382382// Exported for testing
383- export function addDevtoolDebugBuild ( command : string , scanResult : BitbakeScanResult , settings : BitbakeSettings ) : string {
384- if ( checkDevtoolDebugBuildAvailable ( scanResult ) && ! settings . disableDevtoolDebugBuild ) {
383+ export async function addDevtoolDebugBuild ( command : string , scanResult : BitbakeScanResult , settings : BitbakeSettings , bitbakeDriver : BitbakeDriver ) : Promise < string > {
384+ if ( await checkDevtoolDebugBuildAvailable ( scanResult , bitbakeDriver ) && ! settings . disableDevtoolDebugBuild ) {
385385 command += ' --debug-build'
386386 }
387387 return command
@@ -392,7 +392,7 @@ async function devtoolModifyCommand (bitbakeWorkspace: BitbakeWorkspace, bitBake
392392 if ( chosenRecipe !== undefined ) {
393393 logger . debug ( `Command: devtool-modify: ${ chosenRecipe } ` )
394394 let command = `devtool modify ${ chosenRecipe } `
395- command = addDevtoolDebugBuild ( command , bitBakeProjectScanner . scanResult , bitBakeProjectScanner . bitbakeDriver . bitbakeSettings )
395+ command = await addDevtoolDebugBuild ( command , bitBakeProjectScanner . scanResult , bitBakeProjectScanner . bitbakeDriver . bitbakeSettings , bitBakeProjectScanner . bitbakeDriver )
396396 const process = await runBitbakeTerminalCustomCommand ( bitBakeProjectScanner . bitbakeDriver , command , `Bitbake: Devtool Modify: ${ chosenRecipe } ` )
397397 process . onExit ( ( event ) => {
398398 if ( event . exitCode === 0 ) {
@@ -442,7 +442,7 @@ async function devtoolIdeSDKCommand (bitbakeWorkspace: BitbakeWorkspace, bitBake
442442 clientNotificationManager . showSDKConfigurationError ( )
443443 return
444444 }
445- if ( ! checkIdeSdkAvailable ( bitBakeProjectScanner . scanResult ) ) {
445+ if ( ! await checkIdeSdkAvailable ( bitBakeProjectScanner . scanResult , bitBakeProjectScanner . bitbakeDriver ) ) {
446446 clientNotificationManager . showSDKUnavailableError ( chosenRecipe )
447447 return
448448 }
@@ -453,14 +453,28 @@ async function devtoolIdeSDKCommand (bitbakeWorkspace: BitbakeWorkspace, bitBake
453453 }
454454}
455455
456- function checkIdeSdkAvailable ( scanResult : BitbakeScanResult ) : boolean {
457- // devtool ide-sdk appeared in Yocto version Scarthgap
458- return bitbakeVersionAbove ( scanResult , '2.8.0' )
456+ async function checkIdeSdkAvailable ( scanResult : BitbakeScanResult , bitbakeDriver : BitbakeDriver ) : Promise < boolean > {
457+ if ( ! bitbakeESDKMode ) {
458+ // devtool ide-sdk appeared in Yocto version Scarthgap
459+ return bitbakeVersionAbove ( scanResult , '2.8.0' )
460+ } else {
461+ const command = "devtool --help | grep 'ide-sdk'"
462+ const process = runBitbakeTerminalCustomCommand ( bitbakeDriver , command , 'Bitbake: Devtool ide-sdk: check' )
463+ const res = await finishProcessExecution ( process )
464+ return res . status === 0
465+ }
459466}
460467
461- function checkDevtoolDebugBuildAvailable ( scanResult : BitbakeScanResult ) : boolean {
462- // devtool debug-build appeared in Yocto version Walnascard
463- return bitbakeVersionAbove ( scanResult , '2.12.0' )
468+ async function checkDevtoolDebugBuildAvailable ( scanResult : BitbakeScanResult , bitbakeDriver : BitbakeDriver ) : Promise < boolean > {
469+ if ( ! bitbakeESDKMode ) {
470+ // devtool debug-build appeared in Yocto version Walnascard
471+ return bitbakeVersionAbove ( scanResult , '2.12.0' )
472+ } else {
473+ const command = "devtool modify --help | grep '\\-\\-debug-build'"
474+ const process = runBitbakeTerminalCustomCommand ( bitbakeDriver , command , 'Bitbake: Devtool debug-build: check' )
475+ const res = await finishProcessExecution ( process )
476+ return res . status === 0
477+ }
464478}
465479
466480function checkIdeSdkConfiguration ( bitbakeDriver : BitbakeDriver ) : boolean {
0 commit comments