Skip to content

Check for IDE update at startup #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 59 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3733448
Remove check for updates on startup setting
silvanocerza Dec 6, 2021
05978ab
Remove useless exported function
silvanocerza Dec 6, 2021
6a55d85
Update template-package.json used to package IDE
silvanocerza Dec 14, 2021
9a16bd3
Add function to get channel file during packaging step
silvanocerza Dec 14, 2021
2061f52
Add updates check
silvanocerza Dec 15, 2021
44d31ab
move ide updater on backend
Dec 16, 2021
db373c8
configure updater options
Dec 21, 2021
343925c
add auto update preferences
fstasi Dec 21, 2021
fcb8f6e
TMP check updates on start and download
Dec 21, 2021
68e2a5c
index on check-update-startup: fcb8f6e TMP check updates on start and…
Jan 12, 2022
487fc94
check updates on start and download
Jan 12, 2022
395a8bc
set version to skip on local storage
Jan 26, 2022
6a0bd09
add IDE setting to toggle update check on start-up
Jan 27, 2022
3d5d5f7
comment out check for updates on startup and auto update settings
Jan 31, 2022
bbeeb08
Update Theia to 1.22.1
msujew Jan 31, 2022
593d15f
updated CI
fstasi Jan 31, 2022
b8b8109
Merge branch 'main' of github.com:arduino/arduino-ide into check-upda…
Feb 1, 2022
08cdd5e
download changelog and show it in IDE updater dialog
Feb 2, 2022
8e8b934
remove useless file
Feb 2, 2022
7e73746
remove useless code
Feb 2, 2022
1fcdd6f
add i18n to updater dialog
Feb 2, 2022
6f8c4f3
fix i18n
Feb 2, 2022
6c9cd36
refactor UpdateInfo typing
Feb 2, 2022
f852ea6
add macos zip to artifacts
Feb 3, 2022
3118b4c
Simply use `--ignore-engines`
msujew Feb 3, 2022
18d6823
Use correct --ignore-engines
msujew Feb 3, 2022
094c71a
Fix semver#valid call
msujew Feb 3, 2022
72bbed7
Use C++17
msujew Feb 3, 2022
448a676
updated documentation
fstasi Feb 3, 2022
e814430
add update channel preference
Feb 4, 2022
03f092e
Merge branch 'main' of github.com:arduino/arduino-ide into check-upda…
Feb 4, 2022
ed83a1d
update updater url
Feb 7, 2022
d6acaea
Merge branch 'msujew/theia-update-1.22' of github.com:arduino/arduino…
Feb 7, 2022
4a4fbe6
updated documentation
fstasi Feb 3, 2022
fe91f6b
Fix the C++ version
msujew Feb 7, 2022
da0d1ab
Build flag for cpp
msujew Feb 7, 2022
e9d311b
add disclaimer with correct node version
fstasi Feb 7, 2022
5104b36
Merge branch 'msujew/theia-update-1.22' of github.com:arduino/arduino…
Feb 8, 2022
dc0b644
Update `electron-builder`
msujew Feb 8, 2022
c2e6e30
Fix `Electron.Menu` issue
msujew Feb 8, 2022
70d3748
Skip electron rebuild
msujew Feb 8, 2022
ffa7fdf
Merge branch 'msujew/theia-update-1.22' of github.com:arduino/arduino…
Feb 9, 2022
4775259
Rebuild native dependencies beforehand
msujew Feb 9, 2022
0389be0
Merge branch 'msujew/theia-update-1.22' of github.com:arduino/arduino…
Feb 10, 2022
97d15f7
Merge remote-tracking branch 'origin/main' into msujew/theia-update-1.22
fstasi Feb 11, 2022
505dd20
Use resolutions section
msujew Feb 11, 2022
2d89761
Update template-package.json as well
msujew Feb 11, 2022
2e5fd95
Merge branch 'msujew/theia-update-1.22' of github.com:arduino/arduino…
Feb 11, 2022
476f8dc
Merge branch 'main' of github.com:arduino/arduino-ide into check-upda…
Feb 11, 2022
24ff6ca
move ide-updater to electron application
Feb 14, 2022
ec97b12
refactor ide-updater service
Feb 14, 2022
5757c89
Merge branch 'main' of github.com:arduino/arduino-ide into check-upda…
Feb 14, 2022
14804e8
update yarn.lock
Feb 15, 2022
a0bd8a8
update i18n
Feb 15, 2022
1650aa4
Revert "Add gRPC user agent (#834)"
Feb 15, 2022
1a5da63
fix ide download url
Feb 15, 2022
fe14ddc
update latest file in CI
Feb 15, 2022
5c185bf
Merge branch 'main' of github.com:arduino/arduino-ide into check-upda…
Feb 15, 2022
c2a2fae
fix i18n check
Feb 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ jobs:
if [ $IS_FORK = true ]; then
echo "Skipping the app signing: building from a fork."
else
export BUILD_SUFFIX="linux";
if [ "${{ runner.OS }}" = "macOS" ]; then
export BUILD_SUFFIX="mac";
export CSC_LINK="${{ runner.temp }}/signing_certificate.p12"
# APPLE_SIGNING_CERTIFICATE_P12 secret was produced by following the procedure from:
# https://www.kencochrane.com/2020/08/01/build-and-sign-golang-binaries-for-macos-with-github-actions/#exporting-the-developer-certificate
Expand All @@ -69,6 +71,7 @@ jobs:
export CSC_KEY_PASSWORD="${{ secrets.KEYCHAIN_PASSWORD }}"

