Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bc73751

Browse files
author
Akos Kitta
committed
Use Task to build pinned CLI for IDE2.
Closes #1313 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 9cabd40 commit bc73751

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

‎.github/workflows/build.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ jobs:
6666
with:
6767
python-version: '3.x'
6868

69+
- name: Install Taskfile
70+
uses: arduino/setup-task@v1
71+
with:
72+
repo-token: ${{ secrets.GITHUB_TOKEN }}
73+
version: 3.x
74+
6975
- name: Package
7076
shell: bash
7177
env:

‎arduino-ide-extension/scripts/download-cli.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const semver = require('semver');
77
const moment = require('moment');
88
const downloader = require('./downloader');
9-
const { goBuildFromGit } = require('./utils');
9+
const { taskBuildFromGit } = require('./utils');
1010

1111
const version = (() => {
1212
const pkg = require(path.join(__dirname, '..', 'package.json'));
@@ -82,6 +82,6 @@
8282
shell.exit(1);
8383
}
8484
} else {
85-
goBuildFromGit(version, destinationPath, 'CLI');
85+
taskBuildFromGit(version, destinationPath, 'CLI');
8686
}
8787
})();

‎arduino-ide-extension/scripts/utils.js‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* Clones something from GitHub and builds it with [`Task`](https://taskfile.dev/).
3+
*
4+
* @param version {object} the version object.
5+
* @param destinationPath {string} the absolute path of the output binary. For example, `C:\\folder\\arduino-cli.exe` or `/path/to/arduino-language-server`
6+
* @param taskName {string} for the CLI logging . Can be `'CLI'` or `'language-server'`, etc.
7+
*/
8+
exports.taskBuildFromGit = (version, destinationPath, taskName) => {
9+
return buildFromGit('task', version, destinationPath, taskName);
10+
};
11+
112
/**
213
* Clones something from GitHub and builds it with `Golang`.
314
*
@@ -6,6 +17,13 @@
617
* @param taskName {string} for the CLI logging . Can be `'CLI'` or `'language-server'`, etc.
718
*/
819
exports.goBuildFromGit = (version, destinationPath, taskName) => {
20+
return buildFromGit('go', version, destinationPath, taskName);
21+
};
22+
23+
/**
24+
* The `command` is either `go` or `task`.
25+
*/
26+
function buildFromGit(command, version, destinationPath, taskName) {
927
const fs = require('fs');
1028
const path = require('path');
1129
const temp = require('temp');
@@ -62,7 +80,7 @@ exports.goBuildFromGit = (version, destinationPath, taskName) => {
6280
}
6381

6482
shell.echo(`>>> Building the ${taskName}...`);
65-
if (shell.exec('go build', { cwd: tempRepoPath }).code !== 0) {
83+
if (shell.exec(`${command} build`, { cwd: tempRepoPath }).code !== 0) {
6684
shell.exit(1);
6785
}
6886
shell.echo(`<<< Done ${taskName} build.`);
@@ -89,4 +107,4 @@ exports.goBuildFromGit = (version, destinationPath, taskName) => {
89107
shell.exit(1);
90108
}
91109
shell.echo(`>>> Verified ${taskName}.`);
92-
};
110+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /