File: fixupmessages.md

package info (click to toggle)
bnd 5.0.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,128 kB
  • sloc: java: 249,039; xml: 90,728; sh: 655; perl: 153; makefile: 96; python: 47; javascript: 9
file content (75 lines) | stat: -rw-r--r-- 2,950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
layout: default
class: Project
title: -fixupmessages SELECTOR ( ';' ( is | replace | restrict ) )* ... 
summary: Fixup errors and warnings. 
---

The `-fixupmessages` instruction is intended to _fixup_ the errors and warnings. It allows you to remove errors and/or warnings, turn errors into warnings, and turn warnings into errors. With this instruction you can fail a build based on a warning or succeed a build that runs into errors.

The default of this instruction is to list a number of patterns. Any error or warning that matches this pattern is then removed. The following example will remove any  error/warning that matches `'some error'`, `'another error'`, or `'and yet another error'`.

	-fixupmessages:  \
		some error, 
		another error, 
		and yet another error

The pattern is a [SELECTOR][1], which makes it possible to do case insensitive matches, wildcards, literals, etc.

## Syntax

The basic format of `-fixupmessages` is:

	-fixupmessages ::= fixup ( ',' fixup ) *
	fixup          ::= SELECTOR directive *
	directive      ::= ';' ( restrict | is | replace )
	restrict       ::= 'restrict:=' ( 'error' | 'warning' )
	is             ::= 'is:=' ( 'ignore' | 'error' | 'warning' )
	replace        ::= 'replace:=' <<text>> 


The value of a fixup clause is a globbing expression.

## Directives

The following directives are supported:

* `restrict:` – By default, the fixup clause is applied to all errors and warnings. You can restrict its application to either errors or warnings specifying either `restrict:=error` or `restrict:=warning`.
* `is:` – By default an error remains an error and a warning remains a warning. However, if you specify the `is:` directive you can force an error to become a warning or vice versa. This can be very useful if you build fails with an error that you do not consider a failure.
* `replace:` – Replace the message with a new message. The replacement will be processed by the macro processor, the `${@}` macro will contain the current message.

The `-fixupmessages` instruction is a _merged property_. This means that you can define it in many different places like for example in a file in `cnf/ext`. Just put an extension on the instruction. For example:

	-fixupmessages.one: 'Some error'
	-fixupmessages.two: 'Another error'

## Examples

	# Turn an error into a warning
	-fixupmessages
	  "Invalid character'; \
	    restrict:=error;
	    is:=warning
  
	# Replace a message
	-fixupmessages \
	  "split";replace:=broken
	  
	# Ignore case by appending :i
	-fixupmessages \
	  "case insensitive:i"
	
	# Wildcards
	-fixupmessages \
	  "prefix*suffix"

	# Turn properties parser messages into warnings
	-fixupmessages.parser: \
	  "Invalid character in properties"; \
	  "No value specified for key"; \
	  "Invalid property key"; \
	  "Invalid unicode string"; \
	  "Found \\<whitespace>";
	    is:=warning
	    
[1]: https://bnd.bndtools.org/chapters/820-instructions.html#selector