summaryrefslogtreecommitdiffstats
path: root/tools/gn
Commit message (Collapse)AuthorAgeFilesLines
* Update instructions, sha-1's for uploading GN binaries.dpranke2014-11-147-6/+14
| | | | | | | | | | | | | This should be synced to r304096. This drops the 'use_ozone' flag for the linux builds (no longer needed and didn't really make sense) and updates some instructions. TBR=brettw@chromium.org BUG= Review URL: https://codereview.chromium.org/720353002 Cr-Commit-Position: refs/heads/master@{#304146}
* gn: Support build directories outside the source tree.zeuthen2014-11-1130-190/+443
| | | | | | | | | | | | | | | | | | | | | | | | | The main use-case is to support using a fast SSD or ramdisk for the build directory, but a slower persistent disk for the source code. The general idea behind this change is modifying - RebaseSourceAbsolutePath() - SourceDir::ResolveRelativeFile() - SourceDir::ResolveRelativeDir() - GetOutputDirForSourceDirAsOutputFile() - PathOutput to work with paths reaching out of the source directory. Thanks to jam@ for the Windows-fixes. BUG=343728 TEST=New unit tests + Unit tests pass. TEST=`gn gen /ssd/out/Debug && ninja -C /ssd/out/Debug` work as expected. Review URL: https://codereview.chromium.org/630223002 Cr-Commit-Position: refs/heads/master@{#303719}
* Make "gn refs" find targets that reference a file.brettw2014-11-071-57/+168
| | | | | | | | | | I wanted this feature to more easily track down undefined refs at link time. This command can tell you what targets include a file, or tell you a tree on how to get there, so you can more easily figure out what dependencies to add. Also adds the ability to write a tree for the normal refs case for multiple targets. Review URL: https://codereview.chromium.org/700753005 Cr-Commit-Position: refs/heads/master@{#303328}
* gn format: use input line breaks rather than attempting rule-based line breaksscottmg2014-11-078-12/+35
| | | | | | | | | | | | I couldn't come up with anything that worked in 100% of cases, so switch to mostly maintaining line breaks from input file instead. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/713463003 Cr-Commit-Position: refs/heads/master@{#303313}
* gn win: Disable not-working ExecProcessTestscottmg2014-11-071-2/+4
| | | | | | | | R=brettw@chromium.org,cjhopman@chromium.org Review URL: https://codereview.chromium.org/707193006 Cr-Commit-Position: refs/heads/master@{#303312}
* gn format: Fix suffix comment being dropped on importscottmg2014-11-0713-2/+81
| | | | | | | | | | | | Also add some more disabled tests for things noted in reformatting all chromium's gn files (see bug). R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/707973002 Cr-Commit-Position: refs/heads/master@{#303155}
* gn format: fix trailing comment attachmentscottmg2014-11-058-7/+22
| | | | | | | | | | | | Fixes tools/gn/format_test_data/033.gn which was the worst problem in https://codereview.chromium.org/707593002/. BUG=348474 R=brettw@chromium.org Review URL: https://codereview.chromium.org/700893004 Cr-Commit-Position: refs/heads/master@{#302904}
* Make the gn copy() tool honor dependencies.dpranke2014-10-312-1/+43
| | | | | | | | | | | | | | | Previously it didn't, and perhaps there was no need for it to, but it seems like NaCl has a need. Specifically, NaCl has two targets A and B with both run fine on their own, but A can delete the output of B, and so needs to run before B. R=brettw@chromium.org BUG=428576 Review URL: https://codereview.chromium.org/693443002 Cr-Commit-Position: refs/heads/master@{#302342}
* Align base::hash_map with C++11, part 2.davidben2014-10-246-48/+0
| | | | | | | | | | | | | | | | | | | | | | | | | MSVC's stdext::hash_map, unlike C++11's std::unordered_map and GCC's __gnu_cxx::hash_map, requires a total order on the key. It also has a very different syntax for supplying a default hash function. Switch MSVC to std::unordered_map, but exposed as base::hash_map. This aligns both the container and the default hash function. The default hash function now differs from our GCC one in that const char * is no longer hashed as a C string. To align GCC with C++11 semantics and the MSVC ones this CL introduces, also provide a new hash function and swap the default hash with it. This new function is identical to __gnu_cxx::hash, but it does not specialize const char* and does specialize T* (which was already aligned by https://codereview.chromium.org/630503002/). Note: This CL changes a file in mojo/ and will need to be mirrored in the mojo repository before the next sync. BUG=420242 Review URL: https://codereview.chromium.org/623383002 Cr-Commit-Position: refs/heads/master@{#301185}
* gn: Fix typo in error message (for label pattern wildcards).viettrungluu2014-10-221-1/+1
| | | | | | | | R=brettw@chromium.org Review URL: https://codereview.chromium.org/670833003 Cr-Commit-Position: refs/heads/master@{#300640}
* Update virtual/final usage in tools/gn/.Viet-Trung Luu2014-10-2217-127/+117
| | | | | | | | | | | Also some #include fixes (from OVERRIDE -> override conversion). BUG=417463 TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/643063004 Cr-Commit-Position: refs/heads/master@{#300635}
* Replacing the OVERRIDE with override in tools foldermohan.reddy2014-10-2217-82/+82
| | | | | | | | | | | This step is a giant search and replace for OVERRIDE to replace them with their lowercase versions. BUG=417463 Review URL: https://codereview.chromium.org/631653002 Cr-Commit-Position: refs/heads/master@{#300594}
* Type conversion fixes, tools/ edition.pkasting2014-10-174-4/+5
| | | | | | | | | | | This is mostly to fix MSVC warnings about possible value truncation. BUG=81439 TEST=none Review URL: https://codereview.chromium.org/644433003 Cr-Commit-Position: refs/heads/master@{#300131}
* Simplify ScopedVector<scoped_ptr<T>> to ScopedVector<T>.dcheng2014-10-177-13/+13
| | | | | | | | | | Also removes a couple more PassAs() calls. BUG=423621 Review URL: https://codereview.chromium.org/654263004 Cr-Commit-Position: refs/heads/master@{#300129}
* Convert the few remaining ARRAYSIZE_UNSAFE -> arraysize.viettrungluu2014-10-171-1/+1
| | | | | | | | | | | | | | | | | | | There are still ARRAYSIZE_UNSAFEs in ppapi/tests/test_audio.cc, but it defines it itself, and it might be compiled by some older NaCl toolchain that doesn't support C++11. third_party/npapi/npspy/common/format.cpp also has its own ARRAYSIZE_UNSAFE, but I'm hoping to delete npspy completely.) I'll remove ARRAYSIZE_UNSAFE from base/macro.h separately, since it's quite likely we have deps that use our base (and those deps may use it). R=ben@chromium.org TBR=armansito@chromium.org BUG=423134 Review URL: https://codereview.chromium.org/663673002 Cr-Commit-Position: refs/heads/master@{#300034}
* GN: Store parse error messages (so they aren't dropped due to races)cjhopman2014-10-162-14/+9
| | | | | | | | | | | | Bad error messages remind me of working with gyp. This change just stores the parser error in the InputFileData so that we can actually report a useful error message from whichever thread first reports an error. Review URL: https://codereview.chromium.org/645253002 Cr-Commit-Position: refs/heads/master@{#299953}
* GN: Capture and print stderr from exec_scriptcjhopman2014-10-166-211/+406
| | | | | | | | | | | | | This moves ExecProcess to exec_process.h/cc and adds capturing of stderr on linux. Adds unittests for ExecProcess. Windows is not supported. Review URL: https://codereview.chromium.org/646013003 Cr-Commit-Position: refs/heads/master@{#299951}
* gn: Check GN_EDITOR before EDITOR in environment variables.erg2014-10-161-1/+2
| | | | | | | | | | | | It's a convention in unix for programs to first search for a program specific editor variable. For example, SVN_EDITOR or GIT_EDITOR. This makes GN follow this same convention. BUG=none Review URL: https://codereview.chromium.org/654333002 Cr-Commit-Position: refs/heads/master@{#299798}
* Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>.dcheng2014-10-153-18/+18
| | | | | | | | BUG=423621 Review URL: https://codereview.chromium.org/656093004 Cr-Commit-Position: refs/heads/master@{#299748}
* Align base::hash_map with C++11, part 1.davidben2014-10-111-16/+0
| | | | | | | | | | | | | | | | | C++11's std::hash provides a default hash for T* that hashes by pointer value. So does MSVC's stdext::hash_value, but not GCC's __gnu_cxx::hash (and STLPort's std::hash). To align non-MSVC with both MSVC and the standard, provide a default hash for pointers. This removes a lot of GCC-specific hash definitions. Confusingly, all three provide a default hash for const char * that hashes as C string, while not changing their equality. This CL does not change this on any platform. BUG=420242 Review URL: https://codereview.chromium.org/630503002 Cr-Commit-Position: refs/heads/master@{#299217}
* Cleanup: Actually remove base/file_util.h.thestig2014-10-101-1/+1
| | | | | | Review URL: https://codereview.chromium.org/647623002 Cr-Commit-Position: refs/heads/master@{#299155}
* Clean up ifdef around FilePath creation in /src/toolsanujk.sharma2014-10-071-5/+1
| | | | | | | | BUG=102853 Review URL: https://codereview.chromium.org/630403003 Cr-Commit-Position: refs/heads/master@{#298532}
* gn format: more blank line avoidancescottmg2014-10-0715-18/+78
| | | | | | | | | | | | | | | This seems to be a lot closer to standard usage, basically "short stuff" isn't blank-line separated. Also, add 3 not-working-yet unreferenced tests so I don't forget about fixing those things. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/603823003 Cr-Commit-Position: refs/heads/master@{#298513}
* gn format: fix some cases of too many blank lines between itemsscottmg2014-10-076-1/+70
| | | | | | | | | R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/636663002 Cr-Commit-Position: refs/heads/master@{#298341}
* gn format: fix some unnecessary line breakingscottmg2014-10-066-16/+34
| | | | | | | | | R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/629763002 Cr-Commit-Position: refs/heads/master@{#298251}
* gn format: make precedence and parens workscottmg2014-10-055-28/+95
| | | | | | | | | | | | Track parent precedence down through emitting expressions so that if necessary the child expression can use () to maintain evaluation order. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/624353002 Cr-Commit-Position: refs/heads/master@{#298179}
* gn format: refactor function call printingscottmg2014-10-044-74/+242
| | | | | | | | | | | | | Pulls out function call formatting separate from list/block, and fixes line length when blocks attached. Function call is still kind of complex, but at least list/block are simpler. R=brettw@chromium.org BUG=384474 Review URL: https://codereview.chromium.org/623643002 Cr-Commit-Position: refs/heads/master@{#298143}
* gn format: accept input from stdin, add vim helperscottmg2014-10-035-20/+152
| | | | | | | | | | | | Also add test for empty function call (which was asserting with invalid iterator). R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/626093003 Cr-Commit-Position: refs/heads/master@{#298106}
* gn format: support --in-placescottmg2014-10-031-2/+15
| | | | | | | | | | | | | | | This is helpful for editor integration. e.g. in Vim: au BufRead,BufNewFile,BufEnter *.gn map <silent> <F1> :w<cr>:silent! exe "!/path/to/gn/gn.exe format --in-place " . expand('%:p')<cr>:e<cr> to reformat the current file. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/614683006 Cr-Commit-Position: refs/heads/master@{#298058}
* gn format: support absolute file system pathsscottmg2014-10-023-19/+41
| | | | | | | | | | | And update help text. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/613083003 Cr-Commit-Position: refs/heads/master@{#297926}
* gn format: add call wrappingscottmg2014-10-027-42/+262
| | | | | | | | | | | | | | | | | | | For function call arguments: - if all arguments plus ')' fit at current point, insert - if all arguments fit at current, one per line - otherwise at minimum of current and margin+4, one per line, recurse into children. Similar for binary expressions so that "a + b" can wrap. Also, add basic output of AccessorNode + test. (not as fancy as clang-format, but there's not that many long function calls in .gn files.) R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/607243002 Cr-Commit-Position: refs/heads/master@{#297765}
* Replace more for loops in GNbrettw2014-09-3039-479/+349
| | | | | | Review URL: https://codereview.chromium.org/610293003 Cr-Commit-Position: refs/heads/master@{#297508}
* gn: Fix more build issues on Winckocagil2014-09-301-1/+1
| | | | | | | | | | | BUG=354261 R=brettw TBR=piman,wtc NOTRY=true Review URL: https://codereview.chromium.org/603143002 Cr-Commit-Position: refs/heads/master@{#297481}
* GN Doc fix. Visibility default is public.scheib2014-09-291-2/+2
| | | | | | | | See Visibility::FillItemVisibility for code implementing default. Review URL: https://codereview.chromium.org/608293002 Cr-Commit-Position: refs/heads/master@{#297237}
* gn format: properly break and align multiple suffix commentsScott Graham2014-09-294-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Previously a = [ "x", "y", # Comment1 # Comment2 ] would turn into a = [ "x", "y", # Comment1# Comment2 ] (Child of https://codereview.chromium.org/606123002/) R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/613473002 Cr-Commit-Position: refs/heads/master@{#297235}
* gn format: make sure there's a blank line before comments, except at block startScott Graham2014-09-294-0/+66
| | | | | | | | | | | | | | With this, gn format //BUILD.gn results in no changes, other than to make 'deps += [ "a" ]' turn into one line instead of multiline. (Child of https://codereview.chromium.org/608593006/) R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/606123002 Cr-Commit-Position: refs/heads/master@{#297231}
* gn format: don't crash when there's no block on a function callScott Graham2014-09-294-4/+13
| | | | | | | | | | | (Child of https://codereview.chromium.org/607173002/) R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/608593006 Cr-Commit-Position: refs/heads/master@{#297228}
* gn format: fix comments at end of blocksscottmg2014-09-299-52/+222
| | | | | | | | | | | | | | | | | | | | | | Fixes comments at the end of a block like: stuff() { sources = [] # wee } This is done by storing an EndNode (instead of just a Token) as the end of Block and List nodes. This means there's a node in the tree traversal for the trailing ], and gives a place to attach the comment. Also collapses some of the expression output code to reuse Sequence. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/607173002 Cr-Commit-Position: refs/heads/master@{#297226}
* Convert GN's deps iterator to work with range-based for loops.brettw2014-09-2711-112/+138
| | | | | | | | | | Reworks DepsIterator so it is compatible with STL iterators enough to work with range-based for loops. The iterator is now created by a target rather than taking a target as an argument, which makes the loops more natural. I also changed some loops around code I was touching to use range-based. Review URL: https://codereview.chromium.org/610043002 Cr-Commit-Position: refs/heads/master@{#297122}
* GN: Generate error if multiple rules generate same filejamesr2014-09-265-31/+53
| | | | | | | | | This will pretty much always result in a bad build but is only a warning in ninja. Review URL: https://codereview.chromium.org/455193003 Cr-Commit-Position: refs/heads/master@{#297077}
* gn: start of format commandscottmg2014-09-2643-15/+769
| | | | | | | | | | | | | Adds `gn format` command. Currently accepts one //path/to/BUILD.gn and attempts to reformat it (to stdout). Handles the basics, but does not handle all constructs yet, and doesn't attempt any rewrites. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/591373002 Cr-Commit-Position: refs/heads/master@{#296876}
* Cleanup: Remove the instances of "rm_binaries.py" from 'src/tools/gn/bin'. ↵anujk.sharma2014-09-241-42/+0
| | | | | | | | | | The GN binaries have moved to src/buildtools. So, this script was removing GN binaries from tools/gn/bin that aren't used anymore. It was kept with the same intent till july 2014 (expected), and now think so, it is the good time to remove this script. BUG= Review URL: https://codereview.chromium.org/598493002 Cr-Commit-Position: refs/heads/master@{#296344}
* gn: handle continued suffix commentsscottmg2014-09-246-5/+92
| | | | | | | | | | | | | | | Rebased on https://codereview.chromium.org/588893006/ Comments that look like standalone line comments but immediately follow a previous suffix comment should be considered suffix as well so they can be added to the same node. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/595753002 Cr-Commit-Position: refs/heads/master@{#296339}
* gn: attach comments to parse treescottmg2014-09-2416-54/+435
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Split off of https://codereview.chromium.org/588813002) The main change here is to restructure the ParseNode tree to include comments. Comments are not included in the tree as normal nodes, but instead attached subordinate to other |ParseNode|s. This is useful for two reasons: - it means neither the evaluator nor the main code of the parser need to get more complicated, as they do not need to constantly consider comments. - it confers additional information about the relative location of of the comments to their surrounding code when (in the future) outputting the formatted code. Comments are added in relation to the node they're attached to as before, after, or suffix. This is so that formatting can keep them attached to the correct thing when things are reflowed. Timing data (Windows, Release): Before: Done. Wrote 1618 targets from 530 files in 2613ms Done. Wrote 1618 targets from 530 files in 2952ms Done. Wrote 1618 targets from 530 files in 3093ms After: Done. Wrote 1618 targets from 530 files in 2767ms Done. Wrote 1618 targets from 530 files in 3120ms Done. Wrote 1618 targets from 530 files in 2872ms So, it seems within the noise at this point. R=brettw@chromium.org BUG=348474 Review URL: https://codereview.chromium.org/588893006 Cr-Commit-Position: refs/heads/master@{#296331}
* GN: Fix dependency output file handling.Brett Wilson2014-09-224-1/+50
| | | | | | | | | | A copy and paste error meant it used the link output file for dependency tracking. This is valid but inefficient, which was why it wasn't caught. Added a new test for this case R=scottmg@chromium.org Review URL: https://codereview.chromium.org/583363003 Cr-Commit-Position: refs/heads/master@{#295985}
* gn: Remove unused bind.h include from run_all_unittests.ccThiago Farina2014-09-201-1/+0
| | | | | | | | | | BUG=None TEST=ninja -C out/Debug gn_unittests TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/583453003 Cr-Commit-Position: refs/heads/master@{#295853}
* gn: Fix some typos in unittests.Thiago Farina2014-09-202-3/+3
| | | | | | | | | | | | | | SubstitutionPatterm -> SubstitutionPattern SubstutitionWriter -> SubstitutionWriter BUG=None TEST=ninja -C out/Debug gn_unittests - compare the output before and after this change. TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/590683002 Cr-Commit-Position: refs/heads/master@{#295846}
* Improve GN header checker, make "check" on //ui/* pass.Brett Wilson2014-09-193-122/+239
| | | | | | | | | | | | | | | | | | | | I went through and made "gn check //ui/*" pass, and did a lot of enhancements for the bugs I found. Fixes a big bug in the header checker where it did not consider direct private dependencies to be OK from a header include perspective. However, private deps only change things when there are intermediate targets. This patch marks direct deps OK, and changes the variable names from is_public to is_permitted (since it may not actually be public). Allow includes to be permitted if any target allows the include, rather than all of them. This happens if multiple targets have the same file as sources. Strip the generated file directory from the beginning of sources. Previously, this was only for outputs (since typically they're included assuming the root gen dir is on the path). This comes up when an action generates a file, and then it's put into a source set (which we do a lot). This change allows a public dependency on the source set to count for header include purposes. Track public/private deps in the dependency path finder so the error message can show which deps are private that break the chain. This was really helpful when tracking down errors. Add deps and public deps to the build to make check pass. R=scottmg@chromium.org Review URL: https://codereview.chromium.org/584683002 Cr-Commit-Position: refs/heads/master@{#295783}
* gn: Escape include path strings for shellckocagil2014-09-191-3/+11
| | | | | | | | | BUG=414880 R=brettw Review URL: https://codereview.chromium.org/576293003 Cr-Commit-Position: refs/heads/master@{#295620}
* GN: Complete static libs can't depend on static libscmasone2014-09-184-3/+95
| | | | | | | | | | | | | Trying to use ar to put a static lib inside a complete static lib doesn't work. GN should enforce and document this restriction. BUG=None TEST=gn_unittests, including new test for this case. R=brettw Review URL: https://codereview.chromium.org/582863002 Cr-Commit-Position: refs/heads/master@{#295609}