Please review a new script for JDK8: JDK source code legal headers conformance verification

Joseph Darcy joe.darcy at oracle.com
Sat Mar 17 00:25:11 UTC 2012


Hi Misha,

I think including this kind of script in the JDK is a great idea.

Follow-up work could include adding a script that would use this first 
script to verify the source files had the expected license.  Such a 
check could be a make target run as part of the build.

Cheers,

-Joe

On 3/5/2012 4:20 PM, Misha Bykov wrote:
>
> I need a reviewer for a new attached script for JDK8 infrastructure.
>
> SUMMARY
>
> Most of JDK source files  are required to contain a legal approved 
> license header. The content and the format of the header is 
> pre-defined by legal and any alteration is not permitted.
>
> At the moment JDK8 contains three templates for source license 
> headers: gpl, gpl-cp and bsd.
> The templates are located in $ROOT/make/templates directory:
>
> $ ls $ROOT/make/templates
> bsd-header  gpl-cp-header  gpl-header
> $
>
> It's recommended for a developer, when he introduced or modified 
> source code files, to check whether a license header is precisely 
> correct for every file he worked on.
>
> The new script allows a JDK developer to check if the specified 
> license header for a given file (or a set of files) matches the right 
> header template.
>
> NAME
>
> lic_check.sh - JDK source code legal headers conformance verification
>
> SYNOPSIS
>
> lic_check.sh [-gpl] or [-gplcp] or [-bsd] file(s)
>
> DESCRIPTION
>
> The script for OpenJDK distribution to verify legal notices in a 
> particular source file or a set of files.
>
> The script must be located in the directory:
>
> $ROOT/make/scripts
>
> It uses templates from:
>
> $ROOT/make/templates
>
> The successful output example:
>
> ###
> ### Checking copyright notice in the file: filename.java
> ###
> No differences encountered
> SUCCESS: The license header for filename.java has been verified.
>
> The unsuccessful output example if Oracle copyright string is missing 
> or copyright years are not correct :
>
> ###
> ### Checking copyright notice in the file: filename.java
> ###
> ERROR: Copyright string is not correct or missing in filename.java.
>
> If the copyright string is correct, but the license header is not 
> correct, the script should produce the
> "diff" output between a template in $ROOT/make/templates and the 
> license header from the given file.
>
> HOW TO TEST
>
> 1. Place the script into $ROOT/make/scripts in JDK8 source repository 
> (otherwise it will not find $ROOT/make/templates and produce an error).
> 2. cd to the directory with the files to check license headers
> 3. $ROOT/make/scripts/lic_check.sh [-gpl] or [-gplcp] or [-bsd] 
> filename(s)
>
> Any questions or comments about bugs in the script, improvement 
> suggestions, script style, etc. would be appreciated.
>
> Thanks,
> Misha



More information about the build-dev mailing list