Skip to content

Commit a39ab47

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
Use Task to build pinned CLI for IDE2.
Closes arduino#1313 Signed-off-by: Akos Kitta <[email protected]>
1 parent 9cabd40 commit a39ab47

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

Diff for: .github/workflows/build.yml

+6
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:

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

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
node-version: '14.x'
3232
registry-url: 'https://registry.npmjs.org'
3333

34+
- name: Install Taskfile
35+
uses: arduino/setup-task@v1
36+
with:
37+
repo-token: ${{ secrets.GITHUB_TOKEN }}
38+
version: 3.x
39+
3440
- name: Install dependencies
3541
run: yarn
3642

Diff for: arduino-ide-extension/scripts/download-cli.js

+2-2
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
})();

Diff for: arduino-ide-extension/scripts/utils.js

+20-2
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)