libv8 5.1.281.59.1 → 5.2.361.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -7
  3. data/CHANGELOG.md +9 -1
  4. data/README.md +41 -23
  5. data/Rakefile +1 -1
  6. data/ext/libv8/builder.rb +1 -1
  7. data/ext/libv8/compiler/apple_llvm.rb +5 -4
  8. data/ext/libv8/compiler/clang.rb +5 -4
  9. data/ext/libv8/compiler/gcc.rb +5 -4
  10. data/ext/libv8/compiler/generic_compiler.rb +11 -1
  11. data/lib/libv8/version.rb +1 -1
  12. data/patches/0001-Build-a-standalone-static-library.patch +26 -0
  13. data/patches/{0002-Disable-building-tests.patch → 0002-Don-t-compile-unnecessary-stuff.patch} +31 -34
  14. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +10 -10
  15. data/patches/0004-Reinterpret-thread-hash-for-FreeBSD-too.patch +25 -0
  16. data/release/armhf-linux/Vagrantfile +95 -0
  17. data/release/armhf-linux/initrd.img +0 -0
  18. data/release/armhf-linux/vmlinuz +0 -0
  19. data/release/{x86_64-freebsd10 → x86_64-freebsd-10}/Vagrantfile +3 -1
  20. data/spec/compiler/apple_llvm_spec.rb +10 -3
  21. data/spec/compiler/clang_spec.rb +7 -0
  22. data/spec/compiler_spec.rb +1 -1
  23. data/spec/support/compiler_helpers.rb +3 -1
  24. data/vendor/depot_tools/{README → README.md} +33 -12
  25. data/vendor/depot_tools/checkout.py +7 -2
  26. data/vendor/depot_tools/cit.py +51 -13
  27. data/vendor/depot_tools/cpplint.py +27 -5
  28. data/vendor/depot_tools/git_cl.py +370 -290
  29. data/vendor/depot_tools/git_common.py +133 -28
  30. data/vendor/depot_tools/git_drover.py +29 -2
  31. data/vendor/depot_tools/git_map.py +2 -2
  32. data/vendor/depot_tools/git_map_branches.py +9 -5
  33. data/vendor/depot_tools/git_rebase_update.py +3 -3
  34. data/vendor/depot_tools/git_upstream_diff.py +1 -1
  35. data/vendor/depot_tools/infra/config/OWNERS +1 -0
  36. data/vendor/depot_tools/infra/config/cq.cfg +8 -3
  37. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  38. data/vendor/depot_tools/man/html/depot_tools.html +10 -2
  39. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +14 -15
  40. data/vendor/depot_tools/man/html/git-auto-svn.html +2 -2
  41. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +2 -11
  42. data/vendor/depot_tools/man/html/git-drover.html +19 -17
  43. data/vendor/depot_tools/man/html/git-footers.html +2 -2
  44. data/vendor/depot_tools/man/html/git-freeze.html +17 -4
  45. data/vendor/depot_tools/man/html/git-hyper-blame.html +2 -2
  46. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  47. data/vendor/depot_tools/man/html/git-map.html +3 -3
  48. data/vendor/depot_tools/man/html/git-mark-merge-base.html +2 -2
  49. data/vendor/depot_tools/man/html/git-nav-downstream.html +7 -7
  50. data/vendor/depot_tools/man/html/git-nav-upstream.html +4 -4
  51. data/vendor/depot_tools/man/html/git-new-branch.html +2 -2
  52. data/vendor/depot_tools/man/html/git-rebase-update.html +2 -2
  53. data/vendor/depot_tools/man/html/git-rename-branch.html +2 -2
  54. data/vendor/depot_tools/man/html/git-reparent-branch.html +2 -2
  55. data/vendor/depot_tools/man/html/git-retry.html +2 -2
  56. data/vendor/depot_tools/man/html/git-squash-branch.html +4 -4
  57. data/vendor/depot_tools/man/html/git-thaw.html +2 -2
  58. data/vendor/depot_tools/man/html/git-upstream-diff.html +2 -2
  59. data/vendor/depot_tools/man/man1/git-auto-svn.1 +4 -4
  60. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +5 -14
  61. data/vendor/depot_tools/man/man1/git-drover.1 +21 -19
  62. data/vendor/depot_tools/man/man1/git-footers.1 +5 -5
  63. data/vendor/depot_tools/man/man1/git-freeze.1 +12 -6
  64. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  65. data/vendor/depot_tools/man/man1/git-map-branches.1 +5 -7
  66. data/vendor/depot_tools/man/man1/git-map.1 +5 -5
  67. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  68. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +9 -9
  69. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +6 -6
  70. data/vendor/depot_tools/man/man1/git-new-branch.1 +4 -4
  71. data/vendor/depot_tools/man/man1/git-rebase-update.1 +4 -4
  72. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  73. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  74. data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
  75. data/vendor/depot_tools/man/man1/git-squash-branch.1 +6 -6
  76. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  77. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +4 -4
  78. data/vendor/depot_tools/man/man7/depot_tools.7 +9 -4
  79. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +14 -15
  80. data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +1 -2
  81. data/vendor/depot_tools/man/src/git-freeze.txt +15 -0
  82. data/vendor/depot_tools/man/src/make_docs.sh +4 -4
  83. data/vendor/depot_tools/owners.py +50 -46
  84. data/vendor/depot_tools/owners_finder.py +6 -19
  85. data/vendor/depot_tools/presubmit_canned_checks.py +2 -1
  86. data/vendor/depot_tools/presubmit_support.py +8 -10
  87. data/vendor/depot_tools/recipe_modules/bot_update/api.py +69 -55
  88. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +1 -0
  89. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +1 -0
  90. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +1 -0
  91. data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +2 -0
  92. data/vendor/depot_tools/recipe_modules/gclient/api.py +0 -17
  93. data/vendor/depot_tools/recipe_modules/gclient/config.py +9 -8
  94. data/vendor/depot_tools/recipe_modules/gclient/example.py +1 -1
  95. data/vendor/depot_tools/recipe_modules/git/api.py +20 -4
  96. data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +1 -0
  97. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +1 -0
  98. data/vendor/depot_tools/recipe_modules/git/example.expected/git-cache-checkout.json +189 -0
  99. data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +2 -1
  100. data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +1 -0
  101. data/vendor/depot_tools/recipe_modules/git/example.py +6 -1
  102. data/vendor/depot_tools/recipe_modules/git_cl/api.py +13 -0
  103. data/vendor/depot_tools/recipe_modules/git_cl/example.expected/basic.json +17 -0
  104. data/vendor/depot_tools/recipe_modules/git_cl/example.py +3 -0
  105. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_linux.json +14 -0
  106. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_mac.json +14 -0
  107. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_win.json +14 -0
  108. data/vendor/depot_tools/recipe_modules/infra_paths/example.py +1 -1
  109. data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +23 -10
  110. data/vendor/depot_tools/recipe_modules/tryserver/api.py +5 -3
  111. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +1 -0
  112. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +1 -0
  113. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +1 -0
  114. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_svn_patch.json +1 -0
  115. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +3 -1
  116. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +3 -1
  117. data/vendor/depot_tools/recipes.py +56 -27
  118. data/vendor/depot_tools/rietveld.py +10 -0
  119. data/vendor/depot_tools/third_party/httplib2/README.chromium +3 -3
  120. data/vendor/depot_tools/third_party/httplib2/__init__.py +31 -15
  121. data/vendor/depot_tools/third_party/upload.py +54 -45
  122. data/vendor/depot_tools/update_depot_tools +16 -70
  123. data/vendor/depot_tools/update_depot_tools.bat +4 -18
  124. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +10 -6
  125. metadata +15 -8
  126. data/patches/0001-Build-standalone-static-library.patch +0 -26
  127. data/vendor/depot_tools/git_utils/git-tree-prune +0 -122
@@ -0,0 +1,95 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure("2") do |config|
9
+ # The most common configuration options are documented and commented below.
10
+ # For a complete reference, please see the online documentation at
11
+ # https://docs.vagrantup.com.
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://atlas.hashicorp.com/search.
15
+ config.vm.box = "ignisf/debian8-arm"
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
26
+
27
+ # Create a private network, which allows host-only access to the machine
28
+ # using a specific IP.
29
+ # config.vm.network "private_network", ip: "192.168.33.10"
30
+
31
+ # Create a public network, which generally matched to bridged network.
32
+ # Bridged networks make the machine appear as another physical device on
33
+ # your network.
34
+ # config.vm.network "public_network"
35
+
36
+ # Share an additional folder to the guest VM. The first argument is
37
+ # the path on the host to the actual folder. The second argument is
38
+ # the path on the guest to mount the folder. And the optional third
39
+ # argument is a set of non-required options.
40
+ # config.vm.synced_folder "../data", "/vagrant_data"
41
+ config.vm.synced_folder ".", "/vagrant", type: 'nfs'
42
+ config.vm.synced_folder "../..", "/libv8", type: 'nfs'
43
+
44
+
45
+ # Provider-specific configuration so you can fine-tune various
46
+ # backing providers for Vagrant. These expose provider-specific options.
47
+ # Example for VirtualBox:
48
+ #
49
+ # config.vm.provider "virtualbox" do |vb|
50
+ # # Display the VirtualBox GUI when booting the machine
51
+ # vb.gui = true
52
+ #
53
+ # # Customize the amount of memory on the VM:
54
+ # vb.memory = "1024"
55
+ # end
56
+ #
57
+ # View the documentation for the provider you are using for more
58
+ # information on available options.
59
+
60
+ config.vm.provider :libvirt do |domain|
61
+ # domain.uri = 'qemu+unix:///system'
62
+ # domain.host = 'virtualized'
63
+ domain.kernel = File.expand_path('../vmlinuz', __FILE__)
64
+ domain.initrd = File.expand_path('../initrd.img', __FILE__)
65
+ domain.cmd_line = 'root=/dev/vda2 rw'
66
+ domain.machine_type = 'virt'
67
+ domain.machine_arch = 'armv7l'
68
+ domain.driver = 'qemu'
69
+ domain.cpu_mode = "custom"
70
+ domain.cpu_model = nil
71
+ domain.graphics_type = 'none'
72
+ end
73
+
74
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
75
+ # such as FTP and Heroku are also available. See the documentation at
76
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
77
+ # config.push.define "atlas" do |push|
78
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
79
+ # end
80
+
81
+ # Enable provisioning with a shell script. Additional provisioners such as
82
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
83
+ # documentation for more information about their specific syntax and use.
84
+ # config.vm.provision "shell", inline: <<-SHELL
85
+ # apt-get update
86
+ # apt-get install -y apache2
87
+ # SHELL
88
+ config.vm.provision "shell", inline: <<-SHELL
89
+ sudo apt update
90
+ sudo apt install -y software-properties-common
91
+ sudo apt dist-upgrade -y
92
+ sudo apt install -y build-essential git ruby ruby-dev
93
+ sudo gem install bundler
94
+ SHELL
95
+ end
@@ -60,6 +60,7 @@ Vagrant.configure(2) do |config|
60
60
  config.ssh.shell = "sh"
61
61
  config.vm.base_mac = "080027D14C66"
62
62
  config.vm.provider :virtualbox do |vb|
63
+ vb.memory = "2048"
63
64
  vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
64
65
  vb.customize ["modifyvm", :id, "--audio", "none"]
65
66
  vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
@@ -81,6 +82,7 @@ Vagrant.configure(2) do |config|
81
82
  # sudo apt-get install -y apache2
82
83
  # SHELL
83
84
  config.vm.provision "shell", inline: <<-SHELL
84
- pkg install -y bash gmake ruby rubygem-bundler git-subversion python2
85
+ pkg upgrade -y
86
+ pkg install -y bash gmake ruby rubygem-bundler git-lite python2
85
87
  SHELL
86
88
  end
@@ -13,18 +13,25 @@ module Libv8::Compiler
13
13
 
14
14
  describe '#version' do
15
15
  it 'returns the version of the compiler' do
16
- stub_as_available 'c++', :apple_llvm, '5.1'
17
- expect(subject.version).to eq '5.1'
16
+ stub_as_available 'c++', :apple_llvm, '4.20'
17
+ expect(subject.version).to eq '4.20'
18
18
  end
19
19
  end
20
20
 
21
21
  describe '#compatible?' do
22
22
  context 'when Apple LLVM\'s version is >= 4.3' do
23
23
  it 'returns true' do
24
- stub_as_available 'c++', :apple_llvm, '5.1'
24
+ stub_as_available 'c++', :apple_llvm, '4.20'
25
25
  expect(subject).to be_compatible
26
26
  end
27
27
  end
28
+
29
+ context 'when Apple LLVM\'s version is < 4.3' do
30
+ it 'returns false' do
31
+ stub_as_available 'c++', :apple_llvm, '4.2'
32
+ expect(subject).to_not be_compatible
33
+ end
34
+ end
28
35
  end
29
36
  end
30
37
  end
@@ -25,6 +25,13 @@ module Libv8::Compiler
25
25
  expect(subject).to be_compatible
26
26
  end
27
27
  end
28
+
29
+ context 'when clang\'s version is < 3.1' do
30
+ it 'returns false' do
31
+ stub_as_available 'c++', :clang, '3.0.9'
32
+ expect(subject).to_not be_compatible
33
+ end
34
+ end
28
35
  end
29
36
  end
30
37
  end
@@ -21,7 +21,7 @@ module Libv8
21
21
  end
22
22
 
23
23
  it 'recognises correctly Apple\'s LLVM' do
24
- stub_as_available 'c++', :apple_llvm, '5.1'
24
+ stub_as_available 'c++', :apple_llvm, '4.20'
25
25
  expect(Compiler.type_of('c++').new('c++')).to be_a Compiler::AppleLLVM
26
26
  end
27
27
  end
@@ -5,11 +5,13 @@ module CompilerHelpers
5
5
  "4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\nCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper\nTarget: x86_64-unknown-linux-gnu\nConfigured with: /build/gcc-multilib/src/gcc-4.9-20140604/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib --disable-werror --enable-checking=release\nThread model: posix\ngcc version 4.9.0 20140604 (prerelease) (GCC)\n}
6
6
  },
7
7
  :clang => {
8
+ "3.0.9" => %Q{clang version 3.0.9 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n},
8
9
  "3.3-freebsd" => %Q{FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610\nTarget: i386-unknown-freebsd9.2\nThread model: posix},
9
10
  "3.4.1" => %Q{clang version 3.4.1 (tags/RELEASE_34/dot1-final)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nFound candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0\nFound candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\nSelected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0\n},
10
11
  },
11
12
  :apple_llvm => {
12
- '5.1' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n}
13
+ '4.20' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 4.20 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n},
14
+ '4.2' => %Q{Configured with: --prefix=/Applications/Xcode.app/Contents/Developer//usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1\nApple LLVM version 4.2 (clang-503.0.38) (based on LLVM 3.4svn)\nTarget: x86_64-apple-darwin14.0.0\nThread model: posix\n}
13
15
  }
14
16
  }
15
17
 
@@ -1,11 +1,4 @@
1
- This package contains tools for working with Chromium development.
2
-
3
- The "gclient" wrapper knows how to keep this repository updated to
4
- the latest versions of these tools as found at:
5
-
6
- https://chromium.googlesource.com/chromium/tools/depot_tools/+/master/gclient.py
7
-
8
- This package contains:
1
+ This package contains tools for working with Chromium development:
9
2
 
10
3
  chrome-update-create-task.bat
11
4
  Creates a scheduled task to do an automatic local chromium build every day.
@@ -25,10 +18,38 @@ This package contains:
25
18
  More info at:
