aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.cxx
AgeCommit message (Collapse)AuthorFilesLines
2019-03-14Add support for multiple variable overridesBoris Kolpackov1-10/+10
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-01-16Update copyright yearKaren Arutyunov1-1/+1
2018-08-27Use butl::path_match() for pattern-specific variable matchingBoris Kolpackov1-25/+10
2018-07-30Make project variable to be of project_name typeKaren Arutyunov1-2/+51
2018-06-28Add prerequisite variable visibility specification/enforcementBoris Kolpackov1-0/+19
2018-06-20Add $process.run() and $process.run_regex() functionsBoris Kolpackov1-1/+33
$process.run(<prog>[ <args>...]) Return trimmed stdout. $process.run_regex(<prog>[ <args>...], <pat> [, <fmt>]) Return stdout lines matched and optionally processed with regex. Each line of stdout (including the customary trailing blank) is matched (as a whole) against <pat> and, if successful, returned, optionally processed with <fmt>, as an element of a list.
2018-05-19Update copyright yearKaren Arutyunov1-1/+1
2018-02-03Get rid of action rule override semanticsBoris Kolpackov1-4/+11
Instead we now have two more or less separate match states for outer and inner parts of an action.
2018-01-05Add support for variable aliasesBoris Kolpackov1-26/+81
2017-12-13Implement info meta operationBoris Kolpackov1-0/+4
This meta operation can be used to print basic information (name, version, source/output roots, etc) for one or more projects.
2017-12-05Add support for first-access value typification during non-load phasesBoris Kolpackov1-25/+24
2017-12-05Minor value typification API changeBoris Kolpackov1-1/+1
2017-12-04Uninline variable_map::typify()Boris Kolpackov1-1/+1
2017-12-04Add cast_empty() for value castingBoris Kolpackov1-0/+6
2017-12-03Add few clarifying commentsBoris Kolpackov1-1/+1
2017-12-03Allow typification of variables and values across load generationsBoris Kolpackov1-23/+3
The original semantics turned out to be too restrictive. For example, the user may have specified the config.c variable on the command line that is only used by an imported project that is loaded in a subsequent generation. We are also relaxing it for values since conceptually the two feel the same. For a value the (hypothetical) example is a "common" variable set in a project root that is only queried in a subdirectory in a subsequent generation.
2017-11-09Add support for for-loopBoris Kolpackov1-2/+14
The semantics is similar to the C++11 range-based for: list = 1 2 3 for i: $list print $i Note that there is no scoping of any kind for the loop variable ('i' in the above example). See tests/loop/for.test for some examples/ideas. In the future the plan is to also support more general while-loop as well as break and continue.
2017-08-03Issue diagnostics instead of asserting on variable type/visibility changeBoris Kolpackov1-6/+8
2017-07-31Experimental (and probably broken) pkg-config generation supportBoris Kolpackov1-1/+1
2017-06-26Make path value type to be base for dir_pathKaren Arutyunov1-2/+7
2017-05-01Add hxx extension for headersKaren Arutyunov1-3/+3
2017-03-07Specify config.test.output variableBoris Kolpackov1-0/+78
2017-02-13Add MT-safe variable_cache, use for variable overridesBoris Kolpackov1-0/+3
2017-02-13Track variable value modificationsBoris Kolpackov1-13/+9
2017-02-13Allow back overriding variables specified in buildfilesBoris Kolpackov1-4/+10
It is still not clear whether this is the right thing to allow, conceptually, but with this disallowed it's hard to test this functionality. Perhaps we should have an attribute [overridable]. The problem is one will also have to set this variable to some value (e.g., [null]) which is not exactly the same as undefined (especially when testing).
2017-02-13Redo variable pattern-typing to match in more specific orderBoris Kolpackov1-12/+57
2017-02-13Add load generation to global variable_map valuesBoris Kolpackov1-20/+57
2017-02-13Add global flag to variable_mapBoris Kolpackov1-1/+1
2017-02-13Add notion of load phase generationBoris Kolpackov1-3/+9
2017-02-13Implement pattern-based variable typing, tighten variable type updateBoris Kolpackov1-54/+129
2017-02-13Add notion of phase, enforceBoris Kolpackov1-9/+38
2017-02-13Add model mutex, make var_pool const by defaultBoris Kolpackov1-3/+22
2017-01-06Store platform targets as typed target_tripletBoris Kolpackov1-0/+45
2017-01-05Update copyright yearBoris Kolpackov1-1/+1
2016-11-30Add support for typed/untyped concatenated expansionBoris Kolpackov1-42/+26
2016-11-23Implement value type propagation on expansionBoris Kolpackov1-5/+68
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-18Add function machinery, implement path.normalize()Boris Kolpackov1-32/+75
Note that multi-argument functions are not yet "callable" since there is no support for value packs.
2016-11-04Minor dependency cleanupBoris Kolpackov1-5/+0
2016-11-04Various design/implementation cleanupsBoris Kolpackov1-8/+15
2016-08-23Reverse empty simple values as an empty names sequence rather than empty nameBoris Kolpackov1-11/+16
This way we get: config.import.foo = Rather than: config.import.foo = {}
2016-08-23Don't complete empty abs_dir_pathBoris Kolpackov1-3/+6
The empty value is used as a special indicator
2016-08-22Cache process_path, use fallback search directory for binutilsBoris Kolpackov1-0/+98
2016-07-30Actualize project root directoriesBoris Kolpackov1-1/+1
This solves the problem of changing path spelling on platforms with case- insensitive filesystems. For example, you may build a project in the current working directory without specifying any paths. This means the current working directory will be used as the project's root. On Windows this could be C:\x. Now you are building another project that imports the above project and you specify config.import.x variable pointing to the above build. But you are lazy to type capital C so you spell it as config.import.x=c:\x. What happens now is the value from config.import.x is used as the project root. And now it is a different spelling compared to your original build. This is not a problem when the build system itself is concerned -- it is smart enough to use case-insensitive comparison. However, we often use roots to derive other things, say, -I options that we pass to compilers. And these options are normally no longer treated as (case-insensitive) paths. If they are hashed and the result stored in depdb, then we end up with rebuilds that are triggered by changes from C:\ to c:\.
2016-07-28Adjust to new path implementation, use to support reversibilityBoris Kolpackov1-13/+11
2016-07-20Switch to dynamic empty() implementation in variable valueBoris Kolpackov1-100/+69
The current model fell apart when we modified values directly.
2016-07-20Implement support for <, >, <=, >= in eval contextBoris Kolpackov1-0/+62
Now can write: if ($build.version > 30000)
2016-07-16Add support for prepend/append in target type/pattern-specific varsBoris Kolpackov1-11/+18
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-07-01Port to MSVCKaren Arutyunov1-8/+7
2016-06-28Work around static initialization order issueBoris Kolpackov1-7/+22
value_traits<T>::value_type initialization is not constexpr in VC because of pointers to function template instantiations (which apparently are not constexpr).
2016-06-27Add config.bin.target var/hint, use to decide libso{} install modeBoris Kolpackov1-1/+1
Normally the user doesn't need to specify config.bin.target explicitly since the cxx module will hint it. We now also have the whole set of target's components: bin.target.{cpu,vendor,system,version,class}