|
Improve GN handling of directory templates.
The previous implementation of the directory-based file templates (like {{source_out_dir}}}) was overly simplistic. It did not allow these templates to be used in the outputs section of a target since the directories were relative to the build directory (it was only useful for actions).
This new implementation changes the expansion of these values depending on where they're used, so they can be absolute when used in the outputs section, but relative to the build directory when used in the args section.
The implementation of outputs was changed to allow the use of these expansions. The previous implementation stored them as SourceFiles which didn't allow the use of directory expansions, since that happens after converting the input to a SourceFile. This new patch stores the outputs as a list of strings to allow this to be late-bound properly (and it turns out that almost all users of this wanted the strings anyway).
Changes the function that checks that files are in the output directory to optionally handle templates. Adds a test for this function.
Fixes a bug in get_target_outputs that it didn't work for copy() targets that contained templates. Fix this and add a test.
BUG=
R=viettrungluu@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=282639
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+346 lines, -169 lines) |
Patch |
 |
M |
tools/gn/action_target_generator.cc
|
View
|
|
5 chunks |
+8 lines, -9 lines |
0 comments
|
Download
|
 |
M |
tools/gn/action_values.h
|
View
|
|
2 chunks |
+5 lines, -6 lines |
0 comments
|
Download
|
 |
M |
tools/gn/command_desc.cc
|
View
|
|
3 chunks |
+25 lines, -9 lines |
0 comments
|
Download
|
 |
M |
tools/gn/file_template.h
|
View
|
|
6 chunks |
+30 lines, -8 lines |
0 comments
|
Download
|
 |
M |
tools/gn/file_template.cc
|
View
|
|
11 chunks |
+81 lines, -44 lines |
0 comments
|
Download
|
 |
M |
tools/gn/file_template_unittest.cc
|
View
|
|
6 chunks |
+61 lines, -24 lines |
0 comments
|
Download
|
 |
M |
tools/gn/filesystem_utils.h
|
View
|
|
1 chunk |
+5 lines, -0 lines |
0 comments
|
Download
|
 |
M |
tools/gn/filesystem_utils.cc
|
View
|
|
2 chunks |
+18 lines, -12 lines |
0 comments
|
Download
|
 |
M |
tools/gn/filesystem_utils_unittest.cc
|
View
|
|
1 chunk |
+44 lines, -0 lines |
0 comments
|
Download
|
 |
M |
tools/gn/function_get_target_outputs.cc
|
View
|
|
1 chunk |
+8 lines, -7 lines |
0 comments
|
Download
|
 |
M |
tools/gn/function_get_target_outputs_unittest.cc
|
View
|
|
2 chunks |
+19 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tools/gn/function_process_file_template.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
tools/gn/function_write_file.cc
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_action_target_writer.cc
|
View
|
|
6 chunks |
+17 lines, -8 lines |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_action_target_writer_unittest.cc
|
View
|
|
5 chunks |
+9 lines, -8 lines |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_copy_target_writer.cc
|
View
|
|
2 chunks |
+6 lines, -2 lines |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_copy_target_writer_unittest.cc
|
View
|
|
2 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_target_writer.h
|
View
|
|
1 chunk |
+0 lines, -6 lines |
0 comments
|
Download
|
 |
M |
tools/gn/ninja_target_writer.cc
|
View
|
|
1 chunk |
+0 lines, -12 lines |
0 comments
|
Download
|
 |
M |
tools/gn/target_generator.cc
|
View
|
|
1 chunk |
+5 lines, -5 lines |
0 comments
|
Download
|
Total messages: 3 (0 generated)
|