Skip to content

Commit d89a346

Browse files
add license header check
1 parent cbb2537 commit d89a346

10 files changed

Lines changed: 154 additions & 23 deletions

File tree

‎.github/workflows/android-ci.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ on:
2020
workflow_dispatch: {}
2121

2222
jobs:
23+
license-header:
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
- name: license header check
29+
run: ./scripts/check-license-headers.sh
30+
2331
ktlint:
2432
runs-on: ubuntu-24.04
2533
steps:

‎AGENTS.md‎

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,49 @@ WiFiAnalyzer is an Android application for analyzing WiFi networks. It helps use
2222
| Code Style | ktlint |
2323
| License | GNU General Public License v3.0 (GPLv3) |
2424

25-
clearAdditional repository-specific versions and toolchain (source-of-truth files shown):
25+
Additional repository-specific versions and toolchain (source-of-truth files shown):
2626

27-
- Kotlin: root `build.gradle` (look for `kotlin_version`)
28-
- Android Gradle Plugin (AGP): root `build.gradle` (look for the `com.android.tools.build:gradle` classpath)
27+
The build uses the Gradle Kotlin DSL (`*.gradle.kts`) with a **version catalog**. Every dependency, plugin,
28+
and tool version lives in `gradle/libs.versions.toml` — the build scripts only reference it via
29+
`libs.*` accessors and `alias(libs.plugins.*)`, so they contain no version literals.
30+
31+
- All library, plugin, and tool versions (Kotlin, AGP, ktlint, Robolectric, ...): `gradle/libs.versions.toml`
2932
- Gradle wrapper: `gradle/wrapper/gradle-wrapper.properties` (check `distributionUrl`)
3033
- JDK used in CI: `.github/actions/common-setup/action.yml` and `.github/workflows/*` (search for `java-version` or `setup-java` usage)
31-
- Kotlin JVM target, compileSdk, minSdk: `app/build.gradle` (`kotlinOptions.jvmTarget`, `compileSdk`, `minSdkVersion` / `minSdk`)
32-
- ktlint plugin version: `app/build.gradle` (plugin `org.jlleitschuh.gradle.ktlint` and its `version`)
34+
- compileSdk, minSdk, targetSdk, Java source/target compatibility: `app/build.gradle.kts`
35+
- Version numbers and release signing: `app/gradle/version.gradle.kts` (values in `app/build.properties`)
36+
- JaCoCo tasks and coverage thresholds: `app/gradle/jacoco.gradle.kts`
37+
- Android lint rules: `app/lint.xml`; formatting rules: `.editorconfig`
38+
39+
Do not use apply(from = ...). Prefer precompiled (convention) plugins or a `build-logic` module; this repository does not use Gradle `extra` properties.
3340

3441
To extract these values quickly from a bash shell you can run (from the repository root):
3542

3643
```bash
37-
# Kotlin version
38-
grep -n "kotlin_version" build.gradle.kts
44+
# All versions at a glance
45+
cat gradle/libs.versions.toml
46+
47+
# A specific version (Kotlin, AGP, ktlint, Robolectric, ...)
48+
grep -nE "^(agp|kotlin|ktlint|robolectric) = " gradle/libs.versions.toml
3949

40-
# AGP classpath
41-
grep -n "com.android.tools.build:gradle" build.gradle.kts
50+
# Which plugins are applied, and where
51+
grep -nE "alias\(libs\.plugins" build.gradle.kts app/build.gradle.kts
4252

4353
# Gradle wrapper distribution
4454
grep -n "distributionUrl" gradle/wrapper/gradle-wrapper.properties
4555

4656
# JDK in CI workflows
47-
grep -R "java-version" .github
48-
49-
# compileSdk / minSdk / jvmTarget / ktlint plugin
50-
grep -nE "compileSdk|minSdk|kotlinOptions.jvmTarget|org.jlleitschuh.gradle.ktlint" app/build.gradle.kts
57+
grep -Rn "java-version" .github
5158

59+
# compileSdk / minSdk / targetSdk / Java compatibility
60+
grep -nE "compileSdk|minSdk|targetSdk|JavaVersion" app/build.gradle.kts
5261
```
5362

5463
## Project Structure
5564

