Commit 070329d3 authored by tfarina's avatar tfarina Committed by Commit bot

Rewrite plugin_flags.sh Bash script in Python.

This is necessary because GN's exec_script only runs Python scripts.

This was requested by Nico in https://codereview.chromium.org/971593003/.

BUG=462972
TEST=run ./tools/clang/scripts/plugin_flags.py and compare the output
with the bash version. They should be exactly the same.
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/966723003

Cr-Commit-Position: refs/heads/master@{#318924}
parent fce897d2
......@@ -2162,9 +2162,8 @@
'enable_service_discovery%': 1
}],
['clang_use_chrome_plugins==1 and OS!="win"', {
'clang_chrome_plugins_flags': [
'<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
],
'clang_chrome_plugins_flags%':
'<!(python <(DEPTH)/tools/clang/scripts/plugin_flags.py)',
}],
['asan==1 or msan==1 or lsan==1 or tsan==1', {
'clang%': 1,
......
......@@ -34,7 +34,7 @@
"third_party/accessibility-audit/axs_testing.js",
"third_party/hunspell_dictionaries/.*",
"third_party/zlib/google/test/data/.*",
"tools/clang/scripts/plugin_flags.sh",
"tools/clang/scripts/plugin_flags.py",
"tools/clang/scripts/update.py",
"tools/clang/scripts/update.sh",
"tools/metrics/histograms/histograms.xml",
......
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script returns the flags that should be used when GYP_DEFINES contains
# clang_use_chrome_plugins. The flags are stored in a script so that they can
# be changed on the bots without requiring a master restart.
import os
import sys
# Path constants. (All of these should be absolute paths.)
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..'))
CLANG_LIB_PATH = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
'Release+Asserts', 'lib')
if sys.platform == 'darwin':
LIBSUFFIX = 'dylib'
else:
LIBSUFFIX = 'so'
LIB_PATH = os.path.join(
CLANG_LIB_PATH,
'libFindBadConstructs.' + LIBSUFFIX)
print ('-Xclang -load -Xclang %s'
' -Xclang -add-plugin -Xclang find-bad-constructs'
' -Xclang -plugin-arg-find-bad-constructs'
' -Xclang check-weak-ptr-factory-order'
' -Xclang -plugin-arg-find-bad-constructs'
' -Xclang strict-virtual-specifiers') % LIB_PATH
#!/usr/bin/env bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script returns the flags that should be used when GYP_DEFINES contains
# clang_use_chrome_plugins. The flags are stored in a script so that they can
# be changed on the bots without requiring a master restart.
SRC_ABS_DIR=$(cd $(dirname $0)/../../.. && echo $PWD)
CLANG_LIB_PATH=$SRC_ABS_DIR/third_party/llvm-build/Release+Asserts/lib
if uname -s | grep -q Darwin; then
LIBSUFFIX=dylib
else
LIBSUFFIX=so
fi
echo -Xclang -load -Xclang $CLANG_LIB_PATH/libFindBadConstructs.$LIBSUFFIX \
-Xclang -add-plugin -Xclang find-bad-constructs
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment