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

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

Issue 1827103005: [GN] Add support for generating Xcode projects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comment about "assert(product_type != "")" Created 4 years, 7 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/commands.cc ('k') | tools/gn/functions_target.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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/create_bundle_target_generator.h" 5 #include "tools/gn/create_bundle_target_generator.h"
6 6
7 #include "tools/gn/filesystem_utils.h" 7 #include "tools/gn/filesystem_utils.h"
8 #include "tools/gn/parse_tree.h" 8 #include "tools/gn/parse_tree.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 #include "tools/gn/substitution_type.h" 10 #include "tools/gn/substitution_type.h"
(...skipping 23 matching lines...) Expand all
34 &bundle_data.resources_dir())) 34 &bundle_data.resources_dir()))
35 return; 35 return;
36 if (!GetBundleDir(bundle_data.root_dir(), 36 if (!GetBundleDir(bundle_data.root_dir(),
37 variables::kBundleExecutableDir, 37 variables::kBundleExecutableDir,
38 &bundle_data.executable_dir())) 38 &bundle_data.executable_dir()))
39 return; 39 return;
40 if (!GetBundleDir(bundle_data.root_dir(), 40 if (!GetBundleDir(bundle_data.root_dir(),
41 variables::kBundlePlugInsDir, 41 variables::kBundlePlugInsDir,
42 &bundle_data.plugins_dir())) 42 &bundle_data.plugins_dir()))
43 return; 43 return;
44
45 const Value* value = scope_->GetValue(variables::kProductType, true);
46 if (value) {
47 if (!value->VerifyTypeIs(Value::STRING, err_))
48 return;
49
50 bundle_data.product_type().assign(value->string_value());
51 }
44 } 52 }
45 53
46 bool CreateBundleTargetGenerator::GetBundleDir( 54 bool CreateBundleTargetGenerator::GetBundleDir(
47 const SourceDir& bundle_root_dir, 55 const SourceDir& bundle_root_dir,
48 const base::StringPiece& name, 56 const base::StringPiece& name,
49 SourceDir* bundle_dir) { 57 SourceDir* bundle_dir) {
50 const Value* value = scope_->GetValue(name, true); 58 const Value* value = scope_->GetValue(name, true);
51 if (!value) 59 if (!value)
52 return true; 60 return true;
53 if (!value->VerifyTypeIs(Value::STRING, err_)) 61 if (!value->VerifyTypeIs(Value::STRING, err_))
54 return false; 62 return false;
55 std::string str = value->string_value(); 63 std::string str = value->string_value();
64 if (!str.empty() && str[str.size() - 1] != '/')
65 str.push_back('/');
56 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), str, 66 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), str,
57 value->origin(), err_)) 67 value->origin(), err_))
58 return false; 68 return false;
59 if (str != bundle_root_dir.value() && 69 if (str != bundle_root_dir.value() &&
60 !IsStringInOutputDir(bundle_root_dir, str)) { 70 !IsStringInOutputDir(bundle_root_dir, str)) {
61 *err_ = Err(value->origin(), "Path is not in bundle root dir.", 71 *err_ = Err(value->origin(), "Path is not in bundle root dir.",
62 "The given file should be in the bundle root directory or below.\n" 72 "The given file should be in the bundle root directory or below.\n"
63 "Normally you would do \"$bundle_root_dir/foo\". I interpreted this\n" 73 "Normally you would do \"$bundle_root_dir/foo\". I interpreted this\n"
64 "as \"" + str + "\"."); 74 "as \"" + str + "\".");
65 return false; 75 return false;
66 } 76 }
67 bundle_dir->SwapValue(&str); 77 bundle_dir->SwapValue(&str);
68 return true; 78 return true;
69 } 79 }
OLDNEW
« no previous file with comments | « tools/gn/commands.cc ('k') | tools/gn/functions_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698