From 40d1dbb12bb2e717b4a2eb41c34a5426e7bb4cdb Mon Sep 17 00:00:00 2001 From: "sbc@chromium.org" Date: Fri, 26 Oct 2012 07:18:00 +0000 Subject: Stop excluding native_client_sdk from PRESUBMIT Modify code in native_client_sdk to pass common PRESUBMIT tests. BUG= Review URL: https://chromiumcodereview.appspot.com/11201003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164279 0039d316-1c4b-4281-b951-d872f2087c98 --- native_client_sdk/src/build_tools/build_sdk.py | 48 +++++++++++----------- native_client_sdk/src/build_tools/dsc2gyp.py | 39 ++++++++++++------ native_client_sdk/src/build_tools/json/upload.sh | 4 -- .../src/examples/hello_world_gles/hello_world.cc | 15 ++++--- native_client_sdk/src/tools/oshelpers.py | 40 ++++++++++-------- 5 files changed, 82 insertions(+), 64 deletions(-) delete mode 100755 native_client_sdk/src/build_tools/json/upload.sh (limited to 'native_client_sdk') diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 08ab563..13cf633 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -153,7 +153,7 @@ def BuildStepBuildToolsTests(): def BuildStepDownloadToolchains(platform): buildbot_common.BuildStep('Rerun hooks to get toolchains') buildbot_common.Run(['gclient', 'runhooks'], - cwd=SRC_DIR, shell=(platform=='win')) + cwd=SRC_DIR, shell=(platform == 'win')) def BuildStepCleanPepperDirs(pepperdir, pepperdir_old): @@ -233,20 +233,17 @@ def BuildStepUntarToolchains(pepperdir, platform, arch, toolchains): # If the gyp options is specified we install a toolchain # wrapper so that gyp can switch toolchains via a commandline # option. - compiler_dir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') + bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') wrapper = os.path.join(SDK_SRC_DIR, 'tools', 'compiler-wrapper.py') - buildbot_common.MakeDir(compiler_dir) - buildbot_common.CopyFile(wrapper, compiler_dir) + buildbot_common.MakeDir(bindir) + buildbot_common.CopyFile(wrapper, bindir) # Module 'os' has no 'symlink' member (on Windows). # pylint: disable=E1101 - os.symlink('compiler-wrapper.py', - os.path.join(compiler_dir, 'i686-nacl-g++')) - os.symlink('compiler-wrapper.py', - os.path.join(compiler_dir, 'i686-nacl-gcc')) - os.symlink('compiler-wrapper.py', - os.path.join(compiler_dir, 'i686-nacl-ar')) + os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-g++')) + os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-gcc')) + os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-ar')) HEADER_MAP = { @@ -302,7 +299,8 @@ def InstallHeaders(tc_dst_inc, pepper_ver, tc_name): '--verbose', '--dstroot=%s/c' % ppapi] if pepper_ver: generator_args.append('--release=M' + pepper_ver) - buildbot_common.Run(generator_args, cwd=os.path.join(PPAPI_DIR, 'generators')) + buildbot_common.Run(generator_args, + cwd=os.path.join(PPAPI_DIR, 'generators')) # Remove private and trusted interfaces buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'private')) @@ -310,14 +308,14 @@ def InstallHeaders(tc_dst_inc, pepper_ver, tc_name): # Copy in the C++ headers buildbot_common.MakeDir(os.path.join(ppapi, 'cpp', 'dev')) - buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp','*.h'), + buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', '*.h'), os.path.join(ppapi, 'cpp')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', 'dev', '*.h'), os.path.join(ppapi, 'cpp', 'dev')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'graphics')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'threading')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'websocket')) - buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'utility','*.h'), + buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'utility', '*.h'), os.path.join(ppapi, 'utility')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'utility', 'graphics', '*.h'), os.path.join(ppapi, 'utility', 'graphics')) @@ -413,7 +411,7 @@ def GypNinjaBuild_X86(pepperdir, platform, toolchains): # TODO(binji): temporary hack; copy crt1.o from sdk toolchain directory. lib_dir = os.path.join(ninja_out_dir, 'gen', 'sdk', 'toolchain', - '%s_x86_%s' % (platform, tc), 'x86_64-nacl', 'lib') + '%s_x86_%s' % (platform, tc), 'x86_64-nacl', 'lib') if bits == '32': lib_dir += '32' buildbot_common.CopyFile(os.path.join(lib_dir, 'crt1.o'), dst_dir) @@ -458,8 +456,8 @@ def GypNinjaBuild_X86_Chrome(rel_out_dir): targets = ['ppapi_cpp_lib', 'ppapi_gles2_lib'] GypNinjaBuild('ia32', gyp_py, gyp_file, targets, out_dir) - gyp_file = os.path.join( - SRC_DIR, 'ppapi', 'native_client', 'native_client.gyp') + gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', + 'native_client.gyp') GypNinjaBuild('ia32', gyp_py, gyp_file, 'ppapi_lib', out_dir) @@ -470,8 +468,8 @@ def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') out_dir = MakeNinjaRelPath(rel_out_dir) - gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', 'untrusted', - 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') + gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', + 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') targets = ['pnacl_irt_shim'] GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir) @@ -497,7 +495,8 @@ def NinjaBuild(targets, out_dir): buildbot_common.Run(['ninja', '-C', out_config_dir] + targets, cwd=SRC_DIR) -def BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains): +def BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, + toolchains): buildbot_common.BuildStep('SDK Items') tcname = platform + '_' + arch @@ -521,12 +520,13 @@ def BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains): 'glibc') if 'pnacl' in toolchains: + shell = platform == 'win' buildbot_common.Run( GetBuildArgs('pnacl', pnacldir, pepperdir, 'x86', '32'), - cwd=NACL_DIR, shell=(platform=='win')) + cwd=NACL_DIR, shell=shell) buildbot_common.Run( GetBuildArgs('pnacl', pnacldir, pepperdir, 'x86', '64'), - cwd=NACL_DIR, shell=(platform=='win')) + cwd=NACL_DIR, shell=shell) for arch in ('ia32', 'arm'): # Fill in the latest native pnacl shim library from the chrome build. @@ -553,7 +553,7 @@ def BuildStepCopyBuildHelpers(pepperdir, platform): if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload(GSTORE + MAKE, - os.path.join(pepperdir, 'tools' ,'make.exe')) + os.path.join(pepperdir, 'tools', 'make.exe')) EXAMPLE_LIST = [ @@ -624,7 +624,6 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental, clobber): buildbot_common.MakeDir(os.path.join(libdir, '%s_%s_host' % (plat, arch), config)) - MakeDirectoryOrClobber(pepperdir, 'src', clobber) # Copy individual files @@ -813,6 +812,7 @@ TEST_LIBRARY_LIST = [ 'gtest_ppapi', ] + def BuildStepCopyTests(pepperdir, toolchains, build_experimental, clobber): buildbot_common.BuildStep('Copy Tests') @@ -894,7 +894,7 @@ def BuildStepArchiveBundle(pepper_ver, revision, tarfile): def BuildStepArchiveSDKTools(): # Only push up sdk_tools.tgz and nacl_sdk.zip on the linux buildbot. - builder_name = os.getenv('BUILDBOT_BUILDERNAME','') + builder_name = os.getenv('BUILDBOT_BUILDERNAME', '') if builder_name == 'linux-sdk-multi': buildbot_common.BuildStep('Archive SDK Tools') bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s' % ( diff --git a/native_client_sdk/src/build_tools/dsc2gyp.py b/native_client_sdk/src/build_tools/dsc2gyp.py index 6ee87f0..8dfca38 100755 --- a/native_client_sdk/src/build_tools/dsc2gyp.py +++ b/native_client_sdk/src/build_tools/dsc2gyp.py @@ -34,7 +34,8 @@ NEXE_TARGET = """\ 'libraries': %(LIBS)s, 'include_dirs': %(INCLUDES)s, 'cflags': ['-m32'] + %(CFLAGS)s, - 'make_valid_configurations': ['newlib-debug', 'newlib-release', 'glibc-debug', 'glibc-release'], + 'make_valid_configurations': ['newlib-debug', 'newlib-release', + 'glibc-debug', 'glibc-release'], 'ldflags': ['-m32'], 'toolset': 'target', %(CONFIGS)s @@ -46,7 +47,8 @@ NEXE_TARGET = """\ 'sources': %(SOURCES)s, 'libraries': %(LIBS)s, 'include_dirs': %(INCLUDES)s, - 'make_valid_configurations': ['newlib-debug', 'newlib-release', 'glibc-debug', 'glibc-release'], + 'make_valid_configurations': ['newlib-debug', 'newlib-release', + 'glibc-debug', 'glibc-release'], 'cflags': ['-m64'] + %(CFLAGS)s, 'ldflags': ['-m64'], 'toolset': 'target', @@ -84,7 +86,8 @@ HOST_EXE_TARGET = """\ 'make_valid_configurations': ['host-debug', 'host-release'], 'msvs_settings': { 'VCLinkerTool': { - 'AdditionalLibraryDirectories': ['../../lib/%(HOST)s_%(ARCH)s_host/<(CONFIGURATION_NAME)'], + 'AdditionalLibraryDirectories': + ['../../lib/%(HOST)s_%(ARCH)s_host/<(CONFIGURATION_NAME)'], } }, %(CONFIGS)s @@ -101,9 +104,11 @@ NMF_TARGET = """\ 'actions': [ { 'action_name': 'nmf', - 'inputs': ['<(PRODUCT_DIR)/%(NAME)s_x86_32.nexe', '<(PRODUCT_DIR)/%(NAME)s_x86_64.nexe'] + %(SODEPS)s, + 'inputs': ['<(PRODUCT_DIR)/%(NAME)s_x86_32.nexe', + '<(PRODUCT_DIR)/%(NAME)s_x86_64.nexe'] + %(SODEPS)s, 'outputs': ['<(PRODUCT_DIR)/%(NAME)s.nmf'], - 'action': ['../../tools/create_nmf.py', '-t', '%(TOOLCHAIN)s', '-s', '<(PRODUCT_DIR)'] + %(NMFACTION)s, + 'action': ['../../tools/create_nmf.py', '-t', '%(TOOLCHAIN)s', '-s', + '<(PRODUCT_DIR)'] + %(NMFACTION)s, }, ] }, @@ -120,12 +125,14 @@ TOOLCHAIN_CONFIG = """\ NEXE_CONFIG = """\ '%(toolchain)s-release' : { - 'cflags' : ['--%(toolchain)s', '-O2', '-idirafter', '../../include'], + 'cflags' : ['--%(toolchain)s', '-O2', + '-idirafter', '../../include'], 'ldflags' : ['--%(toolchain)s'], 'arflags' : ['--%(toolchain)s'], }, '%(toolchain)s-debug' : { - 'cflags' : ['--%(toolchain)s', '-g', '-O0', '-idirafter', '../../include'], + 'cflags' : ['--%(toolchain)s', '-g', '-O0', + '-idirafter', '../../include'], 'ldflags' : ['--%(toolchain)s'], 'arflags' : ['--%(toolchain)s'], }, @@ -134,26 +141,34 @@ NEXE_CONFIG = """\ WIN32_CONFIGS = """\ 'target_defaults': { 'default_configuration': 'Debug_PPAPI', - 'configurations' : { + 'configurations': { 'Debug_PPAPI': { 'msvs_configuration_platform': 'PPAPI', - 'msbuild_configuration_attributes': {'ConfigurationType': 'DynamicLibrary'}, + 'msbuild_configuration_attributes': { + 'ConfigurationType': 'DynamicLibrary' + }, 'include_dirs': ['../../include/win'], 'defines': ['_WINDOWS', '_DEBUG', 'WIN32'], }, 'Release_PPAPI': { 'msvs_configuration_platform': 'PPAPI', - 'msbuild_configuration_attributes': {'ConfigurationType': 'DynamicLibrary'}, + 'msbuild_configuration_attributes': { + 'ConfigurationType': 'DynamicLibrary' + }, 'include_dirs': ['../../include/win'], 'defines': ['_WINDOWS', 'NDEBUG', 'WIN32'], }, 'Debug_NaCl': { 'msvs_configuration_platform': 'NaCl', - 'msbuild_configuration_attributes': {'ConfigurationType': 'Application'}, + 'msbuild_configuration_attributes': { + 'ConfigurationType': 'Application' + }, }, 'Release_NaCl': { 'msvs_configuration_platform': 'NaCl', - 'msbuild_configuration_attributes': {'ConfigurationType': 'Application'}, + 'msbuild_configuration_attributes': { + 'ConfigurationType': 'Application' + }, }, }, }, diff --git a/native_client_sdk/src/build_tools/json/upload.sh b/native_client_sdk/src/build_tools/json/upload.sh deleted file mode 100755 index 7246812..0000000 --- a/native_client_sdk/src/build_tools/json/upload.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo DEPRECATED gsutil -h "Cache-Control: no-cache" cp -a public-read naclsdk_manifest.json gs://nativeclient-mirror/nacl/nacl_sdk/naclsdk_manifest.json -gsutil -h "Cache-Control: no-cache" cp -a public-read naclsdk_manifest0.json gs://nativeclient-mirror/nacl/nacl_sdk/naclsdk_manifest0.json -gsutil -h "Cache-Control: no-cache" cp -a public-read naclsdk_manifest2.json gs://nativeclient-mirror/nacl/nacl_sdk/naclsdk_manifest2.json diff --git a/native_client_sdk/src/examples/hello_world_gles/hello_world.cc b/native_client_sdk/src/examples/hello_world_gles/hello_world.cc index cfa4a24..c29c165 100644 --- a/native_client_sdk/src/examples/hello_world_gles/hello_world.cc +++ b/native_client_sdk/src/examples/hello_world_gles/hello_world.cc @@ -155,7 +155,7 @@ void InitGL(void) }; g_context = ppb_g3d_interface->Create(g_instance, 0, attribs); - int32_t success = ppb_instance_interface->BindGraphics(g_instance, g_context); + int32_t success = ppb_instance_interface->BindGraphics(g_instance, g_context); if (success == PP_FALSE) { glSetCurrentContextPPAPI(0); @@ -307,11 +307,14 @@ void Render( void ) //define the attributes of the vertex glBindBuffer(GL_ARRAY_BUFFER, g_vboID); - glVertexAttribPointer(g_positionLoc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,loc)); + glVertexAttribPointer(g_positionLoc, 3, GL_FLOAT, GL_FALSE, + sizeof(Vertex), (void*)offsetof(Vertex,loc)); glEnableVertexAttribArray(g_positionLoc); - glVertexAttribPointer(g_texCoordLoc, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,tu)); + glVertexAttribPointer(g_texCoordLoc, 2, GL_FLOAT, GL_FALSE, + sizeof(Vertex), (void*)offsetof(Vertex,tu)); glEnableVertexAttribArray(g_texCoordLoc); - glVertexAttribPointer(g_colorLoc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex,color)); + glVertexAttribPointer(g_colorLoc, 3, GL_FLOAT, GL_FALSE, + sizeof(Vertex), (void*)offsetof(Vertex,color)); glEnableVertexAttribArray(g_colorLoc); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ibID); @@ -397,8 +400,8 @@ static void URLOpened(void* user_data, int mode) { req->buf_ = (char *) malloc(cnt + 1); req->buf_[cnt] = 0; req->size_ = cnt; - int32_t bytes = ppb_urlloader_interface->ReadResponseBody(req->loader_, req->buf_, cnt, - PP_MakeCompletionCallback(URLPartialRead, req)); + int32_t bytes = ppb_urlloader_interface->ReadResponseBody(req->loader_, + req->buf_, cnt, PP_MakeCompletionCallback(URLPartialRead, req)); // Usually we are pending. if (bytes == PP_OK_COMPLETIONPENDING) return; diff --git a/native_client_sdk/src/tools/oshelpers.py b/native_client_sdk/src/tools/oshelpers.py index 253afa7..fe9f64e 100755 --- a/native_client_sdk/src/tools/oshelpers.py +++ b/native_client_sdk/src/tools/oshelpers.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2012 The Native Client Authors. All rights reserved. +# 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. @@ -16,10 +16,10 @@ import zipfile def IncludeFiles(filters, files): """Filter files based on inclusion lists - + Return a list of files which match and of the Unix shell-style wildcards provided, or return all the files if no filter is provided.""" - if not filters: + if not filters: return files match = set() for file_filter in filters: @@ -29,10 +29,10 @@ def IncludeFiles(filters, files): def ExcludeFiles(filters, files): """Filter files based on exclusions lists - + Return a list of files which do not match any of the Unix shell-style wildcards provided, or return all the files if no filter is provided.""" - if not filters: + if not filters: return files match = set() for file_filter in filters: @@ -43,7 +43,7 @@ def ExcludeFiles(filters, files): def CopyPath(options, src, dst): """CopyPath from src to dst - + Copy a fully specified src to a fully specified dst. If src and dst are both files, the dst file is removed first to prevent error. If and include or exclude list are provided, the destination is first matched against that @@ -99,8 +99,8 @@ def CopyPath(options, src, dst): def Copy(args): """A Unix cp style copy. - - Copies multiple sources to a single destination using the normal cp + + Copies multiple sources to a single destination using the normal cp semantics. In addition, it support inclusion and exclusion filters which allows the copy to skip certain types of files.""" parser = optparse.OptionParser(usage='usage: cp [Options] souces... dest') @@ -175,11 +175,11 @@ def Mkdir(args): def MovePath(options, src, dst): """MovePath from src to dst - + Moves the src to the dst much like the Unix style mv command, except it only handles one source at a time. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry - up to five times.""" + up to five times.""" # if the destination is not an existing directory, then overwrite it if os.path.isdir(dst): dst = os.path.join(dst, os.path.basename(src)) @@ -230,10 +230,10 @@ def Move(args): def Remove(args): """A Unix style rm. - + Removes the list of paths. Because of possible temporary failures do to locks (such as anti-virus software on Windows), the function will retry up to five - times.""" + times.""" parser = optparse.OptionParser(usage='usage: rm [Options] PATHS...') parser.add_option( '-R', '-r', '--recursive', dest='recursive', action='store_true', @@ -297,7 +297,7 @@ def Remove(args): print error return 0 - + def MakeZipPath(os_path, isdir, iswindows): """Changes a path into zipfile format. @@ -456,9 +456,13 @@ FuncMap = { } -if __name__ == '__main__': - func = FuncMap.get(sys.argv[1]) +def main(args): + func = FuncMap.get(args[1]) if not func: - print 'Do not recognize: ' + sys.argv[1] - sys.exit(1) - sys.exit(func(sys.argv[2:])) + print 'Do not recognize command: ' + args[1] + print 'Available commands: %s' % ' '.join(FuncMap) + return 1 + return func(args[2:]) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) -- cgit v1.1