1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 03:57:50 +03:00
Files
android_cast/HEADER.txt
Anton Afanasyeu ee4947a348 header update
2026-05-20 17:24:50 +02:00

77 lines
2.9 KiB
Plaintext

Project source file header template
===================================
Place this block at the top of each source unit (after optional shebang / <?php).
Run `python3 scripts/apply-project-headers.py` to (re)apply across the tree.
Install git hooks: `./scripts/install-git-hooks.sh`
Excluded paths: `third-party/` and build/vendor dirs are never modified.
Hooks (only **staged** / **committed** sources are touched; third-party/ is skipped):
pre-commit — Created/Updated/Contributors/Digest for staged files; preserves Commit line
post-commit — sets `Commit: <sha>` on files in HEAD, then `git commit --amend --no-edit`
Pre-commit contributor (email auto-filled from git when missing):
export HEADER_CONTRIBUTOR="Your Name" # adds git user.email
export HEADER_CONTRIBUTOR="Name <you@mail>" # used as-is
export HEADER_CONTRIBUTOR_EMAIL="you@mail" # optional override
Placeholders
------------
__PACKAGE_NAME_PLACEHOLDER__
Java/AIDL: `package com.example.foo;`
C/C++/PHP: `/* package path/relative/to/repo/file.ext */`
__FILENAME_PLACEHOLDER__ Short filename only (e.g. MainActivity.java)
__DATE_PLACEHOLDER__ First commit time (human-readable + timezone)
__UPDATE_DATE_PLACEHOLDER__ Last change time; pre-commit refreshes on staged edits
__COMMIT_PLACEHOLDER__ Git commit SHA for this revision (post-commit hook; not in Digest)
__CONTRIBUTOR__ `Name <email>` when known (git log/config); else `Name`
__CLASS_NAME_PLACEHOLDER__ ` * class Foo` / interface / enum — omitted if none
__CONTRIBUTORS_LIST_PLACEHOLDER__
Sorted by commits, then blamed lines; `Name <email>` from git / @author tags
Includes Cursor Agent (project assistant, no email)
__DIGEST__ `Digest: SHA256\t<hex>` of file without this line; omitted if N/A
Example (PHP)
-------------
<?php
/*
* package examples/foo/bar.php
* bar.php
* Created at: Wed 20 May 2026 12:00:00 +0300
* Updated at: Wed 20 May 2026 15:00:00 +0300 by Name <user@email.com>
* Commit: abcdef1234567890...
* Contributors:
* - Name <user@email.com> (1 commits, 10 lines)
* - Cursor Agent (project assistant)
* Digest: SHA256 abc123...
*/
declare(strict_types=1);
Pure PHP keeps a single <?php block (declare must follow the comment directly).
View templates add ?> after the comment, then HTML/markup.
Example (Java)
--------------
package com.foxx.androidcast;
/*********************************************************************
* MainActivity.java
* Created at: Wed 20 May 2026 12:00:00 +0300
* Updated at: Wed 20 May 2026 15:00:00 +0300 by Anton Afanasyeu <a.afanasieff@gmail.com>
* Commit: abcdef1234567890...
* class MainActivity
* Contributors:
* - Anton Afanasyeu <a.afanasieff@gmail.com> (29 commits, 120 lines)
* - Cursor Agent (project assistant)
* Digest: SHA256 abc123...
**********************************************************************/