26
19
  http://code.google.com/p/gclient/
27
20
 
28
- Note: svn and python will be installed automatically if not accessible (on
29
- Windows only).
21
+ It updates itself automatically when running `gclient` tool. To disable
22
+ auto update, set the environment variable DEPOT_TOOLS_UPDATE=0
30
23
 
31
- To update this distribution manually, run .\update_depot_tools.bat on Windows,
24
+ To update package manually, run .\update_depot_tools.bat on Windows,
32
25
  or ./update_depot_tools on Linux or Mac.
33
26
 
34
- To disable automatic updating, set the environment variable DEPOT_TOOLS_UPDATE=0
27
+ Note: on Windows if svn, git and python are not accessible, they will be
28
+ downloaded too.
29
+
30
+
31
+ ## Contributing
32
+
33
+ The "gclient" wrapper knows how to keep this repository updated to
34
+ the latest versions of these tools as found at:
35
+
36
+ https://chromium.googlesource.com/chromium/tools/depot_tools.git
37
+
38
+ To contribute change for review:
39
+
40
+ git new-branch <somename>
41
+ git add <yourchanges>
42
+ git commit
43
+ # find reviewers
44
+ git cl owners
45
+ git log <yourfiles>
46
+ # upload
47
+ git cl upload -r reviewer1@chromium.org,reviewer2 --send-mail
48
+ # open https://codereview.chromium.org/ and send mail
49
+
50
+ # if change is approved, flag it to be commited
51
+ git cl set_commit
52
+ # if change needs more work
53
+ git rebase-update
54
+ ...
55
+ git cl upload
@@ -7,7 +7,6 @@
7
7
  Includes support for svn, git-svn and git.
8
8
  """
9
9
 
10
- import ConfigParser
11
10
  import fnmatch
12
11
  import logging
13
12
  import os
@@ -17,6 +16,12 @@ import subprocess
17
16
  import sys
18
17
  import tempfile
19
18
 
19
+ # The configparser module was renamed in Python 3.
20
+ try:
21
+ import configparser
22
+ except ImportError:
23
+ import ConfigParser as configparser
24
+
20
25
  import patch
21
26
  import scm
22
27
  import subprocess2
@@ -258,7 +263,7 @@ class SvnConfig(object):
258
263
  self.svn_config_dir = os.path.expanduser(
259
264
  os.path.join('~', '.subversion'))
260
265
  svn_config_file = os.path.join(self.svn_config_dir, 'config')
261
- parser = ConfigParser.SafeConfigParser()
266
+ parser = configparser.SafeConfigParser()
262
267
  if os.path.isfile(svn_config_file):
263
268
  parser.read(svn_config_file)
264
269
  else:
@@ -9,6 +9,7 @@
9
9
  This tool does a two things:
10
10
  * Maintains a infra.git checkout pinned at "deployed" in the home dir
11
11
  * Acts as an alias to infra.tools.*
12
+ * Acts as an alias to infra.git/cipd/<executable>
12
13
  """
13
14
 
14
15
  # TODO(hinoka): Use cipd/glyco instead of git/gclient.
@@ -56,8 +57,10 @@ def need_to_update(branch):
56
57
 
57
58
  def ensure_infra(branch):
58
59
  """Ensures that infra.git is present in ~/.chrome-infra."""
59
- print 'Fetching infra@%s into %s, may take a couple of minutes...' % (
60
- branch, TARGET_DIR)
60
+ sys.stderr.write(
61
+ 'Fetching infra@%s into %s, may take a couple of minutes...' % (
62
+ branch, TARGET_DIR))
63
+ sys.stderr.flush()
61
64
  if not os.path.isdir(TARGET_DIR):
62
65
  os.mkdir(TARGET_DIR)
63
66
  if not os.path.exists(os.path.join(TARGET_DIR, '.gclient')):
@@ -69,36 +72,71 @@ def ensure_infra(branch):
69
72
  [sys.executable, GCLIENT, 'sync', '--revision', 'origin/%s' % (branch,)],
