Commit a9bfa5b4 authored by tfarina's avatar tfarina Committed by Commit bot

gn: Allow users to set 'check_includes' in action_foreach().

Otherwise if someone tries to set it now it will get something like:

$ gn gen --args='os="android" cpu_arch="arm"' out_gn_android/Debug
ERROR at //build/config/android/rules.gni:49:22: Assignment had no
effect.
    check_includes = false
                         ^----
You set the variable "check_includes" here and it was unused before it went out of scope.
See //content/test/BUILD.gn:237:5: whence it was called.
generate_jni("jni") {
   ^--------------------

BUG=367595, 376000
TEST=see above
R=brettw@chromium.org

Review URL: https://codereview.chromium.org/885283006

Cr-Commit-Position: refs/heads/master@{#314794}
parent 73b05bf9
...@@ -54,6 +54,9 @@ void ActionTargetGenerator::DoRun() { ...@@ -54,6 +54,9 @@ void ActionTargetGenerator::DoRun() {
if (!FillDepfile()) if (!FillDepfile())
return; return;
if (!FillCheckIncludes())
return;
if (!CheckOutputs()) if (!CheckOutputs())
return; return;
......
...@@ -63,16 +63,6 @@ void BinaryTargetGenerator::DoRun() { ...@@ -63,16 +63,6 @@ void BinaryTargetGenerator::DoRun() {
return; return;
} }
bool BinaryTargetGenerator::FillCheckIncludes() {
const Value* value = scope_->GetValue(variables::kCheckIncludes, true);
if (!value)
return true;
if (!value->VerifyTypeIs(Value::BOOLEAN, err_))
return false;
target_->set_check_includes(value->boolean_value());
return true;
}
bool BinaryTargetGenerator::FillCompleteStaticLib() { bool BinaryTargetGenerator::FillCompleteStaticLib() {
if (target_->output_type() == Target::STATIC_LIBRARY) { if (target_->output_type() == Target::STATIC_LIBRARY) {
const Value* value = scope_->GetValue(variables::kCompleteStaticLib, true); const Value* value = scope_->GetValue(variables::kCompleteStaticLib, true);
......
...@@ -23,7 +23,6 @@ class BinaryTargetGenerator : public TargetGenerator { ...@@ -23,7 +23,6 @@ class BinaryTargetGenerator : public TargetGenerator {
void DoRun() override; void DoRun() override;
private: private:
bool FillCheckIncludes();
bool FillCompleteStaticLib(); bool FillCompleteStaticLib();
bool FillOutputName(); bool FillOutputName();
bool FillOutputExtension(); bool FillOutputExtension();
......
...@@ -283,6 +283,16 @@ bool TargetGenerator::FillOutputs(bool allow_substitutions) { ...@@ -283,6 +283,16 @@ bool TargetGenerator::FillOutputs(bool allow_substitutions) {
return true; return true;
} }
bool TargetGenerator::FillCheckIncludes() {
const Value* value = scope_->GetValue(variables::kCheckIncludes, true);
if (!value)
return true;
if (!value->VerifyTypeIs(Value::BOOLEAN, err_))
return false;
target_->set_check_includes(value->boolean_value());
return true;
}
bool TargetGenerator::EnsureSubstitutionIsInOutputDir( bool TargetGenerator::EnsureSubstitutionIsInOutputDir(
const SubstitutionPattern& pattern, const SubstitutionPattern& pattern,
const Value& original_value) { const Value& original_value) {
......
...@@ -53,6 +53,7 @@ class TargetGenerator { ...@@ -53,6 +53,7 @@ class TargetGenerator {
bool FillInputs(); bool FillInputs();
bool FillConfigs(); bool FillConfigs();
bool FillOutputs(bool allow_substitutions); bool FillOutputs(bool allow_substitutions);
bool FillCheckIncludes();
// Rrturns true if the given pattern will expand to a file in the output // Rrturns true if the given pattern will expand to a file in the output
// directory. If not, returns false and sets the error, blaming the given // directory. If not, returns false and sets the error, blaming the given
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment