Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/licenses/add-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Adds license headers to all source files.
set -e

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$REPO_ROOT"

COMMON_IGNORES=(
--ignore "**/*.yml"
--ignore "**/*.yaml"
--ignore "**/*.xml"
--ignore "**/*.html"
--ignore "**/*.js"
--ignore "**/*.txt"
--ignore "**/*.json"
--ignore "**/*.md"
--ignore "**/*.lock"
--ignore "**/.dart_tool/**"
--ignore "**/node_modules/**"
)

# Dart files — built-in Apache 2.0 template with // comment style
addlicense -l apache -c "Google LLC" \
"${COMMON_IGNORES[@]}" \
--ignore "**/*.g.dart" \
--ignore "**/*.sh" \
--ignore "**/*.ts" \
.

# TypeScript and shell files — custom template (/** */ and # styles)
addlicense -f "$REPO_ROOT/.github/licenses/default.txt" -c "Google LLC" \
"${COMMON_IGNORES[@]}" \
--ignore "**/*.dart" \
.
48 changes: 48 additions & 0 deletions .github/licenses/check-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Checks license headers on all source files (dry run).
set -e

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$REPO_ROOT"

COMMON_IGNORES=(
--ignore "**/*.yml"
--ignore "**/*.yaml"
--ignore "**/*.xml"
--ignore "**/*.html"
--ignore "**/*.js"
--ignore "**/*.txt"
--ignore "**/*.json"
--ignore "**/*.md"
--ignore "**/*.lock"
--ignore "**/.dart_tool/**"
--ignore "**/node_modules/**"
)

# Dart files
addlicense -l apache -c "Google LLC" --check \
"${COMMON_IGNORES[@]}" \
--ignore "**/*.g.dart" \
--ignore "**/*.sh" \
--ignore "**/*.ts" \
.

# TypeScript and shell files
addlicense -f "$REPO_ROOT/.github/licenses/default.txt" -c "Google LLC" --check \
"${COMMON_IGNORES[@]}" \
--ignore "**/*.dart" \
.
13 changes: 13 additions & 0 deletions .github/licenses/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright {{.Year}} {{.Holder}}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
26 changes: 25 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ on:
default: 'stable'

jobs:
# Check license headers on all source files
check-license-header:
name: Check License Headers
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download addlicense
run: |
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
chmod +x /usr/local/bin/addlicense

- name: Check license headers
run: .github/licenses/check-headers.sh

lint:
name: Lint (Dart ${{ matrix.dart-version }})
runs-on: ubuntu-latest
Expand Down Expand Up @@ -349,7 +366,7 @@ jobs:
build:
name: Build verification (Dart ${{ matrix.dart-version }})
runs-on: ubuntu-latest
needs: [lint, test, test-integration]
needs: [lint, test, test-integration, check-license-header]
# Run even if test-integration was skipped (fork PRs), but not if lint or test failed
if: |
always() &&
Expand Down Expand Up @@ -390,5 +407,12 @@ jobs:
run: melos bootstrap
working-directory: .

- name: Validate license headers
run: |
if [ "${{ needs.check-license-header.result }}" != "success" ]; then
echo "❌ License header check failed"
exit 1
fi

- name: Verify package
run: dart pub publish --dry-run
1 change: 1 addition & 0 deletions CONTRIBUTING.md
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020 Invertase Limited
Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 14 additions & 0 deletions gen-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Script to generate version.g.dart files for all packages
# Finds all packages/*/pubspec.yaml files, extracts version, and writes to package/lib/version.g.dart
Expand Down
Loading
Loading