elif [ "${{ runner.OS }}" = "Windows" ]; then
export BUILD_SUFFIX="";
export CSC_LINK="${{ runner.temp }}/signing_certificate.pfx"
npm config set msvs_version 2017 --global
echo "${{ secrets.WINDOWS_SIGNING_CERTIFICATE_PFX }}" | base64 --decode > "$CSC_LINK"
Expand All @@ -78,7 +81,15 @@ jobs:
fi

yarn --cwd ./electron/packager/
yarn --cwd ./electron/packager/ package
yarn --cwd ./electron/packager/ package

export BUILD_PREFIX="stable"
if [ "$IS_NIGHTLY" = true ]; then
export BUILD_PREFIX="nightly"
fi

mv electron/build/dist/latest-$BUILD_SUFFIX.yml electron/build/dist/$BUILD_PREFIX-$BUILD_SUFFIX.yml
rm electron/build/dist/alpha* electron/build/dist/beta*

- name: Upload [GitHub Actions]
uses: actions/upload-artifact@v2
Expand All @@ -98,7 +109,9 @@ jobs:
- path: '*Linux_64bit.zip'
name: Linux_X86-64
- path: '*macOS_64bit.dmg'
name: macOS
name: macOS_dmg
- path: '*macOS_64bit.zip'
name: macOS_zip
- path: '*Windows_64bit.exe'
name: Windows_X86-64_interactive_installer
- path: '*Windows_64bit.msi'
Expand Down
2 changes: 2 additions & 0 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"css-element-queries": "^1.2.0",
"dateformat": "^3.0.3",
"deepmerge": "2.0.1",
"electron-updater": "^4.6.5",
"fuzzy": "^0.1.3",
"glob": "^7.1.6",
"google-protobuf": "^3.11.4",
Expand All @@ -82,6 +83,7 @@
"ps-tree": "^1.2.0",
"query-string": "^7.0.1",
"react-disable": "^0.1.0",
"react-markdown": "^8.0.0",
"react-select": "^3.0.4",
"react-tabs": "^3.1.2",
"react-window": "^1.8.6",
Expand Down
67 changes: 39 additions & 28 deletions arduino-ide-extension/scripts/compose-changelog.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,61 @@
// @ts-check


