Skip to content

Commit 7630d0a

Browse files
authored
Merge branch 'arduino:main' into main
2 parents ed66479 + 24dc0bb commit 7630d0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4653
-1981
lines changed

Diff for: .github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929

3030
env:
3131
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
32-
GO_VERSION: "1.17"
32+
GO_VERSION: "1.19"
3333
JOB_TRANSFER_ARTIFACT: build-artifacts
3434
CHANGELOG_ARTIFACTS: changelog
3535

@@ -235,7 +235,7 @@ jobs:
235235
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
236236
237237
- name: Publish Release [GitHub]
238-
uses: svenstaro/upload-release-action@2.4.1
238+
uses: svenstaro/upload-release-action@2.5.0
239239
with:
240240
repo_token: ${{ secrets.GITHUB_TOKEN }}
241241
release_name: ${{ steps.tag_name.outputs.TAG_NAME }}

Diff for: .github/workflows/check-i18n-task.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check Internationalization
22

33
env:
44
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
5-
GO_VERSION: "1.17"
5+
GO_VERSION: "1.19"
66

77
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
88
on:

Diff for: .github/workflows/i18n-nightly-push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: i18n-nightly-push
22

33
env:
44
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
5-
GO_VERSION: "1.17"
5+
GO_VERSION: "1.19"
66

77
on:
88
schedule:

Diff for: .github/workflows/i18n-weekly-pull.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: i18n-weekly-pull
22

33
env:
44
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
5-
GO_VERSION: "1.17"
5+
GO_VERSION: "1.19"
66

77
on:
88
schedule:

Diff for: .github/workflows/themes-weekly-pull.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
11-
GO_VERSION: "1.17"
11+
GO_VERSION: "1.19"
1212
NODE_VERSION: 16.x
1313

1414
jobs:

Diff for: arduino-ide-extension/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arduino-ide-extension",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "An extension for Theia building the Arduino IDE",
55
"license": "AGPL-3.0-or-later",
66
"scripts": {
@@ -163,7 +163,7 @@
163163
],
164164
"arduino": {
165165
"cli": {
166-
"version": "0.29.0"
166+
"version": "0.31.0"
167167
},
168168
"fwuploader": {
169169
"version": "2.2.2"

Diff for: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import {
1010
MenuContribution,
1111
MenuModelRegistry,
1212
} from '@theia/core';
13-
import {
14-
FrontendApplication,
15-
FrontendApplicationContribution,
16-
} from '@theia/core/lib/browser';
13+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
1714
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
1815
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
1916
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution';
@@ -77,7 +74,7 @@ export class ArduinoFrontendContribution
7774
}
7875
}
7976

80-
onStart(app: FrontendApplication): void {
77+
onStart(): void {
8178
this.electronWindowPreferences.onPreferenceChanged((event) => {
8279
if (event.newValue !== event.oldValue) {
8380
switch (event.preferenceName) {
@@ -98,8 +95,6 @@ export class ArduinoFrontendContribution
9895
webContents.setZoomLevel(zoomLevel);
9996
})
10097
);
101-
// Removes the _Settings_ (cog) icon from the left sidebar
102-
app.shell.leftPanelHandler.removeBottomMenu('settings-menu');
10398
}
10499

105100
registerToolbarItems(registry: TabBarToolbarRegistry): void {

Diff for: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

+7
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ import { ConfigServiceClient } from './config/config-service-client';
349349
import { ValidateSketch } from './contributions/validate-sketch';
350350
import { RenameCloudSketch } from './contributions/rename-cloud-sketch';
351351
import { CreateFeatures } from './create/create-features';
352+
import { Account } from './contributions/account';
353+
import { SidebarBottomMenuWidget } from './theia/core/sidebar-bottom-menu-widget';
354+
import { SidebarBottomMenuWidget as TheiaSidebarBottomMenuWidget } from '@theia/core/lib/browser/shell/sidebar-bottom-menu-widget';
352355

353356
export default new ContainerModule((bind, unbind, isBound, rebind) => {
354357
// Commands and toolbar items
@@ -751,6 +754,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
751754
Contribution.configure(bind, NewCloudSketch);
752755
Contribution.configure(bind, ValidateSketch);
753756
Contribution.configure(bind, RenameCloudSketch);
757+
Contribution.configure(bind, Account);
754758

755759
bindContributionProvider(bind, StartupTaskProvider);
756760
bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window
@@ -1031,4 +1035,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
10311035
},
10321036
}))
10331037
.inSingletonScope();
1038+
1039+
bind(SidebarBottomMenuWidget).toSelf();
1040+
rebind(TheiaSidebarBottomMenuWidget).toService(SidebarBottomMenuWidget);
10341041
});

