<commit_before>---
layout: default
class: Project
title: -stalecheck ( srcs ( ';' ( newer | warning | error | command )) * ) *
summary: Perform a stale check of files and directories before building a jar 
---

The `-stalecheck` verifies two file sets, the _src_ and _newer_ set. If any of the files in the src set is
newer than any of the files in the newer set it triggers either a warning, an error, or a system command.

   stalecheck ::= src ( ';' attributes  ) +
   
   src        ::= // Ant wildcard for the src files/directories
   attributes ::= newer | error? | warning? | command?
   newer      ::=  // Ant wildcard for the files that depend on src
   error      ::= 'error=' STRING
   warning    ::= 'warning=' STRING
   command    ::= 'command=' ('-')? STRING 

The `error` or `warning` attributes specify a message that is logged when the src set is out of date
with respect to the newer set.

The `command` is executed when the newer set is stale. If the command is prefixed with a minus sign (`-`) then
any errors will be ignored.

## Examples

    -stalecheck:  \   
        openapi.json; \ 
            newer='gen-src/, checksum.md5' 

    -stalecheck:   \
        specs/**.md; \ 
            newer='doc/**.doc' ; \ 
            error='Markdown needs to be generated'

<commit_msg>[docs] stalecheck<commit_after>---
layout: default
class: Project
title: -stalecheck srcs ';newer=' depends ( ';' ( warning | error | command ))* ...
summary: Perform a stale check of files and directories before building a jar 
since: 4.3
---

If you work in Bndtools then there is normally little to worry about, bndtools keeps everything up to dated all the time. 
Any file you save, and guaranteed in s short time all dependent bundles are updated. This comes with a crucial guarantee 
that anything you do in Bndtools is faithfully reproduced on the build server using Gradle. For a default workspace there 
is no need for any gradle specific files. All the workspace's settings are defined in the bnd files.

However, sometimes it is necessary to generate sources that need to be compiled. There are then two choices when you 
checkout a workspace. Always use the command line let the build do its magic or checkin the generated sources. 
Although generally frowned upon, it has the advantage that you do not need to store the tool itself under version control. 
Any revision can always compile regardless of what happened to the tool. It is also nice to see it on Github, it actually 
makes the experience of the majority of people that use the workspace and usually not touch the swagger file blithely 
unaware of the underlying complexities.

However, this has a very serious problem. Sometimes you touch the swagger file and forget to run the gradle to generate 
new sources. It would be very convenient if bnd could generate an error if certain files were out of date respective
to a set of other files.  Thhe `-stalecheck` instruction has this purpose.

	-stalecheck	::= 	clause ( ',' clause )*
	clause		::= 	src ';' 'newer=' depends (';' option )*
	src		::=	Ant Glob spec
	depends		::= 	Ant Glob spec
	option		::= 	'error=' STRING 
			| 	'warning=' STRING 
			| 	'command=' STRING


Just before bnd will start making the JAR(s) for a project it will check if any of the files in the `src` specification 
is newer than the files in the `depends` set. If so, it will provide warning or error. If either a specific error or 
warning `STRING` is given then this is reported accordingly.

If a command `STRING` is given it is executed as in the `${system}` macro. If the command `STRING` starts with a 
minus sign (`-`) then a failure is not an error, it is reported as warning.

If no command is given, nor an error or warning then a default error is reported.

## Examples

    -stalecheck:  \   
        openapi.json; \ 
            newer='gen-src/, checksum.md5' 

    -stalecheck:   \
        specs/**.md; \ 
            newer='doc/**.doc' ; \ 
            error='Markdown needs to be generated'


{'fraction_non_alphanumeric': 0.07757545522574208, 'fraction_numerical': 0.0009977550511349464, 'mean_word_length': 3.0960163432073546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7464608', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1125, 'n_words': 578}