70
73
  cwd=TARGET_DIR,
71
74
  stdout=subprocess.PIPE)
75
+ sys.stderr.write(' done.\n')
76
+ sys.stderr.flush()
77
+
78
+
79
+ def is_exe(filename):
80
+ """Given a full filepath, return true if the file is an executable."""
81
+ if sys.platform.startswith('win'):
82
+ return filename.endswith('.exe')
83
+ else:
84
+ return os.path.isfile(filename) and os.access(filename, os.X_OK)
72
85
 
73
86
 
74
87
  def get_available_tools():
75
- tools = []
88
+ """Returns a tuple of (list of infra tools, list of cipd tools)"""
89
+ infra_tools = []
90
+ cipd_tools = []
76
91
  starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools')
77
92
  for root, _, files in os.walk(starting):
78
93
  if '__main__.py' in files:
79
- tools.append(root[len(starting)+1:].replace(os.path.sep, '.'))
80
- return sorted(tools)
94
+ infra_tools.append(root[len(starting)+1:].replace(os.path.sep, '.'))
95
+ cipd = os.path.join(TARGET_DIR, 'infra', 'cipd')
96
+ for fn in os.listdir(cipd):
97
+ if is_exe(os.path.join(cipd, fn)):
98
+ cipd_tools.append(fn)
99
+ return (sorted(infra_tools), sorted(cipd_tools))
81
100
 
82
101
 
83
102
  def run(args):
84
103
  if args:
85
104
  tool_name = args[0]
86
- cmd = [
87
- sys.executable, os.path.join(TARGET_DIR, 'infra', 'run.py'),
88
- 'infra.tools.%s' % tool_name]
105
+ # Check to see if it is a infra tool first.
106
+ infra_dir = os.path.join(
107
+ TARGET_DIR, 'infra', 'infra', 'tools', *tool_name.split('.'))
108
+ cipd_file = os.path.join(TARGET_DIR, 'infra', 'cipd', tool_name)
109
+ if sys.platform.startswith('win'):
110
+ cipd_file += '.exe'
111
+ if (os.path.isdir(infra_dir)
112
+ and os.path.isfile(os.path.join(infra_dir, '__main__.py'))):
113
+ cmd = [
114
+ sys.executable, os.path.join(TARGET_DIR, 'infra', 'run.py'),
115
+ 'infra.tools.%s' % tool_name]
116
+ elif os.path.isfile(cipd_file) and is_exe(cipd_file):
117
+ cmd = [cipd_file]
118
+
119
+ # Add the remaining arguments.
89
120
  cmd.extend(args[1:])
90
121
  return subprocess.call(cmd)
91
122
 
