Skip to content

Commit 8efe67f

Browse files
committed
fix: replace read-only notices when rebuilding into the same output
1 parent 021f246 commit 8efe67f

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ jobs:
3333
node-version: 24
3434
# Unsigned: signing belongs to each embedding app.
3535
- run: node dist/build.js --out build --scratch .build/native
36+
# Embedders rebuild into the same output; notices from other sources must survive.
37+
- run: |
38+
mkdir -p build/Licenses/embedder && echo kept > build/Licenses/embedder/NOTICE
39+
node dist/build.js --out build --scratch .build/native
40+
test "$(cat build/Licenses/embedder/NOTICE)" = kept

‎dist/build.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ const notices = (source, identity) => {
134134
if (!files.length)
135135
throw new Error(`The native dependency ${identity} has no license file`);
136136
mkdirSync(join(licenses, identity), { recursive: true });
137-
for (const name of files)
137+
for (const name of files) {
138+
// Checked-out notices are read-only and copies keep that mode, so replace each one.
139+
rmSync(join(licenses, identity, name), { force: true });
138140
copyFileSync(join(source, name), join(licenses, identity, name));
141+
}
139142
};
140143
notices(root, "desktop-tools");
141144
for (const { identity } of resolved.pins) {

‎src/build.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ const notices = (source: string, identity: string) => {
139139
);
140140
if (!files.length) throw new Error(`The native dependency ${identity} has no license file`);
141141
mkdirSync(join(licenses, identity), { recursive: true });
142-
for (const name of files) copyFileSync(join(source, name), join(licenses, identity, name));
142+
for (const name of files) {
143+
// Checked-out notices are read-only and copies keep that mode, so replace each one.
144+
rmSync(join(licenses, identity, name), { force: true });
145+
copyFileSync(join(source, name), join(licenses, identity, name));
146+
}
143147
};
144148
notices(root, "desktop-tools");
145149
for (const { identity } of resolved.pins) {

0 commit comments

Comments
 (0)