File tree 3 files changed +16
-3
lines changed
arduino-ide-extension/src
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,16 @@ export const BoardsService = Symbol('BoardsService');
141
141
export interface BoardsService
142
142
extends Installable < BoardsPackage > ,
143
143
Searchable < BoardsPackage , BoardSearch > {
144
+ install ( options : {
145
+ item : BoardsPackage ;
146
+ progressId ?: string ;
147
+ version ?: Installable . Version ;
148
+ noOverwrite ?: boolean ;
149
+ /**
150
+ * Only for testing to avoid confirmation dialogs from Windows User Access Control when installing a platform.
151
+ */
152
+ skipPostInstall ?: boolean ;
153
+ } ) : Promise < void > ;
144
154
getState ( ) : Promise < AvailablePorts > ;
145
155
getBoardDetails ( options : { fqbn : string } ) : Promise < BoardDetails | undefined > ;
146
156
getBoardPackage ( options : { id : string } ) : Promise < BoardsPackage | undefined > ;
Original file line number Diff line number Diff line change @@ -434,6 +434,7 @@ export class BoardsServiceImpl
434
434
progressId ?: string ;
435
435
version ?: Installable . Version ;
436
436
noOverwrite ?: boolean ;
437
+ skipPostInstall ?: boolean ;
437
438
} ) : Promise < void > {
438
439
const item = options . item ;
439
440
const version = ! ! options . version
@@ -450,6 +451,9 @@ export class BoardsServiceImpl
450
451
req . setPlatformPackage ( platform ) ;
451
452
req . setVersion ( version ) ;
452
453
req . setNoOverwrite ( Boolean ( options . noOverwrite ) ) ;
454
+ if ( options . skipPostInstall ) {
455
+ req . setSkipPostInstall ( true ) ;
456
+ }
453
457
454
458
console . info ( '>>> Starting boards package installation...' , item ) ;
455
459
Original file line number Diff line number Diff line change @@ -140,16 +140,15 @@ async function start(
140
140
configService . onStart ( ) ;
141
141
daemon . onStart ( ) ;
142
142
await waitForEvent ( daemon . onDaemonStarted , 10_000 ) ;
143
- const boardService = container . get < BoardsServiceImpl > ( BoardsServiceImpl ) ;
143
+ const boardService = container . get < BoardsService > ( BoardsService ) ;
144
144
const searchResults = await boardService . search ( { query : avr } ) ;
145
145
const platform = searchResults . find ( ( { id } ) => id === avr ) ;
146
146
if ( ! platform ) {
147
147
throw new Error ( `Could not find platform: ${ avr } ` ) ;
148
148
}
149
- await boardService . install ( { item : platform } ) ;
149
+ await boardService . install ( { item : platform , skipPostInstall : true } ) ;
150
150
}
151
151
152
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
153
152
function createContainer ( ) : Container {
154
153
const container = new Container ( { defaultScope : 'Singleton' } ) ;
155
154
const module = new ContainerModule ( ( bind ) => {
You can’t perform that action at this time.
0 commit comments