Diff for: arduino-ide-extension/src/browser/auth/authentication-client-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ export class AuthenticationClientService
8383
registerCommands(registry: CommandRegistry): void {
8484
registry.registerCommand(CloudUserCommands.LOGIN, {
8585
execute: () => this.service.login(),
86+
isEnabled: () => !this._session,
87+
isVisible: () => !this._session,
8688
});
8789
registry.registerCommand(CloudUserCommands.LOGOUT, {
8890
execute: () => this.service.logout(),
91+
isEnabled: () => !!this._session,
92+
isVisible: () => !!this._session,
8993
});
9094
}
9195

Diff for: arduino-ide-extension/src/browser/auth/cloud-user-commands.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { Command } from '@theia/core/lib/common/command';
22

3+
export const LEARN_MORE_URL =
4+
'https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-cloud-sketch-sync';
5+
36
export namespace CloudUserCommands {
47
export const LOGIN = Command.toLocalizedCommand(
58
{
@@ -16,9 +19,4 @@ export namespace CloudUserCommands {
1619
},
1720
'arduino/cloud/signOut'
1821
);
19-
20-
export const OPEN_PROFILE_CONTEXT_MENU: Command = {
21-
id: 'arduino-cloud-sketchbook--open-profile-menu',
22-
label: 'Contextual menu',
23-
};
2422
}

Diff for: arduino-ide-extension/src/browser/boards/boards-service-provider.ts

+56-19
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,9 @@ export class BoardsServiceProvider
158158
this.lastAvailablePortsOnUpload = undefined;
159159
}
160160

