aboutsummaryrefslogtreecommitdiff
path: root/func.cc
Commit message (Collapse)AuthorAgeFilesLines
* Pass a Loc into FindEmulator for better warningsDan Willemsen2017-02-221-4/+5
| | | | | | | | | | | | | | | Before this change, we'd only get a warning from FindEmulator, with no idea which makefile caused it: FindEmulator: find: `tests': No such file or directory With this change, we'll get a better idea of which line triggered that problem: cts/tests/tests/content/Android.mk:43: FindEmulator: find: `test': No such file or directory And it will be colorized like any other location-based warning with the previous patch if --color_warnings is turned on.
* Add --color_warnings to make warnings/errors like clangDan Willemsen2017-02-221-9/+8
| | | | | | | | | | This adds new (WARN|KATI_WARN|ERROR)_LOC log macro variants that take a location as the first argument, and will prefix that location information to the warning/error lines. When --color_warnings is enabled, it reformats them to have a standard warning:/error: infix, and adds colors in order to match the warnings/errors produced by clang.
* Merge pull request #97 from danw/file_funcDan Willemsen2016-10-041-0/+123
|\ | | | | Implement the `file` function to read and write files
| * Implement the `file` function to read and write filesDan Willemsen2016-10-031-0/+123
| | | | | | | | | | | | | | This allows us to do file reading and writing without $(shell). Besides being simpler, this also allows faster regen times, since we can just stat the files to be read, or directly write to the files that need to be written.
* | Optimize RunCommand by removing /bin/sh wrapper when possibleDan Willemsen2016-10-011-5/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | For every $(shell echo "test: $PATH") command, when SHELL is /bin/bash, we essentially run: (each arg wrapped in []) [/bin/sh] [-c] [/bin/bash -c "echo \"test: \$PATH\""] This is redundant, since we can just use SHELL, and then we don't need to do an extra level of shell escaping either. This change makes us run this instead: [/bin/bash] [-c] [echo "test: $PATH"] If SHELL is more complicated than an absolute path to a binary, then we'll fall back to /bin/sh. Using the benchmark introduced in the last change, this reduces a minimal RunCommand execution with a simple SHELL from 3.7ms to 1.3ms. For a more complex benchmark (though less normalized), for an AOSP Android build, this change shrinks the average time spent in $(shell) functions from 4.5ms to 3ms. Change-Id: I622116e33565e58bb123ee9e9bdd302616a6609c
* Don't ignore all date/echo commandsDan Willemsen2016-09-191-1/+3
| | | | | | | | | | | | | | | | | | echo commands may have side-effects (writing a file), or be testing a condition and echoing a different value. date commands may be part of a larger command as well. In any case, if the command changes, and would cause changes to the ninja file, then we want to regenerate the ninja file. Just whitelist `date +%s` for now, since Android uses that as its only build-time date source, and we don't want to rebuild the ninja file every time for that. Eventually, it should be removed, but that means removing all makefile choices on BUILD_NUMBER, since that depends on BUILD_DATETIME as well. In either case, the real value should never be inserted into the ninja file. Change-Id: I3b36c8b46f747c1b22a3faacf1fc34683faa9b70
* [C++] Fix $(join) for #76Shinichiro Hamaji2016-06-071-1/+6
|
* [C++] $(eval) stops when first character is '#'Stefan Becker2016-06-021-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | Regression when compared to GNU make behaviour. Test case: $ cat ../Makefile.comment-in-macro .PHONY: all define _rule # comment all: : endef $(eval $(_rule)) $ make -f Makefile.comment-in-macro : $ ckati --ninja --ninja_dir . --gen_all_targets -f Makefile.comment-in-macro *** No targets. Fixes https://github.com/google/kati/issues/74
* Always sort glob resultsShinichiro Hamaji2016-05-031-1/+0
| | | | | This fixes issue #69. GNU make 3 sorts both for include and $(wildcard) while GNU make 4 doesn't.
* [C++] Handle .POSIX at eval timeShinichiro Hamaji2016-04-271-1/+1
| | | | | .POSIX pseudo target should change the behavior of $(shell). This also implements .POSIX for ckati's non-ninja mode.
* [C++] Reduce unnecessary string allocationShinichiro Hamaji2016-04-271-2/+3
| | | | A minor follow-up of 167e1f750dfed276d50ad93ebf0ce0a1f6e6f9ac
* [C++] Store SHELL value in command resultStefan Becker2016-04-121-0/+1
| | | | | | | | | | | $(shell ...) command lines are executed using $(SHELL). We need to use the same shell during regeneration check instead of hard-coding /bin/sh or otherwise the results might be different when $(SHELL) is redefined in the makefile. Fixes https://github.com/google/kati/issues/53 Change-Id: I1f9809106f29f7e806324a82e2323a2f8df64b63
* [C++] Ignore white space around $(call) function nameStefan Becker2016-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regression when compared to GNU make behaviour. Test case: $ cat Makefile.call-func-name func = $(info called with '$(1)') test = $(call $(1),$(1)) $(call test,func) $(call test, func) $(call test,func ) $(call test, func ) $ make -f Makefile.call-func-name called with 'func' called with ' func' called with 'func ' called with ' func ' make: *** No targets. Stop. $ ckati -c --warn -f Makefile.call-func-name called with 'func' Makefile.call-func-name:5: *warning*: undefined user function: func Makefile.call-func-name:6: *warning*: undefined user function: func Makefile.call-func-name:5: *warning*: undefined user function: func *** No targets. Fixes https://github.com/google/kati/issues/49 Change-Id: I3d982cd8d6d9777034df64540c32846300cb72f2
* [C++] Associate global variables with Symbols directlyShinichiro Hamaji2016-02-221-6/+4
|
* [C++] Always use std::stable_sortShinichiro Hamaji2016-02-151-7/+2
| | | | | | It seems this is a fairly good choice even if we compare this against string-specific algorithms, probably because our strings are not usually very long.
* [C++] Use LCP merge sort for $(sort)Shinichiro Hamaji2016-02-121-2/+11
| | | | | | | | | | and use stable_sort on Mac. On Linux: LCPMS: 0.627s, sort: 3.37s, stable_sort: 1.79s, qsort: 1.95s On Mac: LCPMS: 1.583s, sort: 1.33s, stable_sort: 1.19s, qsort: 1.80s
* [C++] Reduce unnecessary Intern from CallFuncShinichiro Hamaji2016-02-081-8/+9
|
* Revert "[C++] Do not fail by $(shell) in functions for now"Shinichiro Hamaji2015-12-181-4/+3
| | | | This reverts commit 42ce87c381f6990db9c7ca525d51ff21c052a98d.
* [C++] Do not fail by $(shell) in functions for nowShinichiro Hamaji2015-12-051-3/+4
| | | | So that the previous change can be merged to AOSP right now.
* [C++] Explicitly disallow $(shell) in other make constructsShinichiro Hamaji2015-11-301-0/+10
|
* [C++] Add a warning for undefined user functionsShinichiro Hamaji2015-11-171-0/+4
|
* [C++] Add a fast path for $(eval) which starts with #Shinichiro Hamaji2015-11-171-0/+4
|
* [C++] Add --warn flag which produces extra warningsShinichiro Hamaji2015-11-171-0/+4
|
* Add --no_ignore_dirty flagColin Cross2015-11-121-5/+7
| | | | | | | | Android needs to ignore dirty files under out/ when deciding to rebuild, except for the soong-generated out/Android.mk. Add a --no_ignore_dirty flag to override the pattern provided in --ignore_dirty. Change-Id: I8810963f4dff07b51187868c7afedb10c6a4cb2e
* [C++] Fix a CHECK failureShinichiro Hamaji2015-11-071-1/+1
| | | | | Stats::Start could be recursively called. Also, measuring evaluation time of $(wildcard) parameters didn't make sense.
* [C++] Stop using realpath(1) to handle $(realpath) in recipeShinichiro Hamaji2015-10-081-1/+5
| | | | This should fix $(realpath) on Mac.
* [C++] Fix realpath implementation for multiple parametersShinichiro Hamaji2015-10-081-1/+1
|
* [C++] Fix a off-by-one error in StripShellCommentShinichiro Hamaji2015-10-051-1/+1
|
* Rename value.* and ast.* to expr.* and stmt.*, respectivelyShinichiro Hamaji2015-09-241-7/+7
|
* [C++] A global refactoring for command line flagsShinichiro Hamaji2015-09-091-2/+2
| | | | So we will be able to use the command line parser for sub-makes.
* [C++] Fix newlines in $(info/warning/error)Dan Willemsen2015-08-251-4/+4
| | | | Change-Id: Ia20a1ef563a6871ed843b9388fe27e87b8bd7020
* [C++] Fix warnings for clangShinichiro Hamaji2015-08-171-8/+5
|
* [C++] Remove all shared_ptr<string>Shinichiro Hamaji2015-08-141-127/+128
|
* [C++] Stop using shared_ptr<string> in SimpleVarShinichiro Hamaji2015-08-141-3/+3
|
* [C++] Store command results with no outputShinichiro Hamaji2015-08-131-1/+14
| | | | | Instead, we stop storing results of commands which are specified by --ignore_dirty
* [C++] Run most $(shell) to check if regeneration is necessaryShinichiro Hamaji2015-08-131-15/+9
|
* [C++] Fix automatic variables in nested $(callDan Willemsen2015-08-071-4/+17
| | | | | | | An omitted argument should be blank, even if it's nested inside another call statement that did have that argument passed. Android uses missing arguments as defaults in many places.
* Merge pull request #16 from danw/unsorted_findShinichiro Hamaji2015-08-061-12/+4
|\ | | | | [C++] Don't sort find/ls results
| * [C++] Don't sort find/ls resultsDan Willemsen2015-08-051-12/+4
| | | | | | | | | | | | | | | | | | | | These should only be sorted if explicitly requested, otherwise make-built binaries may be different from kati-built binaries. This resolves some binary-diff issues for Android between libc.a built with make vs kati/ninja. To be the same across multiple checkouts/machines, we should probably switch android to sorting these results, but then the kati ninja support will stop working.
* | [C++] Add findleaves support to FindEmulatorShinichiro Hamaji2015-08-061-0/+1
|/
* [C++] Re-generate ninja file when a file is added/removedShinichiro Hamaji2015-08-041-39/+61
| | | | | | | | | With this change, we store the results of file list related commands in .kati_stamp. If one of them has been changed, we re-generate ninja file. Currently, this check is slow. We need to check the timestamp of directories first like what we are doing for $(wildcard).
* [C++] Fix comment_in_command.mkShinichiro Hamaji2015-07-291-1/+55
|
* [C++] Fix realpath.mk for ninjaShinichiro Hamaji2015-07-281-1/+3
|
* [C++] Fix info, warning, and error for ninjaShinichiro Hamaji2015-07-281-6/+9
|
* [C++] Run $(wildcard) at generation time, not ninja timeShinichiro Hamaji2015-07-281-7/+2
| | | | Also add a test case to wildcard_cache.mk
* [C++] support function variables beyond $9Colin Cross2015-07-271-2/+10
| | | | | | Functions can take more than 9 arguments. Use StringPrintf to create the temporary variable names for arguments beyond $9.
* [C++] Evaluate "echo $((XXX))" at generation timeShinichiro Hamaji2015-07-171-1/+15
| | | | ./runtest.rb -c -n testcase/shell_arith_in_recipe.mk
* [C++] Fix $(subst) with an empty patternShinichiro Hamaji2015-07-061-0/+5
|
* [C++] Fix wildcard_cache.mkShinichiro Hamaji2015-07-051-16/+4
|
* [C++] Fix shell_var.mkShinichiro Hamaji2015-07-051-59/+3
|