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

Unified Diff: tools/gn/scope_per_file_provider.cc

Issue 23606031: GN: Use build directory for CD for scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/scope_per_file_provider.h ('k') | tools/gn/scope_per_file_provider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/scope_per_file_provider.cc
diff --git a/tools/gn/scope_per_file_provider.cc b/tools/gn/scope_per_file_provider.cc
index 28f7e7994ed56500daedb84e4c6eadd7ed909ca5..60c03d0f4e2ac30ded8b236dd4c3196d5fe2e490 100644
--- a/tools/gn/scope_per_file_provider.cc
+++ b/tools/gn/scope_per_file_provider.cc
@@ -27,22 +27,14 @@ const Value* ScopePerFileProvider::GetProgrammaticValue(
if (ident == variables::kPythonPath)
return GetPythonPath();
- if (ident == variables::kRelativeBuildToSourceRootDir)
- return GetRelativeBuildToSourceRootDir();
- if (ident == variables::kRelativeRootOutputDir)
- return GetRelativeRootOutputDir();
- if (ident == variables::kRelativeRootGenDir)
- return GetRelativeRootGenDir();
- if (ident == variables::kRelativeSourceRootDir)
- return GetRelativeSourceRootDir();
- if (ident == variables::kRelativeTargetOutputDir)
- return GetRelativeTargetOutputDir();
- if (ident == variables::kRelativeTargetGenDir)
- return GetRelativeTargetGenDir();
if (ident == variables::kRootGenDir)
return GetRootGenDir();
+ if (ident == variables::kRootOutDir)
+ return GetRootOutDir();
if (ident == variables::kTargetGenDir)
return GetTargetGenDir();
+ if (ident == variables::kTargetOutDir)
+ return GetTargetOutDir();
return NULL;
}
@@ -73,62 +65,6 @@ const Value* ScopePerFileProvider::GetPythonPath() {
return python_path_.get();
}
-const Value* ScopePerFileProvider::GetRelativeBuildToSourceRootDir() {
- if (!relative_build_to_source_root_dir_) {
- const SourceDir& build_dir =
- scope_->settings()->build_settings()->build_dir();
- relative_build_to_source_root_dir_.reset(
- new Value(NULL, InvertDirWithNoLastSlash(build_dir)));
- }
- return relative_build_to_source_root_dir_.get();
-}
-
-const Value* ScopePerFileProvider::GetRelativeRootOutputDir() {
- if (!relative_root_output_dir_) {
- relative_root_output_dir_.reset(new Value(NULL,
- GetRelativeRootWithNoLastSlash() +
- GetRootOutputDirWithNoLastSlash(scope_->settings())));
- }
- return relative_root_output_dir_.get();
-}
-
-const Value* ScopePerFileProvider::GetRelativeRootGenDir() {
- if (!relative_root_gen_dir_) {
- relative_root_gen_dir_.reset(new Value(NULL,
- GetRelativeRootWithNoLastSlash() +
- GetRootGenDirWithNoLastSlash(scope_->settings())));
- }
- return relative_root_gen_dir_.get();
-}
-
-const Value* ScopePerFileProvider::GetRelativeSourceRootDir() {
- if (!relative_source_root_dir_) {
- relative_source_root_dir_.reset(new Value(NULL,
- GetRelativeRootWithNoLastSlash()));
- }
- return relative_source_root_dir_.get();
-}
-
-const Value* ScopePerFileProvider::GetRelativeTargetOutputDir() {
- if (!relative_target_output_dir_) {
- relative_target_output_dir_.reset(new Value(NULL,
- GetRelativeRootWithNoLastSlash() +
- GetRootOutputDirWithNoLastSlash(scope_->settings()) + "/obj" +
- GetFileDirWithNoLastSlash()));
- }
- return relative_target_output_dir_.get();
-}
-
-const Value* ScopePerFileProvider::GetRelativeTargetGenDir() {
- if (!relative_target_gen_dir_) {
- relative_target_gen_dir_.reset(new Value(NULL,
- GetRelativeRootWithNoLastSlash() +
- GetRootGenDirWithNoLastSlash(scope_->settings()) +
- GetFileDirWithNoLastSlash()));
- }
- return relative_target_gen_dir_.get();
-}
-
const Value* ScopePerFileProvider::GetRootGenDir() {
if (!root_gen_dir_) {
root_gen_dir_.reset(new Value(NULL,
@@ -137,6 +73,14 @@ const Value* ScopePerFileProvider::GetRootGenDir() {
return root_gen_dir_.get();
}
+const Value* ScopePerFileProvider::GetRootOutDir() {
+ if (!root_out_dir_) {
+ root_out_dir_.reset(new Value(NULL,
+ "/" + GetRootOutputDirWithNoLastSlash(scope_->settings())));
+ }
+ return root_out_dir_.get();
+}
+
const Value* ScopePerFileProvider::GetTargetGenDir() {
if (!target_gen_dir_) {
target_gen_dir_.reset(new Value(NULL,
@@ -147,6 +91,16 @@ const Value* ScopePerFileProvider::GetTargetGenDir() {
return target_gen_dir_.get();
}
+const Value* ScopePerFileProvider::GetTargetOutDir() {
+ if (!target_out_dir_) {
+ target_out_dir_.reset(new Value(NULL,
+ "/" +
+ GetRootOutputDirWithNoLastSlash(scope_->settings()) + "/obj" +
+ GetFileDirWithNoLastSlash()));
+ }
+ return target_out_dir_.get();
+}
+
// static
std::string ScopePerFileProvider::GetRootOutputDirWithNoLastSlash(
const Settings* settings) {
@@ -173,16 +127,3 @@ std::string ScopePerFileProvider::GetFileDirWithNoLastSlash() const {
dir_value[dir_value.size() - 1] == '/');
return dir_value.substr(1, dir_value.size() - 2);
}
-
-std::string ScopePerFileProvider::GetRelativeRootWithNoLastSlash() const {
- return InvertDirWithNoLastSlash(scope_->GetSourceDir());
-}
-
-// static
-std::string ScopePerFileProvider::InvertDirWithNoLastSlash(
- const SourceDir& dir) {
- std::string inverted = InvertDir(dir);
- if (inverted.empty())
- return ".";
- return inverted.substr(0, inverted.size() - 1);
-}
« no previous file with comments | « tools/gn/scope_per_file_provider.h ('k') | tools/gn/scope_per_file_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698