92
- tools = get_available_tools()
123
+ infra_tools, cipd_tools = get_available_tools()
93
124
  print """usage: cit.py <name of tool> [args for tool]
94
125
 
95
- Wrapper for maintaining and calling tools in "infra.git/run.py infra.tools.*"
126
+ Wrapper for maintaining and calling tools in:
127
+ "infra.git/run.py infra.tools.*"
128
+ "infra.git/cipd/*"
96
129
 
97
- Available tools are:
98
- """
99
- for tool in tools:
130
+ Available infra tools are:"""
131
+ for tool in infra_tools:
100
132
  print ' * %s' % tool
101
133
 
134
+ print """
135
+ Available cipd tools are:"""
136
+ for tool in cipd_tools:
137
+ print ' * %s' % tool
138
+
139
+
102
140
 
103
141
  def main():
104
142
  parser = argparse.ArgumentParser("Chrome Infrastructure CLI.")
@@ -524,6 +524,10 @@ _error_suppressions = {}
524
524
  # This is set by --root flag.
525
525
  _root = None
526
526
 
527
+ # The project root directory. Used for deriving header guard CPP variable.
528
+ # This is set by --project_root flag. Must be an absolute path.
529
+ _project_root = None
530
+
527
531
  # The allowed line length of files.
528
532
  # This is set by --linelength flag.
529
533
  _line_length = 80
@@ -1065,6 +1069,10 @@ class FileInfo(object):
1065
1069
  if os.path.exists(fullname):
1066
1070
  project_dir = os.path.dirname(fullname)
1067
1071
 
1072
+ if _project_root:
1073
+ prefix = os.path.commonprefix([_project_root, project_dir])
1074
+ return fullname[len(prefix) + 1:]
1075
+
1068
1076
  if os.path.exists(os.path.join(project_dir, ".svn")):
1069
1077
  # If there's a .svn file in the current directory, we recursively look
1070
1078
  # up the directory tree for the top of the SVN checkout
@@ -5244,12 +5252,15 @@ _HEADERS_CONTAINING_TEMPLATES = (
5244
5252
  ('<limits>', ('numeric_limits',)),
5245
5253
  ('<list>', ('list',)),
5246
5254
  ('<map>', ('map', 'multimap',)),
5247
- ('<memory>', ('allocator',)),
5255
+ ('<memory>', ('allocator', 'make_shared', 'make_unique', 'shared_ptr',
5256
+ 'unique_ptr', 'weak_ptr')),
5248
5257
  ('<queue>', ('queue', 'priority_queue',)),
5249
5258
  ('<set>', ('set', 'multiset',)),
5250
5259
  ('<stack>', ('stack',)),
5251
5260
  ('<string>', ('char_traits', 'basic_string',)),
5252
5261
  ('<tuple>', ('tuple',)),
5262
+ ('<unordered_map>', ('unordered_map', 'unordered_multimap')),
5263
+ ('<unordered_set>', ('unordered_set', 'unordered_multiset')),
5253
5264
  ('<utility>', ('pair',)),
5254
5265
  ('<vector>', ('vector',)),
5255
5266
 
@@ -5264,7 +5275,7 @@ _HEADERS_MAYBE_TEMPLATES = (
5264
5275
  ('<algorithm>', ('copy', 'max', 'min', 'min_element', 'sort',
5265
5276
  'transform',
5266
5277
  )),
5267
- ('<utility>', ('swap',)),
5278
+ ('<utility>', ('forward', 'make_pair', 'move', 'swap')),
5268
5279
  )
5269
5280
 
5270
5281
  _RE_PATTERN_STRING = re.compile(r'\bstring\b')
@@ -5415,8 +5426,13 @@ def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
5415
5426
  continue
5416
5427
 
5417
5428
  for pattern, template, header in _re_pattern_templates:
5418
- if pattern.search(line):
5419
- required[header] = (linenum, template)
5429
+ matched = pattern.search(line)
5430
+ if matched:
5431
+ # Don't warn about IWYU in non-STL namespaces:
5432
+ # (We check only the first match per line; good enough.)
5433
+ prefix = line[:matched.start()]
5434
+ if prefix.endswith('std::') or not prefix.endswith('::'):
5435
+ required[header] = (linenum, template)
5420
5436
 
5421
5437
  # The policy is that if you #include something in foo.h you don't need to
5422
5438
  # include it again in foo.cc. Here, we will look at possible includes.
@@ -6017,7 +6033,8 @@ def ParseArguments(args):
6017
6033
  'filter=',
6018
6034
  'root=',
6019
6035
  'linelength=',
6020
- 'extensions='])
6036
+ 'extensions=',
6037
+ 'project_root='])
6021
6038
  except getopt.GetoptError:
6022
6039
  PrintUsage('Invalid arguments.')
6023
6040
 
@@ -6046,6 +6063,11 @@ def ParseArguments(args):
6046
6063
  elif opt == '--root':
6047
6064
  global _root
6048
6065
  _root = val
6066
+ elif opt == '--project_root':
6067
+ global _project_root
6068
+ _project_root = val
6069
+ if not os.path.isabs(_project_root):
6070
+ PrintUsage('Project root must be an absolute path.')
6049
6071
  elif opt == '--linelength':
6050
6072
  global _line_length
6051
6073
  try: