aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/license.conf
blob: 76133b0c1ba9fecb47ce371ba049beda7b45bfa1 (plain) (blame)
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
LICENSE_EXPRESSION=
LICENSE_NAMES=

MODULE_LICENSES_RESTRICTIONS=
MODULE_LICENSES_RESTRICTION_EXCEPTIONS=
MODULE_LICENSES_RESTRICTION_TYPES=
MODULEWISE_LICENSES_RESTRICTIONS=
MODULEWISE_LICENSES_RESTRICTION_TYPES=
DEFAULT_MODULE_LICENSE=Service-Default-License
EXPLICIT_LICENSE_PREFIXES=
EXPLICIT_LICENSE_EXCEPTIONS=

LICENSES=
LICENSES+=build/conf/licenses.json

macro _DONT_REQUIRE_LICENSE() {
    SET(EXPLICIT_LICENSE_PREFIXES "")
}

### @usage: LICENSE(licenses...)
###
### Specify the licenses of the module, separated by spaces. Specifying multiple licenses interpreted as permission to use this
### library satisfying all conditions of any of the listed licenses.
###
### A license must be prescribed for contribs
macro LICENSE(Flags...) {
    SET(LICENSE_EXPRESSION $Flags)
    SET(LICENSE_NAMES $Flags)
    # TODO(YMAKE-1136) avoid abusing LICENSE
    _CONTRIB_MODULE_HOOKS()
}

### @usage LICENSE_RESTRICTION(ALLOW_ONLY|DENY LicenseProperty...)
###
### Restrict licenses of direct and indirect module dependencies.
###
### ALLOW_ONLY restriction type requires dependent module to have at least one license without properties not listed in restrictions list.
###
### DENY restriction type forbids dependency on module with no license without any listed property from the list.
###
### Note: Can be used multiple times on the same module all specified constraints will be checked.
### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
macro LICENSE_RESTRICTION(TYPE, RESTRICTIONS...) {
    SET_APPEND(MODULE_LICENSES_RESTRICTION_TYPES $TYPE)
    SET_APPEND(MODULE_LICENSES_RESTRICTIONS $RESTRICTIONS)
}

### @usage MODULEWISE_LICENSE_RESTRICTION(ALLOW_ONLY|DENY LicenseProperty...)
###
### Restrict licenses per module only, without it peers.
###
### ALLOW_ONLY restriction type requires module to have at least one license without properties not listed in restrictions list.
###
### DENY restriction type forbids module with no license without any listed property from the list.
###
### Note: Can be used multiple times on the same module all specified constraints will be checked.
### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
macro MODULEWISE_LICENSE_RESTRICTION(TYPE, RESTRICTIONS...) {
    SET_APPEND(MODULEWISE_LICENSES_RESTRICTION_TYPES $TYPE)
    SET_APPEND(MODULEWISE_LICENSES_RESTRICTIONS $RESTRICTIONS)
}

### @usage LICENSE_RESTRICTION_EXCEPTIONS(Module...)
###
### List of modules for exception from LICENSE_RESTRICTION and MODULEWISE_LICENSE_RESTRICTION logic.
macro LICENSE_RESTRICTION_EXCEPTIONS(EXCEPT...) {
    SET_APPEND(MODULE_LICENSES_RESTRICTION_EXCEPTIONS $EXCEPT)
}