-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dedicated integration tests for using DWYU inside a custom rule
- Loading branch information
Showing
16 changed files
with
99 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
The aspect can analyze either solely the targets is being executed on or it can analyze the whole dependency tree. | ||
|
||
One can use a rule to perform the aspect analysis as part of a normal build. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
load("//test/aspect/rule_using_aspect:rule.bzl", "dwyu_rule_direct", "dwyu_rule_recursive", "dwyu_rule_recursive_with_impl_deps") | ||
|
||
dwyu_rule_direct( | ||
name = "dwyu_direct_main", | ||
deps = [":main"], | ||
) | ||
|
||
dwyu_rule_recursive( | ||
name = "dwyu_recursive_main", | ||
deps = [":main"], | ||
) | ||
|
||
dwyu_rule_recursive_with_impl_deps( | ||
name = "dwyu_recursive_with_impl_deps", | ||
deps = [":use_impl_deps"], | ||
) | ||
|
||
## | ||
## Support Targets | ||
## | ||
|
||
cc_binary( | ||
name = "main", | ||
srcs = ["main.cpp"], | ||
deps = [":a"], | ||
) | ||
|
||
cc_library( | ||
name = "a", | ||
hdrs = ["a.h"], | ||
deps = [":b"], | ||
) | ||
|
||
cc_library( | ||
name = "b", | ||
hdrs = ["b.h"], | ||
deps = [ | ||
":c", # unused dependency | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "c", | ||
hdrs = ["c.h"], | ||
) | ||
|
||
cc_library( | ||
name = "use_impl_deps", | ||
srcs = ["use_impl_deps.cpp"], | ||
implementation_deps = [":a"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
One can create a rule which executes the DWYU aspect as part of a normal build ond specific targets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef A_H | ||
#define A_H | ||
|
||
#include "test/aspect/rule_using_aspect/b.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load("//:defs.bzl", "dwyu_aspect_factory") | ||
|
||
dwyu_recursive = dwyu_aspect_factory(recursive = True) | ||
dwyu_recursive_impl_deps = dwyu_aspect_factory(recursive = True, use_implementation_deps = True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef B_H | ||
#define B_H | ||
|
||
// Do nothing | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef C_H | ||
#define C_H | ||
|
||
// Do nothing | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "test/aspect/rule_using_aspect/a.h" | ||
|
||
int main() { | ||
return 0; | ||
} |
2 changes: 1 addition & 1 deletion
2
test/aspect/recursion/rule.bzl → test/aspect/rule_using_aspect/rule.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "test/aspect/rule_using_aspect/a.h" | ||
|
||
int doSth() { | ||
return 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters