aboutsummaryrefslogtreecommitdiff
path: root/tests/variable
AgeCommit message (Collapse)AuthorFilesLines
2022-12-02Fail if scope or target qualification in variable expansion is unknownBoris Kolpackov2-0/+21
There are three options here: we can "fall through" to an outer scope (there is always the global scope backstop; this is the old semantics, sort of), we can return NULL straight away, or we can fail. It feels like in most cases unknown scope or target is a mistake and doing anything other than failing is just making things harder to debug.
2022-10-13Add test for public/private variable modelBoris Kolpackov2-0/+50
2022-10-13Switch to public/private variables modelBoris Kolpackov1-37/+37
Now unqualified variables are project-private and can be typified.
2022-06-28Add support for querying out-qualified target-specific variablesBoris Kolpackov1-6/+8
2021-06-08Get rid of special *{} wildcard target type notation in target type/patternsBoris Kolpackov1-1/+1
Explicit target{} should be used instead. Also, in this context, absent target type is now treated as file{} rather than target{}, for consistency with all other cases.
2021-05-28Add support for regex-based target type/pattern specific variablesBoris Kolpackov1-0/+127
This is in addition to the already supported path-based target type/pattern specific variables. For example: hxx{*}: x = y # path-based hxx{~/.*/}: x = y # regex-based
2020-02-07Drop copyright notice from source codeKaren Arutyunov10-10/+0
2019-11-14Tighten up attribute recognition during parsingBoris Kolpackov1-6/+11
Now it should be possible to use `[]` for wildcard patterns, for example: foo = foo.[hit]xx Note that a leading bracket expression will still be recognized as attributes and escaping or quoting it will inhibit pattern matching. To resolve this case we need to specify an empty attribute list: foo = [] [abc]-foo.cxx
2019-03-14Add support for multiple variable overridesBoris Kolpackov1-0/+30
Now we can do: $ b config.cxx.coptions=-O3 config.cxx.coptions=-O0 Or even: $ b config.cxx.coptions=-O3 config.cxx.coptions+=-g
2019-03-13Cutoff append/prepend overrides that come before assignment overrideBoris Kolpackov1-0/+29
For example: $ b x+=1 x=2 x+=3 Should result in '2 3', not '1 2 3'.
2019-01-16Update copyright yearKaren Arutyunov10-10/+10
2018-11-21Add support for target and prerequisite specific variable blocksBoris Kolpackov5-3/+150
For example, now instead of: lib{foo}: cxx.loptions += -static lib{foo}: cxx.libs += -lpthread We can write: lib{foo}: { cxx.loptions += -static cxx.libs += -lpthread } The same works for prerequisites as well as target type/patterns. For example: exe{*.test}: { test = true install = false }
2018-11-16Implement support for dependency chainsBoris Kolpackov1-4/+9
Now instead of: ./: exe{foo} exe{foo}: cxx{*} We can write: ./: exe{foo}: cxx{*} Or even: ./: exe{foo}: libue{foo}: cxx{*} This can be combined with prerequisite-specific variables (which naturally only apply to the last set of prerequisites in the chain): ./: exe{foo}: libue{foo}: bin.whole = false
2018-09-04Rename .test/test{} to .testscript/testscript{}Boris Kolpackov4-4/+4
2018-05-24Remove target/scope irregularity workaroundsBoris Kolpackov1-2/+1
2018-05-19Update copyright yearKaren Arutyunov8-8/+8
2018-05-19Get rid of doc{version} and types for testscript and manifest in buildfilesKaren Arutyunov4-4/+4
2018-05-03Regularize directory target/scope-specific variable assignment syntaxBoris Kolpackov5-3/+128
2017-12-16Redo string/stream representation of dir{} name/targetBoris Kolpackov1-8/+8
Now instead of: dir{foo/bar/} We get: foo/dir{bar/} Which feels more consistent with how we print other names/targets. That is, "directory bar/ in directory foo/" similar how foo/exe{bar} is "executable bar in directory foo/".
2017-11-20Add test for prerequisite-specific variablesBoris Kolpackov2-0/+76
2017-03-14Implement implied buildfile supportBoris Kolpackov1-5/+0
In essence, if the buildfile is: ./: */ Then it can be omitted entirely (provided there is at least one subdirectory).
2017-02-13Use variable_cache for target type/pattern-specific prepend/appendBoris Kolpackov3-0/+88
2016-12-01Move old tests to old-tests/Boris Kolpackov35-918/+0
2016-12-01Allow implicit (lexical) typed-to-typed conversionBoris Kolpackov1-3/+3
2016-11-23Implement value type propagation on expansionBoris Kolpackov1-3/+3
Currently, we only propagate types of sole, unquoted expansions (variable, function call, or eval context), similar to NULL. To untypify the value, simply quote it.
2016-11-04When assigning always ignore existing value typeBoris Kolpackov2-0/+5
For example: x = [uint64] 1 x = a # Ok.
2016-08-30Add support for using '*' as target type in variable assignmentBoris Kolpackov1-0/+6
So these three are equivalent: *: foo = 1 {*}: foo = 2 *{*}: foo = 3
2016-07-28Adjust to new path implementation, use to support reversibilityBoris Kolpackov5-0/+77
2016-07-22Change default var override from 'projects and subprojects' to amalgamationBoris Kolpackov2-0/+11
The 'projects and subprojects' semantics resulted in some counter-intuitive behavior. For example, in a project with tests/ as a subproject if one builds one of the tests directly with a non-global override (say C++ compiler), then the main project would be built without the overrides. I this light, overriding in the whole amalgamation seems like the right thing to do. The old behavior can still be obtained with scope qualification, for example: b ./:foo=bar
2016-07-16Add support for prepend/append in target type/pattern-specific varsBoris Kolpackov3-0/+69
Semantically, these are similar to variable overrides and are essentially treated as "templates" that are applied on lookup to the "stem" value that is specific to the target type/name. For example: x = [string] a file{f*}: x =+ b sub/: { file{*}: x += c print $(file{foo}:x) # abc print $(file{bar}:x) # ac }
2016-06-18Port to MinGWKaren Arutyunov6-9/+31
2016-04-21Fix legacy stuff in testsBoris Kolpackov1-1/+0
2016-04-18Add support for using value attributes in eval contextBoris Kolpackov2-3/+3
For example: if ($x == [null]) Or: if ([uint64] 01 == [uint64] 1)
2016-04-12Add support for scope-qualification of overrides, scope visibilityBoris Kolpackov1-2/+42
2016-04-06Test and fix override logicBoris Kolpackov7-0/+366
2016-04-05Add support for scope/target-qualified variable expansionBoris Kolpackov3-0/+42
For example: print $(dir/:var) print $(file{target}:var) print $(dir/file{target}:var) Note that if the scope/target does not (yet) exists, it will be created.
2016-04-04Implement value typing, null support via value attributesBoris Kolpackov5-4/+104
For example: v = [null] v = [string] abc v += ABC # abcABC
2016-04-02Implement variable typing (via attributes)Boris Kolpackov3-0/+26
Now we can do: [string] str = foo
2016-03-31Set part of variable override implementationBoris Kolpackov2-2/+2
2016-03-28Add support for pair representation reversibilityBoris Kolpackov2-0/+16
2015-12-14Add support for variable prepend operator: =+Boris Kolpackov3-0/+21
2015-11-30Implement target type/pattern-specific variablesBoris Kolpackov1-0/+33
For example: cxx{*-options}: dist = true 1. Only single '*' wildcard is supported, matches 0 or more characters. 2. If target type is not specified, it defaults to any target. 3. Appending (+=) is not allowed. 4. The value is expanded immediately in the context of the scope. 5. The more specific pattern (i.e., with the shortest "stem") is preferred. If the stem has the same length, then the last defined (but not redefined) pattern is used. This will probably have to change to become an error. See tests/variable/type-pattern for more examples.
2015-09-09Add support for evaluation contextBoris Kolpackov3-0/+35
For now it acts as just the value mode that can be enabled anywhere variable expansion is supported, for example: (foo=bar): And the primary use currently is to enable/test quoted and indirect variable expansion: "foo bar" = FOO BAR print $"foo bar" # Invalid. print $("foo bar") # Yeah, baby. foo = FOO FOO = foo print $($foo) Not that you should do something like this...
2015-08-24Only treat name as directory if it is reversibleBoris Kolpackov2-0/+12
2015-08-24Add support for reversing project qualification to string valueBoris Kolpackov4-0/+38