5665
```
66+
app/build.gradle.kts # Module build script
67+
app/gradle/ # Applied build scripts (version, jacoco)
5768
app/src/main/kotlin/ # Main application source code
5869
app/src/test/kotlin/ # Unit tests
5970
app/src/androidTest/kotlin/ # Android instrumentation tests
@@ -95,10 +106,11 @@ All source files must include the GPLv3 license header:
95106
Use ktlint for code formatting:
96107
- Check: `./gradlew ktlintCheck`
97108
- Format: `./gradlew ktlintFormat`
98-
109+
99110
Repository-specific ktlint notes:
100-
- Plugin configured in `app/build.gradle` as `org.jlleitschuh.gradle.ktlint` (version `14.2.0`).
101-
- Baseline and rules: see `app/config/ktlint/baseline.xml` and project `.editorconfig` for formatting rules.
111+
- Plugin applied in `app/build.gradle.kts` as `alias(libs.plugins.ktlint)`; the version is the `ktlint` entry in `gradle/libs.versions.toml`.
112+
- Formatting rules: project `.editorconfig`. There is no ktlint baseline file — the codebase is expected to be clean.
113+
- `app/gradle/*.gradle.kts` is checked via `kotlinScriptAdditionalPaths`; ktlint otherwise sees only top-level `*.kts`.
102114

103115
## Communication Philosophy
104116

‎app/build.properties‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Build Properties
2-
#Mon Aug 17 18:59:46 EDT 2026
3-
version_build=4
2+
#Fri Aug 21 16:26:42 EDT 2026
3+
version_build=5
44
version_major=3
55
version_minor=3
66
version_patch=1

‎app/lint.xml‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
WiFiAnalyzer
4+
Copyright (C) 2015 - 2026 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>
18+
-->
219
<lint>
320
<issue id="GoogleAppIndexingWarning" severity="warning" />
421

@@ -11,4 +28,4 @@
1128
<ignore path="src/main/res/values-lt" />
1229
<ignore path="src/main/res/values-sk" />
1330
</issue>
14-
</lint>
31+
</lint>

‎app/src/main/AndroidManifest.xml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
android:supportsRtl="true"
4141
android:theme="@style/ThemeSplash">
4242

43-
<meta-data
44-
android:name="android.max_aspect"
45-
android:value="2.1" />
46-
4743
<activity
4844
android:name=".MainActivity"
4945
android:configChanges="keyboardHidden|orientation|screenSize"

‎app/src/main/res/xml/test_attrs.xml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<!--
2+
WiFiAnalyzer
3+
Copyright (C) 2015 - 2026 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>
17+
-->
118
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
219
<!-- Minimal content for AttributeSet testing -->
320
</PreferenceScreen>

‎app/src/test/kotlin/com/vrem/wifianalyzer/MainRobolectricTest.kt‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2015 - 2026 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
118
package com.vrem.wifianalyzer
219

320
import android.Manifest

‎app/src/test/kotlin/com/vrem/wifianalyzer/wifi/model/FastRoamingTest.kt‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2015 - 2026 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
118
package com.vrem.wifianalyzer.wifi.model
219

320
import android.net.wifi.ScanResult

‎app/src/test/res/xml/test_attrs.xml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<!--
2+
WiFiAnalyzer
3+
Copyright (C) 2015 - 2026 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>
17+
-->
118
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
219
<!-- Minimal content for AttributeSet testing -->
320
</PreferenceScreen>

‎scripts/check-license-headers.sh‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Fails when a tracked source file is missing the GPLv3 license header.
4+
5+
set -euo pipefail
6+
7+
cd "$(git rev-parse --show-toplevel)"
8+
9+
patterns=('*.java' '*.kt' '*.kts' '*.xml' '*.svg')
10+
header_lines=30
11+
12+
missing=()
13+
while IFS= read -r -d '' file; do
14+
header=$(head -n "$header_lines" "$file")
15+
if ! grep -q 'VREM Software Development' <<<"$header" ||
16+
! grep -q 'GNU General Public License' <<<"$header"; then
17+
missing+=("$file")
18+
fi
19+
done < <(git ls-files -z "${patterns[@]}")
20+
21+
if [ ${#missing[@]} -gt 0 ]; then
22+
echo "ERROR: missing GPLv3 license header in ${#missing[@]} file(s):"
23+
printf ' %s\n' "${missing[@]}"
24+
if [ -n "${GITHUB_ACTIONS:-}" ]; then
25+
printf '::error file=%s,line=1::Missing GPLv3 license header\n' "${missing[@]}"
26+
fi
27+
exit 1
28+
fi
29+
30+
echo "GPLv3 license header present in all ${#patterns[@]} checked file types."

0 commit comments

Comments
 (0)