(async () => {
const { Octokit } = require('@octokit/rest');
const fs = require("fs");
const path = require("path");
const fs = require('fs');
const path = require('path');

const octokit = new Octokit({
userAgent: 'Arduino IDE compose-changelog.js',
});

const response = await octokit.rest.repos.listReleases({
owner: 'arduino',
repo: 'arduino-ide',
}).catch(err => {
console.error(err);
process.exit(1);
})
const response = await octokit.rest.repos
.listReleases({
owner: 'arduino',
repo: 'arduino-ide',
})
.catch((err) => {
console.error(err);
process.exit(1);
});

const releases = response.data;

let fullChangelog = releases.reduce((acc, item) => {
let fullChangelog = releases.reduce((acc, item, index) => {
// Process each line separately
const body = item.body.split('\n').map(processLine).join('\n')
const body = item.body.split('\n').map(processLine).join('\n');
// item.name is the name of the release changelog
return acc + `# ${item.name}\n\n${body}\n\n---\n\n`;
return (
acc +
`## ${item.name}\n\n${body}${
index !== releases.length - 1 ? '\n\n---\n\n' : '\n'
}`
);
}, '');

const args = process.argv.slice(2)
const args = process.argv.slice(2);
if (args.length == 0) {
console.error("Missing argument to destination file")
process.exit(1)
console.error('Missing argument to destination file');
process.exit(1);
}
const changelogFile = path.resolve(args[0]);

await fs.writeFile(
changelogFile,
fullChangelog,
{
flag: "w+",
flag: 'w+',
},
err => {
(err) => {
if (err) {
console.error(err);
process.exit(1);
}
console.log("Changelog written to", changelogFile);
console.log('Changelog written to', changelogFile);
}
)
);
})();


// processLine applies different substitutions to line string.
// We're assuming that there are no more than one substitution
// per line to be applied.
Expand All @@ -61,7 +66,8 @@ const processLine = (line) => {
// * [#123](https://github.com/arduino/arduino-ide/pull/123/)
// * [#123](https://github.com/arduino/arduino-ide/issues/123/)
// If it does return the line as is.
let r = /(\(|\[)#\d+(\)|\])(\(|\[)https:\/\/github\.com\/arduino\/arduino-ide\/(pull|issues)\/(\d+)\/?(\)|\])/gm;
let r =
/(\(|\[)#\d+(\)|\])(\(|\[)https:\/\/github\.com\/arduino\/arduino-ide\/(pull|issues)\/(\d+)\/?(\)|\])/gm;
if (r.test(line)) {
return line;
}
Expand All @@ -70,9 +76,12 @@ const processLine = (line) => {
// * #123
// If it does it's changed to:
// * [#123](https://github.com/arduino/arduino-ide/pull/123)
r = /#(\d+)/gm;
r = /(?<![\w\d\/_]{1})#((\d)+)(?![\w\d\/_]{1})/gm;
if (r.test(line)) {
return line.replace(r, `[#$1](https://github.com/arduino/arduino-ide/pull/$1)`)
return line.replace(
r,
`[#$1](https://github.com/arduino/arduino-ide/pull/$1)`
);
}

// Check if a link with one of the following format exists:
Expand All @@ -85,7 +94,8 @@ const processLine = (line) => {
// * [#123](https://github.com/arduino/arduino-ide/issues/123)
// * [#123](https://github.com/arduino/arduino-ide/pull/123/)
// * [#123](https://github.com/arduino/arduino-ide/issues/123/)
r = /(https:\/\/github\.com\/arduino\/arduino-ide\/(pull|issues)\/(\d+)\/?)/gm;
r =
/(https:\/\/github\.com\/arduino\/arduino-ide\/(pull|issues)\/(\d+)\/?)/gm;
if (r.test(line)) {
return line.replace(r, `[#$3]($1)`);
}
Expand All @@ -95,11 +105,12 @@ const processLine = (line) => {
// * https://github.com/arduino/arduino-ide/compare/2.0.0-rc2...2.0.0-rc3/
// If it does it's changed to:
// * [`2.0.0-rc2...2.0.0-rc3`](https://github.com/arduino/arduino-ide/compare/2.0.0-rc2...2.0.0-rc3)
r = /(https:\/\/github\.com\/arduino\/arduino-ide\/compare\/([^\/]*))\/?\s?/gm;
r =
/(https:\/\/github\.com\/arduino\/arduino-ide\/compare\/([^\/]*))\/?\s?/gm;
if (r.test(line)) {
return line.replace(r, '[`$2`]($1)');;
return line.replace(r, '[`$2`]($1)');
}

// If nothing matches just return the line as is
return line;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ import { ArduinoPreferences } from './arduino-preferences';
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl';
import { SaveAsSketch } from './contributions/save-as-sketch';
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
import { IDEUpdaterCommands } from './ide-updater/ide-updater-commands';
import { IDEUpdaterDialog } from './dialogs/ide-updater/ide-updater-dialog';
import { IDEUpdater } from '../common/protocol/ide-updater';

const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages';
export const SKIP_IDE_VERSION = 'skipIDEVersion';

@injectable()
export class ArduinoFrontendContribution
Expand All @@ -78,8 +82,7 @@ export class ArduinoFrontendContribution
TabBarToolbarContribution,
CommandContribution,
MenuContribution,
ColorContribution
{
ColorContribution {
@inject(ILogger)
protected logger: ILogger;

Expand Down Expand Up @@ -157,6 +160,15 @@ export class ArduinoFrontendContribution
@inject(LocalStorageService)
protected readonly localStorageService: LocalStorageService;

@inject(IDEUpdaterCommands)
protected readonly updater: IDEUpdaterCommands;

@inject(IDEUpdaterDialog)
protected readonly updaterDialog: IDEUpdaterDialog;

@inject(IDEUpdater)
protected readonly updaterService: IDEUpdater;

protected invalidConfigPopup:
| Promise<void | 'No' | 'Yes' | undefined>
| undefined;
Expand Down Expand Up @@ -251,7 +263,7 @@ export class ArduinoFrontendContribution
});
}

onStart(app: FrontendApplication): void {
async onStart(app: FrontendApplication): Promise<void> {
// Initialize all `pro-mode` widgets. This is a NOOP if in normal mode.
for (const viewContribution of [
this.fileNavigatorContributions,
Expand All @@ -266,6 +278,19 @@ export class ArduinoFrontendContribution
viewContribution.initializeLayout(app);
}
}

this.updaterService.init(
this.arduinoPreferences.get('arduino.ide.updateChannel')
);
this.updater.checkForUpdates().then(async (updateInfo) => {
if (!updateInfo) return;
const versionToSkip = await this.localStorageService.getData<string>(
SKIP_IDE_VERSION
);
if (versionToSkip === updateInfo.version) return;
this.updaterDialog.open(updateInfo);
});

const start = async ({ selectedBoard }: BoardsConfig.Config) => {
if (selectedBoard) {
const { name, fqbn } = selectedBoard;
Expand Down
62 changes: 50 additions & 12 deletions arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ import {
UserFieldsDialogWidget,
} from './dialogs/user-fields/user-fields-dialog';
import { nls } from '@theia/core/lib/common';
import { IDEUpdaterCommands } from './ide-updater/ide-updater-commands';
import {
IDEUpdater,
IDEUpdaterClient,
IDEUpdaterPath,
} from '../common/protocol/ide-updater';
import { IDEUpdaterClientImpl } from './ide-updater/ide-updater-client-impl';
import {
IDEUpdaterDialog,
IDEUpdaterDialogProps,
IDEUpdaterDialogWidget,
} from './dialogs/ide-updater/ide-updater-dialog';
import { ElectronIpcConnectionProvider } from '@theia/core/lib/electron-browser/messaging/electron-ipc-connection-provider';

const ElementQueries = require('css-element-queries/src/ElementQueries');

Expand Down Expand Up @@ -407,8 +420,9 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(SerialService)
.toDynamicValue((context) => {
const connection = context.container.get(WebSocketConnectionProvider);
const client =
context.container.get<SerialServiceClient>(SerialServiceClient);
const client = context.container.get<SerialServiceClient>(
SerialServiceClient
);
return connection.createProxy(SerialServicePath, client);
})
.inSingletonScope();
Expand Down Expand Up @@ -472,12 +486,11 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
.inSingletonScope();
rebind(TheiaEditorWidgetFactory).to(EditorWidgetFactory).inSingletonScope();
rebind(TabBarToolbarFactory).toFactory(
({ container: parentContainer }) =>
() => {
const container = parentContainer.createChild();
container.bind(TabBarToolbar).toSelf().inSingletonScope();
return container.get(TabBarToolbar);
}
({ container: parentContainer }) => () => {
const container = parentContainer.createChild();
container.bind(TabBarToolbar).toSelf().inSingletonScope();
return container.get(TabBarToolbar);
}
);
bind(OutputWidget).toSelf().inSingletonScope();
rebind(TheiaOutputWidget).toService(OutputWidget);
Expand Down Expand Up @@ -642,13 +655,15 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {

// Enable the dirty indicator on uncloseable widgets.
rebind(TabBarRendererFactory).toFactory((context) => () => {
const contextMenuRenderer =
context.container.get<ContextMenuRenderer>(ContextMenuRenderer);
const contextMenuRenderer = context.container.get<ContextMenuRenderer>(
ContextMenuRenderer
);
const decoratorService = context.container.get<TabBarDecoratorService>(
TabBarDecoratorService
);
const iconThemeService =
context.container.get<IconThemeService>(IconThemeService);
const iconThemeService = context.container.get<IconThemeService>(
IconThemeService
);
return new TabBarRenderer(
contextMenuRenderer,
decoratorService,
Expand Down Expand Up @@ -756,9 +771,32 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
title: 'UploadCertificate',
});

bind(IDEUpdaterDialogWidget).toSelf().inSingletonScope();
bind(IDEUpdaterDialog).toSelf().inSingletonScope();
bind(IDEUpdaterDialogProps).toConstantValue({
title: 'IDEUpdater',
});

bind(UserFieldsDialogWidget).toSelf().inSingletonScope();
bind(UserFieldsDialog).toSelf().inSingletonScope();
bind(UserFieldsDialogProps).toConstantValue({
title: 'UserFields',
});

bind(IDEUpdaterCommands).toSelf().inSingletonScope();
bind(CommandContribution).toService(IDEUpdaterCommands);

// Frontend binding for the IDE Updater service
bind(IDEUpdaterClientImpl).toSelf().inSingletonScope();
bind(IDEUpdaterClient).toService(IDEUpdaterClientImpl);
bind(IDEUpdater)
.toDynamicValue((context) => {
const client = context.container.get(IDEUpdaterClientImpl);
return ElectronIpcConnectionProvider.createProxy(
context.container,
IDEUpdaterPath,
client
);
})
.inSingletonScope();
});
Loading