Skip to content

Commit d7c0d92

Browse files
committed
chore: add licenses
1 parent 4daea57 commit d7c0d92

File tree

134 files changed

+612
-2
lines changed

Some content is hidden

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

134 files changed

+612
-2
lines changed

.github/workflows/test.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,38 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
# Check license headers on all source files
16+
check-license-header:
17+
name: Check License Headers
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Download addlicense
25+
run: |
26+
curl -sL https://github.com/google/addlicense/releases/download/v1.2.0/addlicense_v1.2.0_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin addlicense
27+
chmod +x /usr/local/bin/addlicense
28+
29+
- name: Check license headers
30+
run: |
31+
addlicense -f header_template.txt \
32+
--check \
33+
--ignore "**/*.yml" \
34+
--ignore "**/*.yaml" \
35+
--ignore "**/*.xml" \
36+
--ignore "**/*.g.dart" \
37+
--ignore "**/*.sh" \
38+
--ignore "**/*.html" \
39+
--ignore "**/*.js" \
40+
--ignore "**/*.ts" \
41+
--ignore "**/*.txt" \
42+
--ignore "**/.dart_tool/**" \
43+
--ignore "**/test/fixtures/nodejs_reference/**" \
44+
--ignore "**/test/fixtures/with_options_nodejs/**" \
45+
.
46+
1547
# Dart package analysis and formatting
1648
lint-analyze:
1749
name: Format & Analyze (${{ matrix.sdk }})
@@ -270,12 +302,16 @@ jobs:
270302
test-summary:
271303
name: Test Summary
272304
runs-on: ubuntu-latest
273-
needs: [lint-analyze, builder-tests, snapshot-tests, e2e-tests]
305+
needs: [check-license-header, lint-analyze, builder-tests, snapshot-tests, e2e-tests]
274306
if: always()
275307

276308
steps:
277309
- name: Check test results
278310
run: |
311+
if [ "${{ needs.check-license-header.result }}" != "success" ]; then
312+
echo "❌ License header check failed"
313+
exit 1
314+
fi
279315
if [ "${{ needs.lint-analyze.result }}" != "success" ]; then
280316
echo "❌ Format & Analyze failed"
281317
exit 1

CONTRIBUTING.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,47 @@ dart format .
9999
dart analyze --fatal-infos
100100
```
101101

102+
### License Headers
103+
104+
All source files must include a license header. The project uses [addlicense](https://github.com/google/addlicense) to manage this automatically.
105+
106+
**Install addlicense:**
107+
108+
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:
109+
110+
```bash
111+
curl -sL https://github.com/google/addlicense/releases/download/v1.2.0/addlicense_v1.2.0_macOS_arm64.tar.gz | tar xz
112+
sudo mv addlicense /usr/local/bin/
113+
```
114+
115+
**Add headers to new files:**
116+
117+
```bash
118+
addlicense -f header_template.txt \
119+
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
120+
--ignore "**/*.g.dart" --ignore "**/*.sh" --ignore "**/*.html" \
121+
--ignore "**/*.js" --ignore "**/*.ts" --ignore "**/*.txt" \
122+
--ignore "**/.dart_tool/**" \
123+
--ignore "**/test/fixtures/nodejs_reference/**" \
124+
--ignore "**/test/fixtures/with_options_nodejs/**" \
125+
.
126+
```
127+
128+
**Check headers (dry run, same as CI):**
129+
130+
```bash
131+
addlicense -f header_template.txt --check \
132+
--ignore "**/*.yml" --ignore "**/*.yaml" --ignore "**/*.xml" \
133+
--ignore "**/*.g.dart" --ignore "**/*.sh" --ignore "**/*.html" \
134+
--ignore "**/*.js" --ignore "**/*.ts" --ignore "**/*.txt" \
135+
--ignore "**/.dart_tool/**" \
136+
--ignore "**/test/fixtures/nodejs_reference/**" \
137+
--ignore "**/test/fixtures/with_options_nodejs/**" \
138+
.
139+
```
140+
141+
CI will fail if any source file is missing its license header.
142+
102143
### Local Validation
103144

104145
You can run the full CI check suite locally before pushing:
@@ -175,4 +216,4 @@ See `.github/workflows/README.md` for full details on each job and how to debug
175216

176217
## License
177218

178-
By contributing, you agree that your contributions will be licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
219+
By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).

LICENSE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2026 Firebase
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:

example/alerts/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/auth/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/database/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/eventarc/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/firestore/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/firestore_test/bin/server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_functions/firebase_functions.dart';
26

37
void main(List<String> args) async {

example/firestore_test/test/e2e/firestore_triggers_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2026, the Firebase project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// MIT-style license that can be found in the LICENSE file.
4+
15
import 'dart:convert';
26
import 'dart:io';
37

0 commit comments

Comments
 (0)