-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: determine electron version from tags not files (#36137)
* build: determine electron version from tags not files (#36106) * build: determine electron version from tags not files * build: make electron_version dependent on packed-refs and git HEAD * build: do not delete electron/.git * build: do not revert a commit we didn't make * build: gen version file instead of just writing it * build: update cache and ninja targets * build: copy resource.h to generated electron.rc * build: electron_win32_resources should be public deps * build: also copy the icon Co-authored-by: MarshallOfSound <marshallofsound@electronjs.org> * chore: fixup patches * chore: update patches * build: ensure get-version runs in the electron git checkout (#36128) * build: strip v in the getElectronVersion helper * build: use npm@7 for npm view command Co-authored-by: Samuel Attard <sam@electronjs.org> Co-authored-by: MarshallOfSound <marshallofsound@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@salesforce.com>
- Loading branch information
1 parent
b4d9866
commit f2e2fc3
Showing
18 changed files
with
148 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$full_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
patches/chromium/build_allow_electron_to_use_exec_script.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Samuel Attard <sattard@salesforce.com> | ||
Date: Fri, 21 Oct 2022 16:29:06 -0700 | ||
Subject: build: allow electron to use exec_script | ||
|
||
This is similar to the //build usecase so we're OK adding ourselves here | ||
|
||
diff --git a/.gn b/.gn | ||
index 5a11496a47ae7cd2b74992c58760ce1786f7b7df..210463041fa2e46bb368f515afdd4f25e1ca6616 100644 | ||
--- a/.gn | ||
+++ b/.gn | ||
@@ -171,4 +171,6 @@ exec_script_whitelist = | ||
|
||
"//tools/grit/grit_rule.gni", | ||
"//tools/gritsettings/BUILD.gn", | ||
+ | ||
+ "//electron/BUILD.gn" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { spawnSync } = require('child_process'); | ||
const path = require('path'); | ||
|
||
module.exports.getElectronVersion = () => { | ||
// Find the nearest tag to the current HEAD | ||
// This is equivilant to our old logic of "use a value in package.json" for the following reasons | ||
// | ||
// 1. Whenever we updated the package.json we ALSO pushed a tag with the same version | ||
// 2. Whenever we _reverted_ a bump all we actually did was push a commit that deleted the tag and changed the version number back | ||
// | ||
// The only difference in the "git describe" technique is that technically a commit can "change" it's version | ||
// number if a tag is created / removed retroactively. i.e. the first time a commit is pushed it will be 1.2.3 | ||
// and after the tag is made rebuilding the same commit will result in it being 1.2.4 | ||
const output = spawnSync('git', ['describe', '--tags', '--abbrev=0'], { | ||
cwd: path.resolve(__dirname, '..', '..') | ||
}); | ||
if (output.status !== 0) { | ||
console.error(output.stderr); | ||
throw new Error('Failed to get current electron version'); | ||
} | ||
return output.stdout.toString().trim().replace(/^v/g, ''); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from lib.util import get_electron_version | ||
|
||
print(get_electron_version()) |
Oops, something went wrong.