Skip to content

Commit ce7b1ef

Browse files
committed
chore: add scripts for license headers
1 parent e0caa21 commit ce7b1ef

File tree

215 files changed

+2760
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+2760
-703
lines changed

.github/licenses/add-headers.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Adds license headers to all source files.
17+
set -e
18+
19+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
20+
cd "$REPO_ROOT"
21+
22+
COMMON_IGNORES=(
23+
--ignore "**/*.yml"
24+
--ignore "**/*.yaml"
25+
--ignore "**/*.xml"
26+
--ignore "**/*.html"
27+
--ignore "**/*.js"
28+
--ignore "**/*.txt"
29+
--ignore "**/*.json"
30+
--ignore "**/*.md"
31+
--ignore "**/*.lock"
32+
--ignore "**/.dart_tool/**"
33+
--ignore "**/node_modules/**"
34+
)
35+
36+
# Dart files — built-in Apache 2.0 template with // comment style
37+
addlicense -l apache -c "Google LLC" \
38+
"${COMMON_IGNORES[@]}" \
39+
--ignore "**/*.g.dart" \
40+
--ignore "**/*.sh" \
41+
--ignore "**/*.ts" \
42+
.
43+
44+
# TypeScript and shell files — custom template (/** */ and # styles)
45+
addlicense -f "$REPO_ROOT/.github/licenses/default.txt" -c "Google LLC" \
46+
"${COMMON_IGNORES[@]}" \
47+
--ignore "**/*.dart" \
48+
.

.github/licenses/check-headers.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Checks license headers on all source files (dry run).
17+
set -e
18+
19+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
20+
cd "$REPO_ROOT"
21+
22+
COMMON_IGNORES=(
23+
--ignore "**/*.yml"
24+
--ignore "**/*.yaml"
25+
--ignore "**/*.xml"
26+
--ignore "**/*.html"
27+
--ignore "**/*.js"
28+
--ignore "**/*.txt"
29+
--ignore "**/*.json"
30+
--ignore "**/*.md"
31+
--ignore "**/*.lock"
32+
--ignore "**/.dart_tool/**"
33+
--ignore "**/node_modules/**"
34+
)
35+
36+
# Dart files
37+
addlicense -l apache -c "Google LLC" --check \
38+
"${COMMON_IGNORES[@]}" \
39+
--ignore "**/*.g.dart" \
40+
--ignore "**/*.sh" \
41+
--ignore "**/*.ts" \
42+
.
43+
44+
# TypeScript and shell files
45+
addlicense -f "$REPO_ROOT/.github/licenses/default.txt" -c "Google LLC" --check \
46+
"${COMMON_IGNORES[@]}" \
47+
--ignore "**/*.dart" \
48+
.

.github/licenses/dart.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,7 @@ jobs:
3333
chmod +x /usr/local/bin/addlicense
3434
3535
- name: Check license headers
36-
run: |
37-
addlicense -f .github/licenses/dart.txt \
38-
--check \
39-
-c "Google LLC" \
40-
--ignore "**/*.yml" \
41-
--ignore "**/*.yaml" \
42-
--ignore "**/*.xml" \
43-
--ignore "**/*.g.dart" \
44-
--ignore "**/*.sh" \
45-
--ignore "**/*.html" \
46-
--ignore "**/*.js" \
47-
--ignore "**/*.ts" \
48-
--ignore "**/*.txt" \
49-
--ignore "**/.dart_tool/**" \
50-
--ignore "**/node_modules/**" \
51-
.
52-
addlicense -f .github/licenses/default.txt \
53-
--check \
54-
-c "Google LLC" \
55-
--ignore "**/*.dart" \
56-
--ignore "**/*.yml" \
57-
--ignore "**/*.yaml" \
58-
--ignore "**/*.xml" \
59-
--ignore "**/*.html" \
60-
--ignore "**/*.js" \
61-
--ignore "**/*.txt" \
62-
--ignore "**/*.json" \
63-
--ignore "**/*.md" \
64-
--ignore "**/*.lock" \
65-
--ignore "**/.dart_tool/**" \
66-
--ignore "**/node_modules/**" \
67-
.
36+
run: .github/licenses/check-headers.sh
6837

6938
lint:
7039
name: Lint (Dart ${{ matrix.dart-version }})

packages/dart_firebase_admin/CONTRIBUTING.md

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ dart analyze
119119

