Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/gn/json_project_writer.cc

Issue 2363193002: Use WithoutPathExpansion on DictionaryValue in GN. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/desc_builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/json_project_writer.h" 5 #include "tools/gn/json_project_writer.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 auto description = 93 auto description =
94 DescBuilder::DescriptionForTarget(target, "", false, false, false); 94 DescBuilder::DescriptionForTarget(target, "", false, false, false);
95 // Outputs need to be asked for separately. 95 // Outputs need to be asked for separately.
96 auto outputs = DescBuilder::DescriptionForTarget(target, "source_outputs", 96 auto outputs = DescBuilder::DescriptionForTarget(target, "source_outputs",
97 false, false, false); 97 false, false, false);
98 base::DictionaryValue* outputs_value = nullptr; 98 base::DictionaryValue* outputs_value = nullptr;
99 if (outputs->GetDictionary("source_outputs", &outputs_value) && 99 if (outputs->GetDictionary("source_outputs", &outputs_value) &&
100 !outputs_value->empty()) { 100 !outputs_value->empty()) {
101 description->MergeDictionary(outputs.get()); 101 description->MergeDictionary(outputs.get());
102 } 102 }
103 targets->Set(target->label().GetUserVisibleName(default_toolchain_label), 103 targets->SetWithoutPathExpansion(
104 std::move(description)); 104 target->label().GetUserVisibleName(default_toolchain_label),
bungeman-chromium 2016/09/23 22:26:00 This 'Set' appears to be the one causing the issue
105 std::move(description));
105 } 106 }
106 107
107 auto settings = base::MakeUnique<base::DictionaryValue>(); 108 auto settings = base::MakeUnique<base::DictionaryValue>();
108 settings->SetString("root_path", build_settings->root_path_utf8()); 109 settings->SetStringWithoutPathExpansion("root_path",
109 settings->SetString("build_dir", build_settings->build_dir().value()); 110 build_settings->root_path_utf8());
110 settings->SetString("default_toolchain", 111 settings->SetStringWithoutPathExpansion("build_dir",
111 default_toolchain_label.GetUserVisibleName(false)); 112 build_settings->build_dir().value());
113 settings->SetStringWithoutPathExpansion(
114 "default_toolchain",
115 default_toolchain_label.GetUserVisibleName(false));
112 116
113 auto output = base::MakeUnique<base::DictionaryValue>(); 117 auto output = base::MakeUnique<base::DictionaryValue>();
114 output->Set("targets", std::move(targets)); 118 output->SetWithoutPathExpansion("targets", std::move(targets));
115 output->Set("build_settings", std::move(settings)); 119 output->SetWithoutPathExpansion("build_settings", std::move(settings));
116 120
117 std::string s; 121 std::string s;
118 base::JSONWriter::WriteWithOptions( 122 base::JSONWriter::WriteWithOptions(
119 *output.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &s); 123 *output.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &s);
120 return s; 124 return s;
121 } 125 }
122 126
123 bool InvokePython(const BuildSettings* build_settings, 127 bool InvokePython(const BuildSettings* build_settings,
124 const base::FilePath& python_script_path, 128 const base::FilePath& python_script_path,
125 const std::string& python_script_extra_args, 129 const std::string& python_script_extra_args,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 script_file = SourceFile(exec_script); 212 script_file = SourceFile(exec_script);
209 } 213 }
210 base::FilePath script_path = build_settings->GetFullPath(script_file); 214 base::FilePath script_path = build_settings->GetFullPath(script_file);
211 return InvokePython(build_settings, script_path, exec_script_extra_args, 215 return InvokePython(build_settings, script_path, exec_script_extra_args,
212 output_path, quiet, err); 216 output_path, quiet, err);
213 } 217 }
214 } 218 }
215 219
216 return true; 220 return true;
217 } 221 }
OLDNEW
« no previous file with comments | « tools/gn/desc_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698