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

Side by Side Diff: mojo/dart/embedder/snapshotter/main.cc

Issue 1607613007: Regenerate .mojo file if any dependent .dart sources change (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | mojo/public/dart/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <iostream> 5 #include <iostream>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 void WriteDepfile(base::FilePath path, 76 void WriteDepfile(base::FilePath path,
77 const std::string& build_output, 77 const std::string& build_output,
78 const std::set<std::string>& deps) { 78 const std::set<std::string>& deps) {
79 base::FilePath current_directory; 79 base::FilePath current_directory;
80 CHECK(base::GetCurrentDirectory(&current_directory)); 80 CHECK(base::GetCurrentDirectory(&current_directory));
81 std::string output = build_output + ":"; 81 std::string output = build_output + ":";
82 for (const auto& i : deps) { 82 for (const auto& i : deps) {
83 output += " "; 83 output += " ";
84 output += current_directory.Append(i).MaybeAsASCII(); 84 base::FilePath file = base::FilePath(i);
85 if (!file.IsAbsolute()) {
86 file = current_directory.Append(i);
87 }
88 base::FilePath resolved_file;
89 if (!ReadSymbolicLink(file, &resolved_file)) {
90 // Not a symbolic link.
91 resolved_file = file;
92 }
93 output += resolved_file.MaybeAsASCII();
85 } 94 }
86 const char* data = output.c_str(); 95 const char* data = output.c_str();
87 const intptr_t data_length = output.size(); 96 const intptr_t data_length = output.size();
88 CHECK_EQ(base::WriteFile(path, data, data_length), data_length); 97 CHECK_EQ(base::WriteFile(path, data, data_length), data_length);
89 } 98 }
90 99
91 int main(int argc, const char* argv[]) { 100 int main(int argc, const char* argv[]) {
92 base::AtExitManager exit_manager; 101 base::AtExitManager exit_manager;
93 base::EnableTerminationOnHeapCorruption(); 102 base::EnableTerminationOnHeapCorruption();
94 base::CommandLine::Init(argc, argv); 103 base::CommandLine::Init(argc, argv);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 CHECK(command_line.HasSwitch(kBuildOutput)) << 151 CHECK(command_line.HasSwitch(kBuildOutput)) <<
143 "Need --build-output with --depfile"; 152 "Need --build-output with --depfile";
144 // Write depfile. 153 // Write depfile.
145 WriteDepfile(command_line.GetSwitchValuePath(kDepfile), 154 WriteDepfile(command_line.GetSwitchValuePath(kDepfile),
146 command_line.GetSwitchValueASCII(kBuildOutput), 155 command_line.GetSwitchValueASCII(kBuildOutput),
147 library_provider->deps()); 156 library_provider->deps());
148 } 157 }
149 158
150 return 0; 159 return 0;
151 } 160 }
OLDNEW
« no previous file with comments | « no previous file | mojo/public/dart/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698