6 #include <system_error>
8 #include "flutter/fml/backtrace.h"
9 #include "flutter/fml/command_line.h"
10 #include "flutter/fml/file.h"
11 #include "flutter/fml/mapping.h"
32 return reflector_options;
38 std::shared_ptr<fml::Mapping> source_file_mapping,
47 Compiler(std::move(source_file_mapping), options, sksl_reflector_options);
49 std::cerr <<
"Compilation to SkSL failed." << std::endl;
58 const std::shared_ptr<fml::Mapping>& source_file_mapping) {
59 FML_DCHECK(switches.
iplr);
62 std::shared_ptr<RuntimeStageData::Shader> sksl_shader;
64 sksl_shader =
CompileSkSL(source_file_mapping, switches);
82 Compiler compiler(source_file_mapping, options, reflector_options);
84 std::cerr <<
"Compilation failed." << std::endl;
90 if (reflector ==
nullptr) {
91 std::cerr <<
"Could not create reflector." << std::endl;
97 std::cerr <<
"Runtime stage information was nil." << std::endl;
106 if (!stage_data_mapping) {
107 std::cerr <<
"Runtime stage data could not be created." << std::endl;
114 std::cerr <<
"Could not write file to " << switches.
sl_file_name
132 auto sl_file_name = std::filesystem::absolute(
133 std::filesystem::current_path() / switches.
sl_file_name);
137 std::cerr <<
"Could not write file to " << switches.
sl_file_name
154 auto reflection_json_name = std::filesystem::absolute(
156 if (!fml::WriteAtomically(
160 std::cerr <<
"Could not write reflection json to "
167 auto reflection_header_name =
168 std::filesystem::absolute(std::filesystem::current_path() /
170 if (!fml::WriteAtomically(
174 std::cerr <<
"Could not write reflection header to "
181 auto reflection_cc_name =
182 std::filesystem::absolute(std::filesystem::current_path() /
187 std::cerr <<
"Could not write reflection CC to "
202 std::string result_file;
219 auto depfile_path = std::filesystem::absolute(
220 std::filesystem::current_path() / switches.
depfile_path.c_str());
224 std::cerr <<
"Could not write depfile to " << switches.
depfile_path
233 bool Main(
const fml::CommandLine& command_line) {
234 fml::InstallCrashHandler();
235 if (command_line.HasOption(
"help")) {
241 if (!switches.
AreValid(std::cerr)) {
242 std::cerr <<
"Invalid flags specified." << std::endl;
253 std::shared_ptr<fml::FileMapping> source_file_mapping =
255 if (!source_file_mapping) {
256 std::cerr <<
"Could not open input file." << std::endl;
260 if (switches.
iplr && !
OutputIPLR(switches, source_file_mapping)) {
277 Compiler compiler(source_file_mapping, options, reflector_options);
279 std::cerr <<
"Compilation failed." << std::endl;
284 auto spriv_file_name = std::filesystem::absolute(
312 int main(
int argc,
char const* argv[]) {
314 fml::CommandLineFromPlatformOrArgcArgv(argc, argv))