Skip to content

Commit ebabf53

Browse files
committed
Merge branch 'main' of https://github.com/Open-CMSIS-Pack/vscode-cmsis-solution into feature/components-keep-or-save-on-dispose
2 parents 5c66c2c + f99f961 commit ebabf53

5 files changed

Lines changed: 76 additions & 45 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,42 +176,42 @@ jobs:
176176
- name: Upload win32-x64 VSIX package
177177
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
178178
with:
179-
name: vsix-package-win32-x64
179+
name: vscode-cmsis-solution-win32-x64
180180
path: ./*win32-x64*.vsix
181181
retention-days: 1
182182

183183
- name: Upload win32-arm64 VSIX package
184184
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
185185
with:
186-
name: vsix-package-win32-arm64
186+
name: vscode-cmsis-solution-win32-arm64
187187
path: ./*win32-arm64*.vsix
188188
retention-days: 1
189189

190190
- name: Upload linux-x64 VSIX package
191191
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
192192
with:
193-
name: vsix-package-linux-x64
193+
name: vscode-cmsis-solution-linux-x64
194194
path: ./*linux-x64*.vsix
195195
retention-days: 1
196196

197197
- name: Upload linux-arm64 VSIX package
198198
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
199199
with:
200-
name: vsix-package-linux-arm64
200+
name: vscode-cmsis-solution-linux-arm64
201201
path: ./*linux-arm64*.vsix
202202
retention-days: 1
203203

204204
- name: Upload darwin-x64 VSIX package
205205
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
206206
with:
207-
name: vsix-package-darwin-x64
207+
name: vscode-cmsis-solution-darwin-x64
208208
path: ./*darwin-x64*.vsix
209209
retention-days: 1
210210

211211
- name: Upload darwin-arm64 VSIX package
212212
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
213213
with:
214-
name: vsix-package-darwin-arm64
214+
name: vscode-cmsis-solution-darwin-arm64
215215
path: ./*darwin-arm64*.vsix
216216
retention-days: 1
217217

@@ -306,7 +306,7 @@ jobs:
306306
- name: Download packages
307307
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
308308
with:
309-
pattern: vsix-package-*
309+
pattern: vscode-cmsis-solution-*
310310

311311
- name: Download coverage report
312312
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

.github/workflows/nightly.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,42 +163,42 @@ jobs:
163163
- name: Upload win32-x64 VSIX package
164164
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
165165
with:
166-
name: vsix-package-win32-x64
166+
name: vscode-cmsis-solution-nightly-win32-x64
167167
path: ./*win32-x64*.vsix
168168
retention-days: 1
169169

170170
- name: Upload win32-arm64 VSIX package
171171
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
172172
with:
173-
name: vsix-package-win32-arm64
173+
name: vscode-cmsis-solution-nightly-win32-arm64
174174
path: ./*win32-arm64*.vsix
175175
retention-days: 1
176176

177177
- name: Upload linux-x64 VSIX package
178178
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
179179
with:
180-
name: vsix-package-linux-x64
180+
name: vscode-cmsis-solution-nightly-linux-x64
181181
path: ./*linux-x64*.vsix
182182
retention-days: 1
183183

184184
- name: Upload linux-arm64 VSIX package
185185
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
186186
with:
187-
name: vsix-package-linux-arm64
187+
name: vscode-cmsis-solution-nightly-linux-arm64
188188
path: ./*linux-arm64*.vsix
189189
retention-days: 1
190190

191191
- name: Upload darwin-x64 VSIX package
192192
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
193193
with:
194-
name: vsix-package-darwin-x64
194+
name: vscode-cmsis-solution-nightly-darwin-x64
195195
path: ./*darwin-x64*.vsix
196196
retention-days: 1
197197

198198
- name: Upload darwin-arm64 VSIX package
199199
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
200200
with:
201-
name: vsix-package-darwin-arm64
201+
name: vscode-cmsis-solution-nightly-darwin-arm64
202202
path: ./*darwin-arm64*.vsix
203203
retention-days: 1
204204

@@ -243,7 +243,7 @@ jobs:
243243
- name: Download VSIX package
244244
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
245245
with:
246-
name: vsix-package-win32-x64
246+
name: vscode-cmsis-solution-nightly-win32-x64
247247

248248
- name: Setup Node
249249
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"@graphql-codegen/cli": "^6.1.2",
118118
"@graphql-codegen/typescript-graphql-request": "^6.4.0",
119119
"@graphql-codegen/typescript-operations": "^5.0.8",
120-
"@open-cmsis-pack/vsce-helper": "^0.2.4",
120+
"@open-cmsis-pack/vsce-helper": "^0.3.0",
121121
"@playwright/test": "^1.58.2",
122122
"@testing-library/jest-dom": "^6.9.1",
123123
"@testing-library/react": "^16.3.2",

update_copyright_years.py

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2025-2026 Arm Limited
3+
Copyright 2025-2026 Arm Limited
44
5-
This script updates copyright headers in source files to reflect the current year.
6-
It supports headers in the format:
7-
Copyright (C) <original year> Arm Limited
8-
Copyright (C) <original year>-<current year> Arm Limited
9-
If the header does not reflect the current year, it will be updated to <original year>-<current year>.
10-
SPDX-FileCopyrightText headers are also updated similarly.
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
118
12-
The script is generated using ChatGPT
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
generated with AI
1318
"""
1419

1520
import re, sys, pathlib
@@ -18,39 +23,63 @@
1823
CURRENT_YEAR = datetime.datetime.now().year # Use system year
1924

2025
COPYRIGHT_PATTERN = re.compile(
21-
r'(?P<prefix>Copyright(?:\s*\(c\))?[^0-9\n]{0,40})'
26+
r'\bCopyright(?:[ \t]*\(c\))?[ \t]*'
2227
r'(?P<y1>\d{4})'
23-
r'(?:\s*-\s*(?P<y2>\d{4}))?',
24-
flags=re.IGNORECASE
25-
)
26-
SPDX_PATTERN = re.compile(
27-
r'(?P<prefix>SPDX-FileCopyrightText:\s*)'
28-
r'(?P<y1>\d{4})'
29-
r'(?:\s*-\s*(?P<y2>\d{4}))?',
28+
r'(?:[ \t]*-[ \t]*(?P<y2>\d{4}))?'
29+
r'(?:[ \t]+Arm[ \t]+Limited\b)*',
3030
flags=re.IGNORECASE
3131
)
3232

3333
def update_text(t: str):
3434
changed = False
35+
36+
def canonical_copyright(y1: int, y2: int | None) -> str:
37+
if y2 is None:
38+
return f"Copyright {y1} Arm Limited"
39+
return f"Copyright {y1}-{y2} Arm Limited"
40+
3541
def repl(m):
3642
nonlocal changed
3743
y1 = int(m.group('y1'))
3844
y2 = m.group('y2')
3945
if y2:
4046
y2 = int(y2)
41-
if y2 >= CURRENT_YEAR: return m.group(0)
42-
changed = True
43-
return f"{m.group('prefix')}{y1}-{CURRENT_YEAR}"
47+
target_y2 = y2 if y2 >= CURRENT_YEAR else CURRENT_YEAR
48+
new_text = canonical_copyright(y1, target_y2)
4449
else:
45-
if y1 == CURRENT_YEAR: return m.group(0)
46-
changed = True
47-
return f"{m.group('prefix')}{y1}-{CURRENT_YEAR}"
50+
new_text = (
51+
canonical_copyright(y1, None)
52+
if y1 == CURRENT_YEAR
53+
else canonical_copyright(y1, CURRENT_YEAR)
54+
)
55+
56+
if new_text == m.group(0):
57+
return m.group(0)
58+
59+
changed = True
60+
return new_text
61+
4862
t2 = COPYRIGHT_PATTERN.sub(repl, t)
49-
t2 = SPDX_PATTERN.sub(repl, t2)
5063
return t2, changed
5164

65+
66+
def collect_paths() -> list[str]:
67+
# Prefer explicit CLI paths; otherwise read piped stdin.
68+
if len(sys.argv) > 1:
69+
return [p.strip() for p in sys.argv[1:] if p.strip()]
70+
if not sys.stdin.isatty():
71+
return [p.strip() for p in sys.stdin if p.strip()]
72+
return []
73+
5274
def main():
53-
paths = [p.strip() for p in sys.stdin if p.strip()]
75+
paths = collect_paths()
76+
if not paths:
77+
print(
78+
"Usage: python update_copyright_years.py <file1> <file2> ...\n"
79+
" or: <command that outputs file paths> | python update_copyright_years.py"
80+
)
81+
return 2
82+
5483
updated = 0
5584
for p in paths:
5685
fp = pathlib.Path(p)
@@ -69,5 +98,7 @@ def main():
6998
print(f"[OK ] {p}")
7099
updated += 1
71100
print(f"Updated {updated} files to year {CURRENT_YEAR}")
101+
return 0
102+
72103
if __name__ == "__main__":
73-
main()
104+
raise SystemExit(main())

0 commit comments

Comments
 (0)