161-
private portToAutoSelectCanBeDerived(): boolean {
162-
return Boolean(
163-
this.lastBoardsConfigOnUpload && this.lastAvailablePortsOnUpload
164-
);
165-
}
166-
167161
attemptPostUploadAutoSelect(): void {
168162
setTimeout(() => {
169-
if (this.portToAutoSelectCanBeDerived()) {
163+
if (this.lastBoardsConfigOnUpload && this.lastAvailablePortsOnUpload) {
170164
this.attemptAutoSelect({
171165
ports: this._availablePorts,
172166
boards: this._availableBoards,
@@ -185,12 +179,12 @@ export class BoardsServiceProvider
185179
private deriveBoardConfigToAutoSelect(
186180
newState: AttachedBoardsChangeEvent['newState']
187181
): void {
188-
if (!this.portToAutoSelectCanBeDerived()) {
182+
if (!this.lastBoardsConfigOnUpload || !this.lastAvailablePortsOnUpload) {
189183
this.boardConfigToAutoSelect = undefined;
190184
return;
191185
}
192186

193-
const oldPorts = this.lastAvailablePortsOnUpload!;
187+
const oldPorts = this.lastAvailablePortsOnUpload;
194188
const { ports: newPorts, boards: newBoards } = newState;
195189

196190
const appearedPorts =
@@ -205,20 +199,39 @@ export class BoardsServiceProvider
205199
Port.sameAs(board.port, port)
206200
);
207201

208-
const lastBoardsConfigOnUpload = this.lastBoardsConfigOnUpload!;
202+
const lastBoardsConfigOnUpload = this.lastBoardsConfigOnUpload;
209203

210-
if (
211-
boardOnAppearedPort &&
212-
lastBoardsConfigOnUpload.selectedBoard &&
213-
Board.sameAs(
204+
if (boardOnAppearedPort && lastBoardsConfigOnUpload.selectedBoard) {
205+
const boardIsSameHardware = Board.hardwareIdEquals(
214206
boardOnAppearedPort,
215207
lastBoardsConfigOnUpload.selectedBoard
216-
)
217-
) {
208+
);
209+
210+
const boardIsSameFqbn = Board.sameAs(
211+
boardOnAppearedPort,
212+
lastBoardsConfigOnUpload.selectedBoard
213+
);
214+
215+
if (!boardIsSameHardware && !boardIsSameFqbn) continue;
216+
217+
let boardToAutoSelect = boardOnAppearedPort;
218+
if (boardIsSameHardware && !boardIsSameFqbn) {
219+
const { name, fqbn } = lastBoardsConfigOnUpload.selectedBoard;
220+
221+
boardToAutoSelect = {
222+
...boardToAutoSelect,
223+
name:
224+
boardToAutoSelect.name === Unknown || !boardToAutoSelect.name
225+
? name
226+
: boardToAutoSelect.name,
227+
fqbn: boardToAutoSelect.fqbn || fqbn,
228+
};
229+
}
230+
218231
this.clearBoardDiscoverySnapshot();
219232

220233
this.boardConfigToAutoSelect = {
221-
selectedBoard: boardOnAppearedPort,
234+
selectedBoard: boardToAutoSelect,
222235
selectedPort: port,
223236
};
224237
return;
@@ -326,8 +339,10 @@ export class BoardsServiceProvider
326339
// it is just a FQBN, so we need to find the `selected` board among the `AvailableBoards`
327340
const selectedAvailableBoard = AvailableBoard.is(selectedBoard)
328341
? selectedBoard
329-
: this._availableBoards.find((availableBoard) =>
330-
Board.sameAs(availableBoard, selectedBoard)
342+
: this._availableBoards.find(
343+
(availableBoard) =>
344+
Board.hardwareIdEquals(availableBoard, selectedBoard) ||
345+
Board.sameAs(availableBoard, selectedBoard)
331346
);
332347
if (
333348
selectedAvailableBoard &&
@@ -353,9 +368,28 @@ export class BoardsServiceProvider
353368

354369
protected tryReconnect(): boolean {
355370
if (this.latestValidBoardsConfig && !this.canUploadTo(this.boardsConfig)) {
371+
// ** Reconnect to a board unplugged from, and plugged back into the same port
356372
for (const board of this.availableBoards.filter(
357373
({ state }) => state !== AvailableBoard.State.incomplete
358374
)) {
375+
if (
376+
Board.hardwareIdEquals(
377+
this.latestValidBoardsConfig.selectedBoard,
378+
board
379+
)
380+
) {
381+
const { name, fqbn } = this.latestValidBoardsConfig.selectedBoard;
382+
this.boardsConfig = {
383+
selectedBoard: {
384+
name: board.name === Unknown || !board.name ? name : board.name,
385+
fqbn: board.fqbn || fqbn,
386+
port: board.port,
387+
},
388+
selectedPort: board.port,
389+
};
390+
return true;
391+
}
392+
359393
if (
360394
this.latestValidBoardsConfig.selectedBoard.fqbn === board.fqbn &&
361395
this.latestValidBoardsConfig.selectedBoard.name === board.name &&
@@ -365,12 +399,15 @@ export class BoardsServiceProvider
365399
return true;
366400
}
367401
}
402+
// **
368403

404+
// ** Reconnect to a board whose port changed due to an upload
369405
if (!this.boardConfigToAutoSelect) return false;
370406

371407
this.boardsConfig = this.boardConfigToAutoSelect;
372408
this.boardConfigToAutoSelect = undefined;
373409
return true;
410+
// **
374411
}
375412
return false;
376413
}

0 commit comments

Comments
 (0)