Files
yoga/lib/gtest/BUCK
Michal Lowicki 597354a43b Enable build file sandboxing in fbandroid
Summary:
Enable build file sandboxing in fbandroid.
Importing modules in build files that are not whitelisted will be blocked, this can be overriden by using

  with allow_unsafe_import():
      import foo

`import os` and `import os.path` will not be blocked and will import a safe version of `os` module instead (functions not accessing the file system like `os.path.join()` will be accessible), full `os` module can be imported using `allow_unsafe_import()`

Reviewed By: plamenko

Differential Revision: D3649817

fbshipit-source-id: 3e6a3ab9c4c6a56a99ca7adf599323143a5844f4
2016-08-12 09:38:05 -07:00

44 lines
1.3 KiB
Python

# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
with allow_unsafe_import():
import os
import urllib2
import zipfile
include_defs('//CSSLAYOUT_DEFS')
# Download gtest dep if it does not exists in path
current_dir = os.path.dirname(os.path.realpath(__file__))
gtest_folder = 'googletest-release-1.7.0'
if GTEST_DL_URL != None and not os.path.isdir(current_dir + gtest_folder):
gtest = urllib2.urlopen('https://github.com/google/googletest/archive/release-1.7.0.zip').read()
with open("gtest.zip", 'w') as f:
f.write(gtest)
with zipfile.ZipFile('gtest.zip',"r") as zip:
zip.extractall(os.path.dirname(os.path.realpath(__file__)))
os.remove('gtest.zip')
COMPILER_FLAGS = [
'-std=c++11',
'-Wno-missing-prototypes',
]
cxx_library(
name = 'gtest',
srcs = glob([gtest_folder + '/src/*.cc']),
exported_headers = subdir_glob([
(gtest_folder + '/include', '**/*.h'),
(gtest_folder, 'src/*.h'),
(gtest_folder, 'src/*.cc'),
]),
header_namespace = '',
compiler_flags = COMPILER_FLAGS,
deps = [],
visibility = [CSSLAYOUT_ROOT],
)