Skip to content

Commit

Permalink
Fix: Use getBuildConfig instead of direct access to bitbakeSettings
Browse files Browse the repository at this point in the history
A lot of places in the code were using the global config when they
should be using the buildConfiguration specific one, if available.

ESDK mode not affected because it takes a flat config.
pathToBitbakeFolder not affected because it is in the general section.
  • Loading branch information
deribaucourt committed Sep 17, 2024
1 parent 748678f commit 69db471
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/driver/BitBakeProjectScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class BitBakeProjectScanner {
}
if (this.containerMountPoint === undefined && !hostToContainer) {
// Should only be called through scanAvailableLayers()
const hostWorkdir = this.bitbakeDriver?.bitbakeSettings.workingDirectory
const hostWorkdir = this.bitbakeDriver?.getBuildConfig('workingDirectory')
if (hostWorkdir === undefined) {
throw new Error('hostWorkdir is undefined')
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/driver/BitbakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class BitbakeDriver {
})
}

private getBuildConfig (property: keyof BitbakeBuildConfigSettings): any {
getBuildConfig (property: keyof BitbakeBuildConfigSettings): any {
return getBuildSetting(this.bitbakeSettings, this.activeBuildConfiguration, property)
}

Expand Down Expand Up @@ -129,7 +129,7 @@ export class BitbakeDriver {
return false
}

if ((this.bitbakeSettings.workingDirectory != null) && !fs.existsSync(this.bitbakeSettings.workingDirectory)) {
if ((this.getBuildConfig('workingDirectory') != null) && !fs.existsSync(this.getBuildConfig('workingDirectory'))) {
// If it is not defined, then we will use the workspace folder which is always valid
clientNotificationManager.showBitbakeSettingsError('Working directory does not exist.')
return false
Expand Down
4 changes: 2 additions & 2 deletions client/src/ui/BitbakeCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ async function checkIdeSdkAvailable (bitbakeDriver: BitbakeDriver): Promise<bool
}

function checkIdeSdkConfiguration (bitbakeDriver: BitbakeDriver): boolean {
const sdkImage = bitbakeDriver.bitbakeSettings.sdkImage
const sdkImage = bitbakeDriver.getBuildConfig('sdkImage')
return sdkImage !== undefined && sdkImage !== ''
}

Expand Down Expand Up @@ -620,7 +620,7 @@ async function devtoolDeployCommand (bitbakeWorkspace: BitbakeWorkspace, bitBake
const bitbakeDriver = bitBakeProjectScanner.bitbakeDriver
if (chosenRecipe !== undefined) {
logger.debug(`Command: devtool-deploy: ${chosenRecipe}`)
const sshTarget = bitbakeDriver.bitbakeSettings.sshTarget
const sshTarget = bitbakeDriver.getBuildConfig('sshTarget')
if (sshTarget === undefined || sshTarget === '') {
clientNotificationManager.showSDKConfigurationError()
return
Expand Down

0 comments on commit 69db471

Please sign in to comment.