diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-03 17:16:11 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-03 17:16:11 +0000 |
commit | 6a0f2776a2d726b6f903ef7d82a482f5db1a3a56 (patch) | |
tree | 42f1842dc210a224b22a33c82f235bab00a5c474 /tools/gn/path_output_unittest.cc | |
parent | d86c06c97a9736a4f852e8e7321f36a4bab1560d (diff) | |
download | chromium_src-6a0f2776a2d726b6f903ef7d82a482f5db1a3a56.zip chromium_src-6a0f2776a2d726b6f903ef7d82a482f5db1a3a56.tar.gz chromium_src-6a0f2776a2d726b6f903ef7d82a482f5db1a3a56.tar.bz2 |
Some fixes for the GYP subcommand of GN
This adds support for writing shorter paths if an output file is inside the output directory (previously we'd write "../../out/Debug/foo" when we could just write "foo"). Fixing this was necessary because we need to match GYP's input/output files exactly and GYP does this. I also fixed a buf with outputting root dirs not ending with a slash, and added an assertion that the output isn't system-absolute (since the code doesn't handle this yet).
The GYP integration didn't work due to slashes being different on Windows, so I convert them whem I read GYP's ninja file. I also deal with Windows lineendings.
Some buildfile fixes for GYP compatibility, and the previous patch had the wrong name for LASTCHANGE.
I changed the default to a non-component build since this is the GYP default. They both need to agree about this.
BUG=
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/25058007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/path_output_unittest.cc')
-rw-r--r-- | tools/gn/path_output_unittest.cc | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tools/gn/path_output_unittest.cc b/tools/gn/path_output_unittest.cc index 5133b79..49f29c9 100644 --- a/tools/gn/path_output_unittest.cc +++ b/tools/gn/path_output_unittest.cc @@ -24,6 +24,14 @@ TEST(PathOutput, Basic) { writer.WriteFile(out, SourceFile("//foo.cc")); EXPECT_EQ("../../foo.cc", out.str()); } + { + // Files in the output dir. + std::ostringstream out; + writer.WriteFile(out, SourceFile("//out/Debug/foo.cc")); + out << " "; + writer.WriteFile(out, SourceFile("//out/Debug/bar/baz.cc")); + EXPECT_EQ("foo.cc bar/baz.cc", out.str()); + } #if defined(OS_WIN) { // System-absolute path. @@ -170,9 +178,41 @@ TEST(PathOutput, WriteDir) { { std::ostringstream out; writer.WriteDir(out, SourceDir("/"), - PathOutput::DIR_NO_LAST_SLASH); + PathOutput::DIR_INCLUDE_LAST_SLASH); EXPECT_EQ("/", out.str()); } + { + std::ostringstream out; + writer.WriteDir(out, SourceDir("/"), + PathOutput::DIR_NO_LAST_SLASH); + EXPECT_EQ("/.", out.str()); + } + + // Output inside current dir. + { + std::ostringstream out; + writer.WriteDir(out, SourceDir("//out/Debug/"), + PathOutput::DIR_INCLUDE_LAST_SLASH); + EXPECT_EQ("./", out.str()); + } + { + std::ostringstream out; + writer.WriteDir(out, SourceDir("//out/Debug/"), + PathOutput::DIR_NO_LAST_SLASH); + EXPECT_EQ(".", out.str()); + } + { + std::ostringstream out; + writer.WriteDir(out, SourceDir("//out/Debug/foo/"), + PathOutput::DIR_INCLUDE_LAST_SLASH); + EXPECT_EQ("foo/", out.str()); + } + { + std::ostringstream out; + writer.WriteDir(out, SourceDir("//out/Debug/foo/"), + PathOutput::DIR_NO_LAST_SLASH); + EXPECT_EQ("foo", out.str()); + } } { // Empty build dir writer. |