120120
All source files must include a license header. The project uses [addlicense](https://github.com/google/addlicense) to manage this automatically, with two templates in `.github/licenses/`:
121121

122-
- `dart.txt``//` style, applied to Dart files
123122
- `default.txt` — plain text, applied to TypeScript (`/** */`) and shell (`#`) files; addlicense adds the correct comment style per file type
124123

124+
Dart files use the built-in `-l apache` license type instead of a custom template, which handles the `//` comment style and year substitution natively.
125+
125126
**Install addlicense:**
126127

127128
Download the binary for your platform from the [v1.2.0 release](https://github.com/google/addlicense/releases/tag/v1.2.0) and place it on your `PATH`. For example, on macOS ARM64:
@@ -134,49 +135,13 @@ sudo mv addlicense /usr/local/bin/
134135
**Add headers to new files (run from repo root):**
135136

136137
```bash
137-
# Dart files
138-
addlicense -f .github/licenses/dart.txt -c "Google LLC" \
139-
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
140-
--ignore "**/*.g.dart" --ignore "**/*.sh" --ignore "**/*.html" \
141-
--ignore "**/*.js" --ignore "**/*.ts" --ignore "**/*.txt" \
142-
--ignore "**/.dart_tool/**" \
143-
--ignore "**/node_modules/**" \
144-
.
145-
146-
# TypeScript and shell files
147-
addlicense -f .github/licenses/default.txt -c "Google LLC" \
148-
--ignore "**/*.dart" \
149-
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
150-
--ignore "**/*.html" --ignore "**/*.js" \
151-
--ignore "**/*.txt" --ignore "**/*.json" \
152-
--ignore "**/*.md" --ignore "**/*.lock" \
153-
--ignore "**/.dart_tool/**" \
154-
--ignore "**/node_modules/**" \
155-
.
138+
.github/licenses/add-headers.sh
156139
```
157140

158141
**Check headers (dry run, same as CI):**
159142

160143
```bash
161-
# Dart files
162-
addlicense -f .github/licenses/dart.txt -c "Google LLC" --check \
163-
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
164-
--ignore "**/*.g.dart" --ignore "**/*.sh" --ignore "**/*.html" \
165-
--ignore "**/*.js" --ignore "**/*.ts" --ignore "**/*.txt" \
166-
--ignore "**/.dart_tool/**" \
167-
--ignore "**/node_modules/**" \
168-
.
169-
170-
# TypeScript and shell files
171-
addlicense -f .github/licenses/default.txt -c "Google LLC" --check \
172-
--ignore "**/*.dart" \
173-
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
174-
--ignore "**/*.html" --ignore "**/*.js" \
175-
--ignore "**/*.txt" --ignore "**/*.json" \
176-
--ignore "**/*.md" --ignore "**/*.lock" \
177-
--ignore "**/.dart_tool/**" \
178-
--ignore "**/node_modules/**" \
179-
.
144+
.github/licenses/check-headers.sh
180145
```
181146

182147
CI will fail if any source file is missing its license header.

packages/dart_firebase_admin/example/lib/app_check_example.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
// Copyright 2024, the dart_firebase_admin project authors. All rights reserved.
2-
// Use of this source code is governed by an Apache 2.0 license that can be
3-
// found in the LICENSE file.
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
414

515
import 'package:dart_firebase_admin/app_check.dart';
616
import 'package:dart_firebase_admin/dart_firebase_admin.dart';

packages/dart_firebase_admin/example/lib/auth_example.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
// Copyright 2024, the dart_firebase_admin project authors. All rights reserved.
2-
// Use of this source code is governed by an Apache 2.0 license that can be
3-
// found in the LICENSE file.
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
414

515
import 'package:dart_firebase_admin/auth.dart';
616
import 'package:dart_firebase_admin/dart_firebase_admin.dart';

packages/dart_firebase_admin/example/lib/firestore_example.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
// Copyright 2024, the dart_firebase_admin project authors. All rights reserved.
2-
// Use of this source code is governed by an Apache 2.0 license that can be
3-
// found in the LICENSE file.
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
414

515
import 'dart:async';
616
import 'package:dart_firebase_admin/dart_firebase_admin.dart';

packages/dart_firebase_admin/example/lib/functions_example.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
// Copyright 2024, the dart_firebase_admin project authors. All rights reserved.
2-
// Use of this source code is governed by an Apache 2.0 license that can be
3-
// found in the LICENSE file.
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
414

515
import 'package:dart_firebase_admin/dart_firebase_admin.dart';
616
import 'package:dart_firebase_admin/functions.dart';

packages/dart_firebase_admin/example/lib/main.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
// Copyright 2024, the dart_firebase_admin project authors. All rights reserved.
2-
// Use of this source code is governed by an Apache 2.0 license that can be
3-
// found in the LICENSE file.
1+
// Copyright 2026 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
414

515
import 'package:dart_firebase_admin/dart_firebase_admin.dart';
616

0 commit comments

Comments
 (0)