summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/DEPS_chrome72
-rw-r--r--o3d/DEPS_gyp34
-rw-r--r--o3d/build/build_nacl.py174
-rw-r--r--o3d/build/common.gypi13
-rw-r--r--o3d/build/o3d.gyp15
-rw-r--r--o3d/build/o3d_all.gyp (renamed from o3d/build/all.gyp)10
-rw-r--r--o3d/build/o3d_minimal.gyp36
-rw-r--r--o3d/build/select_dependencies.py34
-rwxr-xr-xo3d/documentation/build_docs.py804
-rw-r--r--o3d/plugin/cross/main.h8
-rw-r--r--o3d/plugin/idl/codegen.py2
-rw-r--r--o3d/plugin/idl/idl.gyp21
-rw-r--r--o3d/plugin/plugin.gyp251
-rw-r--r--o3d/plugin/version_info.py2
-rw-r--r--o3d/samples/split_samples.py183
-rw-r--r--o3d/tests/selenium/main.py3
-rw-r--r--o3d/tests/selenium/unpack_firefox.py2
17 files changed, 819 insertions, 845 deletions
diff --git a/o3d/DEPS_chrome b/o3d/DEPS_chrome
new file mode 100644
index 0000000..0635b87
--- /dev/null
+++ b/o3d/DEPS_chrome
@@ -0,0 +1,72 @@
+vars = {
+ "o3d_code_rev": "149",
+}
+
+deps = {
+ "src/o3d/o3d_assets":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/o3d_assets@" + Var("o3d_code_rev"),
+
+ "src/third_party/antlr3":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/antlr3@" + Var("o3d_code_rev"),
+
+ "src/third_party/cg":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/cg@" + Var("o3d_code_rev"),
+
+ "src/third_party/fcollada":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/fcollada@" + Var("o3d_code_rev"),
+
+ "src/third_party/jsdoctoolkit":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/jsdoctoolkit@" + Var("o3d_code_rev"),
+
+ "src/third_party/pdiff":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/pdiff@" + Var("o3d_code_rev"),
+
+ "src/third_party/zip_utils":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/zip_utils@" + Var("o3d_code_rev"),
+
+ "src/third_party/selenium_rc":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/selenium_rc@" + Var("o3d_code_rev"),
+}
+
+deps_os = {
+ "win": {
+ "src/third_party/wix_2_0_4221":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/wix_2_0_4221@" + Var("o3d_code_rev"),
+ },
+}
+vars = {
+ "o3d_code_rev": "149",
+}
+
+deps = {
+ "src/o3d/o3d_assets":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/o3d_assets@" + Var("o3d_code_rev"),
+
+ "src/third_party/antlr3":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/antlr3@" + Var("o3d_code_rev"),
+
+ "src/third_party/cg":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/cg@" + Var("o3d_code_rev"),
+
+ "src/third_party/fcollada":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/fcollada@" + Var("o3d_code_rev"),
+
+ "src/third_party/jsdoctoolkit":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/jsdoctoolkit@" + Var("o3d_code_rev"),
+
+ "src/third_party/pdiff":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/pdiff@" + Var("o3d_code_rev"),
+
+ "src/third_party/zip_utils":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/zip_utils@" + Var("o3d_code_rev"),
+
+ "src/third_party/selenium_rc":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/selenium_rc@" + Var("o3d_code_rev"),
+}
+
+deps_os = {
+ "win": {
+ "src/third_party/wix_2_0_4221":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/wix_2_0_4221@" + Var("o3d_code_rev"),
+ },
+} \ No newline at end of file
diff --git a/o3d/DEPS_gyp b/o3d/DEPS_gyp
index 3fccefa..f06121e 100644
--- a/o3d/DEPS_gyp
+++ b/o3d/DEPS_gyp
@@ -41,15 +41,29 @@ deps = {
"third_party/scons":
"http://o3d.googlecode.com/svn/trunk/googleclient/third_party/scons@" + Var("o3d_code_rev"),
- "third_party/vectormath":
- "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/vectormath@" + Var("o3d_code_rev"),
-
"third_party/zip_utils":
"http://o3d.googlecode.com/svn/trunk/googleclient/third_party/zip_utils@" + Var("o3d_code_rev"),
"third_party/selenium_rc":
"http://o3d.googlecode.com/svn/trunk/googleclient/third_party/selenium_rc@" + Var("o3d_code_rev"),
+# Stuff that is O3D specific (from a Chrome point of view).
+
+ "o3d/third_party/vectormath":
+ "http://o3d.googlecode.com/svn/trunk/googleclient/third_party/vectormath@" + Var("o3d_code_rev"),
+
+ "o3d/third_party/nixysa":
+ "http://nixysa.googlecode.com/svn/trunk/nixysa@" + Var("nixysa_rev"),
+
+ "o3d/third_party/npapi":
+ "http://nixysa.googlecode.com/svn/trunk/third_party/npapi@" + Var("nixysa_rev"),
+
+ "o3d/third_party/ply":
+ "http://nixysa.googlecode.com/svn/trunk/third_party/ply-3.1@" + Var("nixysa_rev"),
+
+ "o3d/third_party/gflags":
+ "http://google-gflags.googlecode.com/svn/trunk@" + Var("gflags_rev"),
+
# Stuff from the Chromium tree.
"third_party/harfbuzz":
@@ -97,18 +111,6 @@ deps = {
"breakpad/src":
"http://google-breakpad.googlecode.com/svn/trunk/src@" + Var("breakpad_rev"),
- "third_party/nixysa":
- "http://nixysa.googlecode.com/svn/trunk/nixysa@" + Var("nixysa_rev"),
-
- "third_party/npapi":
- "http://nixysa.googlecode.com/svn/trunk/third_party/npapi@" + Var("nixysa_rev"),
-
- "third_party/ply":
- "http://nixysa.googlecode.com/svn/trunk/third_party/ply-3.1@" + Var("nixysa_rev"),
-
- "third_party/gflags":
- "http://google-gflags.googlecode.com/svn/trunk@" + Var("gflags_rev"),
-
"testing/gtest":
"http://googletest.googlecode.com/svn/trunk@" + Var("gtest_rev"),
@@ -155,6 +157,6 @@ hooks = [
{
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": "\\.gypi?$|[/\\\\]src[/\\\\]tools[/\\\\]gyp[/\\\\]|[/\\\\]src[/\\\\]o3d[/\\\\]build[/\\\\]gyp_o3d$|MANIFEST$",
- "action": ["python", "o3d/build/gyp_o3d", "o3d/build/all.gyp"],
+ "action": ["python", "o3d/build/gyp_o3d", "o3d/build/o3d.gyp"],
},
]
diff --git a/o3d/build/build_nacl.py b/o3d/build/build_nacl.py
deleted file mode 100644
index af4c5cf..0000000
--- a/o3d/build/build_nacl.py
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/python2.4
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file is just here so that we can modify the python path before
-# invoking nixysa.
-
-import os
-import os.path
-import shutil
-import subprocess
-import sys
-
-third_party = os.path.join('..', '..', 'third_party')
-gflags_dir = os.path.join(third_party, 'gflags', 'python')
-sys.path.append(gflags_dir)
-
-import gflags
-
-FLAGS = gflags.FLAGS
-gflags.DEFINE_string('configuration', 'Debug',
- 'Specify which configuration to build.')
-
-gflags.DEFINE_string('platform', 'win',
- 'Specify which platform to build.')
-
-gflags.DEFINE_boolean('debug', False,
- 'Whether or not to turn on debug output '
- 'when running scons.')
-
-gflags.DEFINE_string('output', '.', 'Sets the output directory.')
-
-
-def CopyIfNewer(inputs, output_dir):
- '''Copy the inputs to the output directory, but only if the files are
- newer than the destination files.'''
- for input in inputs:
- output = os.path.join(output_dir, os.path.basename(input))
- if os.path.exists(input):
- if (not os.path.exists(output) or
- os.path.getmtime(input) > os.path.getmtime(output)):
- try:
- print 'Copying from %s to %s' % (input, output)
- shutil.copy2(input, output)
- except:
- return False
- else:
- print '%s is up to date.' % output
- return True
-
-def PrependToPath(path, item):
- '''Prepend an item to an environment variable path.'''
- orig_path = os.environ.get(path)
- if orig_path:
- new_path = os.pathsep.join([item, orig_path])
- else:
- new_path = item
-
- os.environ[path] = new_path
-
-def AppendToPath(path, item):
- '''Append an item to an environment variable path.'''
- orig_path = os.environ.get(path)
- if orig_path:
- new_path = os.pathsep.join([orig_path, item])
- else:
- new_path = item
-
- os.environ[path] = new_path
-
-def FindPlatformSDK():
- '''On Windows, find the installed location of the Platform SDK.'''
- import _winreg
- try:
- winsdk_key = _winreg.OpenKey(
- _winreg.HKEY_LOCAL_MACHINE,
- 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.1\\WinSDKBuild')
- except WindowsError:
- try:
- winsdk_key = _winreg.OpenKey(
- _winreg.HKEY_LOCAL_MACHINE,
- 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A\\WinSDKBuild')
- except WindowsError:
- try:
- winsdk_key = _winreg.OpenKey(
- _winreg.HKEY_LOCAL_MACHINE,
- 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v6.0A\\VistaClientHeadersLibs')
- except WindowsError:
- print 'The Windows SDK version 6.0 or later needs to be installed'
- sys.exit(1)
- try:
- winsdk_dir, value_type = _winreg.QueryValueEx(winsdk_key,
- 'InstallationFolder')
- except WindowsError:
- print 'The Windows SDK version 6.0 or later needs to be installed'
- sys.exit(1)
- _winreg.CloseKey(winsdk_key)
-
- # Strip off trailing slashes
- winsdk_dir = winsdk_dir.rstrip('\\/')
- AppendToPath('PATH', os.path.join(winsdk_dir, 'Bin'))
- AppendToPath('INCLUDE', os.path.join(winsdk_dir, 'Include'))
- AppendToPath('LIB', os.path.join(winsdk_dir, 'Lib'))
-
-def main(args):
- extra_args = FLAGS(args)
- # strip off argv[0]
- extra_args = extra_args[1:]
-
- pythonpath = os.path.join(third_party, 'scons', 'scons-local')
- PrependToPath('PYTHONPATH', pythonpath)
-
- binutils_path = os.path.join(third_party, 'gnu_binutils', 'files')
- AppendToPath('PATH', binutils_path)
-
- config = 'opt'
- if FLAGS.configuration == 'Debug':
- config = 'dbg'
- elif FLAGS.configuration == 'Release':
- config = 'opt'
-
- mode = '%s-%s' % (config, FLAGS.platform)
-
- native_client_dir = os.path.join(third_party, 'native_client',
- 'googleclient', 'native_client')
-
- args = [
- 'MODE=%s' % mode,
- 'naclsdk_validate=0',
- 'sdl=none',
- '--verbose',
- '--file=SConstruct',
- '-C',
- native_client_dir,
- ]
- scons = os.path.join(third_party, 'scons', 'scons.py')
- args = [sys.executable, scons] + args + extra_args
-
- # Add the platform SDK to INCLUDE and LIB
- if FLAGS.platform == 'win':
- FindPlatformSDK()
-
- print 'Executing %s' % ' '.join(args)
- status = subprocess.call(args)
-
- # Calculate what the output files should be.
- outputs = []
- for arg in extra_args:
- file_path = os.path.join(native_client_dir,
- 'scons-out', mode, 'lib', arg)
- if FLAGS.platform == 'win':
- file_path = file_path + '.lib'
- else:
- file_path = file_path + '.a'
- outputs.append(file_path)
-
- if status == 0 and not CopyIfNewer(outputs, FLAGS.output):
- sys.exit(-1)
- else:
- sys.exit(status)
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi
index 64613e7..31697fd 100644
--- a/o3d/build/common.gypi
+++ b/o3d/build/common.gypi
@@ -12,15 +12,21 @@
'gtestdir': 'testing/gtest/include',
'jpegdir': 'third_party/libjpeg',
'nacldir': 'third_party/native_client/googleclient',
- 'nixysadir': 'third_party/nixysa',
- 'npapidir': 'third_party/npapi',
+ 'nixysadir': 'o3d/third_party/nixysa',
+ 'npapidir': 'o3d/third_party/npapi',
'pdiffdir': 'third_party/pdiff/files',
'pngdir': 'third_party/libpng',
'screenshotsdir': 'o3d_assets/tests/screenshots',
'seleniumdir': 'third_party/selenium_rc/files',
'skiadir': 'third_party/skia/include',
'zlibdir': 'third_party/zlib',
- 'o3d_in_chrome%': 0,
+ # If the DEPS file exists two levels up, then we're in a Chrome tree.
+ 'o3d_in_chrome%': '<!(python <(DEPTH)/o3d/build/file_exists.py ../../DEPS)',
+ # We default to building everything only if the assets exist.
+ # (and the teapot is the least likely asset to change).
+ # This is so that chrome developers get a much reduced dependency set.
+ 'o3d_developer%': '<!(python <(DEPTH)/o3d/build/file_exists.py '
+ '../o3d_assets/samples/convert_assets/teapot.zip)',
'selenium_screenshots%': 0,
},
'target_defaults': {
@@ -66,6 +72,7 @@
'OS_WIN',
'UNICODE',
'NACL_WINDOWS',
+ '_X86_',
],
# Disable warning: "'this' : used in base member initialization list."
'msvs_disabled_warnings': [4355],
diff --git a/o3d/build/o3d.gyp b/o3d/build/o3d.gyp
new file mode 100644
index 0000000..14832d1
--- /dev/null
+++ b/o3d/build/o3d.gyp
@@ -0,0 +1,15 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'O3D',
+ 'type': 'none',
+ 'dependencies': [
+ '<!(python select_dependencies.py):*',
+ ],
+ },
+ ],
+}
diff --git a/o3d/build/all.gyp b/o3d/build/o3d_all.gyp
index 00e02ae..9901e71 100644
--- a/o3d/build/all.gyp
+++ b/o3d/build/o3d_all.gyp
@@ -8,7 +8,7 @@
],
'targets': [
{
- 'target_name': 'All',
+ 'target_name': 'O3D_All',
'type': 'none',
'dependencies': [
'../../<(antlrdir)/antlr.gyp:*',
@@ -25,10 +25,10 @@
'../import/import.gyp:o3dImport',
'../installer/installer.gyp:installer',
'../plugin/idl/idl.gyp:o3dPluginIdl',
+ '../plugin/idl/idl.gyp:o3dNpnApi',
'../plugin/plugin.gyp:npo3dautoplugin',
'../samples/samples.gyp:*',
'../tests/selenium/selenium.gyp:*',
- '../serializer/serializer.gyp:o3dSerializer',
'../tests/tests.gyp:unit_tests',
'../utils/utils.gyp:o3dUtils',
],
@@ -51,9 +51,3 @@
},
],
}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/o3d/build/o3d_minimal.gyp b/o3d/build/o3d_minimal.gyp
new file mode 100644
index 0000000..399638b
--- /dev/null
+++ b/o3d/build/o3d_minimal.gyp
@@ -0,0 +1,36 @@
+# Copyright (c) 2009 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.
+
+{
+ 'includes': [
+ 'common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'O3D_Minimal',
+ 'type': 'none',
+ 'dependencies': [
+ '../plugin/plugin.gyp:o3dPlugin_gen',
+ ],
+ },
+ ],
+}
+# Copyright (c) 2009 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.
+
+{
+ 'includes': [
+ 'common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'O3D_Minimal',
+ 'type': 'none',
+ 'dependencies': [
+ '../plugin/plugin.gyp:o3dPlugin_gen',
+ ],
+ },
+ ],
+}
diff --git a/o3d/build/select_dependencies.py b/o3d/build/select_dependencies.py
new file mode 100644
index 0000000..a69afe2
--- /dev/null
+++ b/o3d/build/select_dependencies.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# Copyright (c) 2009 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 file selects which of the sets of dependencies are used
+ when Chrome includes o3d.gyp"""
+
+import os.path
+import sys
+
+has_assets = os.path.exists(os.path.join("..", "o3d_assets"))
+if has_assets:
+ print "o3d_all.gyp"
+else:
+ print "o3d_minimal.gyp"
+sys.exit(0)
+#!/usr/bin/env python
+# Copyright (c) 2009 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 file selects which of the sets of dependencies are used
+ when Chrome includes o3d.gyp"""
+
+import os.path
+import sys
+
+has_assets = os.path.exists(os.path.join("..", "o3d_assets"))
+if has_assets:
+ print "o3d_all.gyp"
+else:
+ print "o3d_minimal.gyp"
+sys.exit(0)
diff --git a/o3d/documentation/build_docs.py b/o3d/documentation/build_docs.py
index 0138193..abf7046 100755
--- a/o3d/documentation/build_docs.py
+++ b/o3d/documentation/build_docs.py
@@ -1,400 +1,404 @@
-#!/usr/bin/python2.4
-# Copyright 2009, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-"""Docbuilder for O3D and o3djs."""
-
-
-import os
-import os.path
-import sys
-import imp
-import types
-import glob
-import subprocess
-import shutil
-import re
-
-
-_java_exe = ''
-_output_dir = ''
-_third_party_dir = ''
-_script_path = os.path.dirname(os.path.realpath(__file__))
-_js_copyright = """
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-"""
-
-GlobalsDict = { }
-
-
-def MakePath(*file_paths):
- """Makes a path absolute given a path relative to this script."""
- return os.path.join(_script_path, *file_paths)
-
-
-def MakeCommandName(name):
- """adds '.exe' if on Windows"""
- if os.name == 'nt':
- return name + '.exe'
- return name
-
-
-def UpdateGlobals(dict):
- """Copies pairs from dict into GlobalDict."""
- for i, v in dict.items():
- GlobalsDict.__setitem__(i, v)
-
-
-def GetCallingNamespaces():
- """Return the locals and globals for the function that called
- into this module in the current call stack."""
- try: 1/0
- except ZeroDivisionError:
- # Don't start iterating with the current stack-frame to
- # prevent creating reference cycles (f_back is safe).
- frame = sys.exc_info()[2].tb_frame.f_back
-
- # Find the first frame that *isn't* from this file
- while frame.f_globals.get("__name__") == __name__:
- frame = frame.f_back
-
- return frame.f_locals, frame.f_globals
-
-
-def ComputeExports(exports):
- """Compute a dictionary of exports given one of the parameters
- to the Export() function or the exports argument to SConscript()."""
-
- loc, glob = GetCallingNamespaces()
-
- retval = {}
- try:
- for export in exports:
- if isinstance(export, types.DictType):
- retval.update(export)
- else:
- try:
- retval[export] = loc[export]
- except KeyError:
- retval[export] = glob[export]
- except KeyError, x:
- raise Error, "Export of non-existent variable '%s'"%x
-
- return retval
-
-
-def Export(*vars):
- """Copies the named variables to GlobalDict."""
- for var in vars:
- UpdateGlobals(ComputeExports(vars))
-
-
-def Import(filename):
- """Imports a python file in a scope with 'Export' defined."""
- scope = {'__builtins__': globals()['__builtins__'],
- 'Export': Export}
- file = open(filename, 'r')
- exec file in scope
- file.close()
-
-
-def Execute(args):
- """Executes an external program."""
- # Comment the next line in for debugging.
- # print "Execute: ", ' '.join(args)
- if subprocess.call(args) > 0:
- raise RuntimeError('FAILED: ' + ' '.join(args))
-
-
-def AppendBasePath(folder, filenames):
- """Appends a base path to a ist of files"""
- return [os.path.join(folder, filename) for filename in filenames]
-
-
-def RunNixysa(idl_files, generate, output_dir, nixysa_options):
- """Executes Nixysa."""
- Execute([
- sys.executable,
- MakePath(_third_party_dir, 'nixysa', 'codegen.py'),
- '--binding-module=o3d:%s' % MakePath('..', 'plugin', 'o3d_binding.py'),
- '--generate=' + generate,
- '--force',
- '--output-dir=' + output_dir] +
- nixysa_options +
- idl_files)
-
-
-def RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir, prefix, mode,
- baseURL, topURL, exports_file):
- """Executes the JSDocToolkit."""
- list_filename = MakePath(_output_dir, 'doclist.conf')
- f = open(list_filename, 'w')
- f.write('{\nD:{\n')
- f.write('prefix: "%s",\n' % prefix)
- f.write('baseURL: "%s",\n' % baseURL)
- f.write('topURL: "%s",\n' % topURL)
- f.write('mode: "%s",\n' % mode)
- f.write('htmlOutDir: "%s",\n' % html_output_dir.replace('\\', '/'))
- f.write('exportsFile: "%s",\n' % exports_file.replace('\\', '/'))
- f.write('endMarker: ""\n')
- f.write('},\n')
- f.write('_: [\n')
- for filename in js_files:
- f.write('"%s",\n' % filename.replace('\\', '/'))
- f.write(']\n}\n')
- f.close()
-
- files_dir = MakePath(_third_party_dir, 'jsdoctoolkit', 'files')
- Execute([
- _java_exe,
- '-Djsdoc.dir=%s' % files_dir,
- '-jar',
- MakePath(files_dir, 'jsrun.jar'),
- MakePath(files_dir, 'app', 'run.js'),
- '-v',
- '-t=%s' % MakePath('jsdoc-toolkit-templates'),
- '-d=' + ezt_output_dir,
- '-c=' + list_filename])
-
-
-def DeleteOldDocs(docs_js_outpath):
- try:
- shutil.rmtree(docs_js_outpath);
- except:
- pass
-
-def BuildJavaScriptForDocsFromIDLs(idl_files, output_dir):
- RunNixysa(idl_files, 'jsheader', output_dir, ['--properties-equal-undefined'])
-
-
-def BuildJavaScriptForExternsFromIDLs(idl_files, output_dir):
- if (os.path.exists(output_dir)):
- for filename in glob.glob(os.path.join(output_dir, '*.js')):
- os.unlink(filename)
- RunNixysa(idl_files, 'jsheader', output_dir, ['--no-return-docs'])
-
-
-def BuildO3DDocsFromJavaScript(js_files, ezt_output_dir, html_output_dir):
- RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir,
- 'classo3d_1_1_', 'o3d', '', '', '')
-
-
-def BuildO3DClassHierarchy(html_output_dir):
- # TODO(gman): We need to make mutliple graphs. One for Params, one for
- # ParamMatrix4, one for RenderNode, one for everythng else.
- dot_path = MakePath(_third_party_dir, 'graphviz', 'files', 'bin',
- MakeCommandName('dot'))
- if os.path.exists(dot_path):
- Execute([
- dot_path,
- '-Tcmapx', '-o' + MakePath(html_output_dir, 'class_hierarchy.map'),
- '-Tpng', '-o' + MakePath(html_output_dir, 'class_hierarchy.png'),
- MakePath(html_output_dir, 'class_hierarchy.dot')])
-
-
-def BuildO3DJSDocs(js_files, ezt_output_dir, html_output_dir, exports_file):
- # The backslashes below on 'jsdocs/' and '../' must stay.
- RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir, 'js_1_0_', 'o3djs',
- 'jsdocs/', '../', exports_file)
-
-
-def BuildO3DExternsFile(js_files_dir, extra_externs_file, externs_file):
- outfile = open(externs_file, 'w')
- filenames = (glob.glob(os.path.join(js_files_dir, '*.js')) +
- [extra_externs_file])
- for filename in filenames:
- print "-----", filename
- infile = open(filename, 'r')
- lines = infile.readlines()
- infile.close()
- filtered = []
- skipping = False
- # strip out @o3dparameter stuff
- for line in lines:
- if skipping:
- if line.startswith(' * @') or line.startswith(' */'):
- skipping = False
- if not skipping:
- if line.startswith(' * @o3dparameter'):
- skipping = True
- if not skipping:
- filtered.append(line)
- outfile.write(''.join(filtered))
- outfile.close()
-
-
-def BuildCompiledO3DJS(o3djs_files,
- externs_path,
- o3d_externs_js_path,
- compiled_o3djs_outpath):
- Execute([
- _java_exe,
- '-jar',
- MakePath('..', '..', 'o3d-internal', 'jscomp', 'JSCompiler_deploy.jar'),
- '--property_renaming', 'OFF',
- '--variable_renaming', 'LOCAL',
- '--strict',
- '--externs=%s' % externs_path,
- ('--externs=%s' % o3d_externs_js_path),
- ('--js_output_file=%s' % compiled_o3djs_outpath)] +
- ['-js=%s' % (x, ) for x in o3djs_files]);
-
- # strip out goog.exportSymbol and move o3djs.require to end
- file = open(compiled_o3djs_outpath, 'r')
- contents = file.read()
- file.close()
- contents = re.sub(r'goog.exportSymbol\([^\)]*\);', '', contents)
- requires = set(re.findall(r'o3djs.require\([^\)]*\);', contents))
- contents = re.sub(r'o3djs.require\([^\)]*\);', '', contents)
- file = open(compiled_o3djs_outpath, 'w')
- file.write(_js_copyright)
- file.write(contents)
- file.write('\n')
- file.write('\n'.join(requires))
- file.close()
-
-
-def CopyStaticFiles(o3d_docs_ezt_outpath, o3d_docs_html_outpath):
- files = ['stylesheet.css',
- 'prettify.css',
- 'prettify.js',
- 'tabs.css',
- 'tab_l.gif',
- 'tab_r.gif',
- 'tab_b.gif']
- for file in files:
- shutil.copyfile(MakePath('jsdoc-toolkit-templates', 'static', file),
- MakePath(os.path.join(o3d_docs_ezt_outpath, file)))
- shutil.copyfile(MakePath('jsdoc-toolkit-templates', 'static', file),
- MakePath(os.path.join(o3d_docs_html_outpath, file)))
-
-
-def main(argv):
- """Builds the O3D API docs and externs and the o3djs docs."""
- global _java_exe
- _java_exe = argv[0]
- global _third_party_dir
- _third_party_dir = argv[1]
-
- # Fix up the python path of subprocesses by setting PYTHONPATH.
- pythonpath = os.pathsep.join([MakePath(_third_party_dir, 'gflags', 'python'),
- MakePath(_third_party_dir, 'ply')])
-
- orig_pythonpath = os.environ.get('PYTHONPATH')
- if orig_pythonpath:
- pythonpath = os.pathsep.join([pythonpath, orig_pythonpath])
-
- os.environ['PYTHONPATH'] = pythonpath
-
- js_list_filename = MakePath('..', 'samples', 'o3djs', 'js_list.scons')
- idl_list_filename = MakePath('..', 'plugin', 'idl_list.scons')
- js_list_basepath = os.path.dirname(js_list_filename)
- idl_list_basepath = os.path.dirname(idl_list_filename)
-
- global _output_dir
- _output_dir = argv[2]
- docs_outpath = os.path.join(_output_dir, 'documentation')
- docs_js_outpath = MakePath(docs_outpath, 'apijs')
- externs_js_outpath = MakePath(_output_dir, 'externs')
- o3d_docs_ezt_outpath = MakePath(docs_outpath, 'reference')
- o3d_docs_html_outpath = MakePath(docs_outpath, 'local_html')
- o3djs_docs_ezt_outpath = MakePath(docs_outpath, 'reference', 'jsdocs')
- o3djs_docs_html_outpath = MakePath(docs_outpath, 'local_html', 'jsdocs')
- o3d_externs_path = MakePath(_output_dir, 'o3d-externs.js')
- o3djs_exports_path = MakePath(_output_dir, 'o3d-exports.js')
- compiled_o3djs_outpath = MakePath(docs_outpath, 'base.js')
- externs_path = MakePath('externs', 'externs.js')
- o3d_extra_externs_path = MakePath('externs', 'o3d-extra-externs.js')
-
- Import(js_list_filename)
- Import(idl_list_filename)
-
- idl_files = AppendBasePath(idl_list_basepath, GlobalsDict['O3D_IDL_SOURCES'])
- o3djs_files = AppendBasePath(js_list_basepath, GlobalsDict['O3D_JS_SOURCES'])
-
- # we need to put base.js first?
- o3djs_files = (
- filter(lambda x: x.endswith('base.js'), o3djs_files) +
- filter(lambda x: not x.endswith('base.js'), o3djs_files))
-
- docs_js_files = [os.path.join(
- docs_js_outpath,
- os.path.splitext(os.path.basename(f))[0] + '.js')
- for f in GlobalsDict['O3D_IDL_SOURCES']]
-
- DeleteOldDocs(MakePath(docs_outpath))
- BuildJavaScriptForDocsFromIDLs(idl_files, docs_js_outpath)
- BuildO3DDocsFromJavaScript([o3d_extra_externs_path] + docs_js_files,
- o3d_docs_ezt_outpath, o3d_docs_html_outpath)
- BuildO3DClassHierarchy(o3d_docs_html_outpath)
- BuildJavaScriptForExternsFromIDLs(idl_files, externs_js_outpath)
- BuildO3DExternsFile(externs_js_outpath,
- o3d_extra_externs_path,
- o3d_externs_path)
- BuildO3DJSDocs(o3djs_files + [o3d_externs_path], o3djs_docs_ezt_outpath,
- o3djs_docs_html_outpath, o3djs_exports_path)
- CopyStaticFiles(o3d_docs_ezt_outpath, o3d_docs_html_outpath)
- BuildCompiledO3DJS(o3djs_files + [o3djs_exports_path],
- externs_path,
- o3d_externs_path,
- compiled_o3djs_outpath)
-
-
-if __name__ == '__main__':
- main(sys.argv[1:])
+#!/usr/bin/python2.4
+# Copyright 2009, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+"""Docbuilder for O3D and o3djs."""
+
+
+import os
+import os.path
+import sys
+import imp
+import types
+import glob
+import subprocess
+import shutil
+import re
+
+
+_java_exe = ''
+_output_dir = ''
+_third_party_dir = ''
+_o3d_third_party_dir = ''
+_script_path = os.path.dirname(os.path.realpath(__file__))
+_js_copyright = """
+/*
+ * Copyright 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+"""
+
+GlobalsDict = { }
+
+
+def MakePath(*file_paths):
+ """Makes a path absolute given a path relative to this script."""
+ return os.path.join(_script_path, *file_paths)
+
+
+def MakeCommandName(name):
+ """adds '.exe' if on Windows"""
+ if os.name == 'nt':
+ return name + '.exe'
+ return name
+
+
+def UpdateGlobals(dict):
+ """Copies pairs from dict into GlobalDict."""
+ for i, v in dict.items():
+ GlobalsDict.__setitem__(i, v)
+
+
+def GetCallingNamespaces():
+ """Return the locals and globals for the function that called
+ into this module in the current call stack."""
+ try: 1/0
+ except ZeroDivisionError:
+ # Don't start iterating with the current stack-frame to
+ # prevent creating reference cycles (f_back is safe).
+ frame = sys.exc_info()[2].tb_frame.f_back
+
+ # Find the first frame that *isn't* from this file
+ while frame.f_globals.get("__name__") == __name__:
+ frame = frame.f_back
+
+ return frame.f_locals, frame.f_globals
+
+
+def ComputeExports(exports):
+ """Compute a dictionary of exports given one of the parameters
+ to the Export() function or the exports argument to SConscript()."""
+
+ loc, glob = GetCallingNamespaces()
+
+ retval = {}
+ try:
+ for export in exports:
+ if isinstance(export, types.DictType):
+ retval.update(export)
+ else:
+ try:
+ retval[export] = loc[export]
+ except KeyError:
+ retval[export] = glob[export]
+ except KeyError, x:
+ raise Error, "Export of non-existent variable '%s'"%x
+
+ return retval
+
+
+def Export(*vars):
+ """Copies the named variables to GlobalDict."""
+ for var in vars:
+ UpdateGlobals(ComputeExports(vars))
+
+
+def Import(filename):
+ """Imports a python file in a scope with 'Export' defined."""
+ scope = {'__builtins__': globals()['__builtins__'],
+ 'Export': Export}
+ file = open(filename, 'r')
+ exec file in scope
+ file.close()
+
+
+def Execute(args):
+ """Executes an external program."""
+ # Comment the next line in for debugging.
+ # print "Execute: ", ' '.join(args)
+ if subprocess.call(args) > 0:
+ raise RuntimeError('FAILED: ' + ' '.join(args))
+
+
+def AppendBasePath(folder, filenames):
+ """Appends a base path to a ist of files"""
+ return [os.path.join(folder, filename) for filename in filenames]
+
+
+def RunNixysa(idl_files, generate, output_dir, nixysa_options):
+ """Executes Nixysa."""
+ Execute([
+ sys.executable,
+ MakePath(_o3d_third_party_dir, 'nixysa', 'codegen.py'),
+ '--binding-module=o3d:%s' % MakePath('..', 'plugin', 'o3d_binding.py'),
+ '--generate=' + generate,
+ '--force',
+ '--output-dir=' + output_dir] +
+ nixysa_options +
+ idl_files)
+
+
+def RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir, prefix, mode,
+ baseURL, topURL, exports_file):
+ """Executes the JSDocToolkit."""
+ list_filename = MakePath(_output_dir, 'doclist.conf')
+ f = open(list_filename, 'w')
+ f.write('{\nD:{\n')
+ f.write('prefix: "%s",\n' % prefix)
+ f.write('baseURL: "%s",\n' % baseURL)
+ f.write('topURL: "%s",\n' % topURL)
+ f.write('mode: "%s",\n' % mode)
+ f.write('htmlOutDir: "%s",\n' % html_output_dir.replace('\\', '/'))
+ f.write('exportsFile: "%s",\n' % exports_file.replace('\\', '/'))
+ f.write('endMarker: ""\n')
+ f.write('},\n')
+ f.write('_: [\n')
+ for filename in js_files:
+ f.write('"%s",\n' % filename.replace('\\', '/'))
+ f.write(']\n}\n')
+ f.close()
+
+ files_dir = MakePath(_third_party_dir, 'jsdoctoolkit', 'files')
+ Execute([
+ _java_exe,
+ '-Djsdoc.dir=%s' % files_dir,
+ '-jar',
+ MakePath(files_dir, 'jsrun.jar'),
+ MakePath(files_dir, 'app', 'run.js'),
+ '-v',
+ '-t=%s' % MakePath('jsdoc-toolkit-templates'),
+ '-d=' + ezt_output_dir,
+ '-c=' + list_filename])
+
+
+def DeleteOldDocs(docs_js_outpath):
+ try:
+ shutil.rmtree(docs_js_outpath);
+ except:
+ pass
+
+def BuildJavaScriptForDocsFromIDLs(idl_files, output_dir):
+ RunNixysa(idl_files, 'jsheader', output_dir, ['--properties-equal-undefined'])
+
+
+def BuildJavaScriptForExternsFromIDLs(idl_files, output_dir):
+ if (os.path.exists(output_dir)):
+ for filename in glob.glob(os.path.join(output_dir, '*.js')):
+ os.unlink(filename)
+ RunNixysa(idl_files, 'jsheader', output_dir, ['--no-return-docs'])
+
+
+def BuildO3DDocsFromJavaScript(js_files, ezt_output_dir, html_output_dir):
+ RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir,
+ 'classo3d_1_1_', 'o3d', '', '', '')
+
+
+def BuildO3DClassHierarchy(html_output_dir):
+ # TODO(gman): We need to make mutliple graphs. One for Params, one for
+ # ParamMatrix4, one for RenderNode, one for everythng else.
+ dot_path = MakePath(_third_party_dir, 'graphviz', 'files', 'bin',
+ MakeCommandName('dot'))
+ if os.path.exists(dot_path):
+ Execute([
+ dot_path,
+ '-Tcmapx', '-o' + MakePath(html_output_dir, 'class_hierarchy.map'),
+ '-Tpng', '-o' + MakePath(html_output_dir, 'class_hierarchy.png'),
+ MakePath(html_output_dir, 'class_hierarchy.dot')])
+
+
+def BuildO3DJSDocs(js_files, ezt_output_dir, html_output_dir, exports_file):
+ # The backslashes below on 'jsdocs/' and '../' must stay.
+ RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir, 'js_1_0_', 'o3djs',
+ 'jsdocs/', '../', exports_file)
+
+
+def BuildO3DExternsFile(js_files_dir, extra_externs_file, externs_file):
+ outfile = open(externs_file, 'w')
+ filenames = (glob.glob(os.path.join(js_files_dir, '*.js')) +
+ [extra_externs_file])
+ for filename in filenames:
+ print "-----", filename
+ infile = open(filename, 'r')
+ lines = infile.readlines()
+ infile.close()
+ filtered = []
+ skipping = False
+ # strip out @o3dparameter stuff
+ for line in lines:
+ if skipping:
+ if line.startswith(' * @') or line.startswith(' */'):
+ skipping = False
+ if not skipping:
+ if line.startswith(' * @o3dparameter'):
+ skipping = True
+ if not skipping:
+ filtered.append(line)
+ outfile.write(''.join(filtered))
+ outfile.close()
+
+
+def BuildCompiledO3DJS(o3djs_files,
+ externs_path,
+ o3d_externs_js_path,
+ compiled_o3djs_outpath):
+ Execute([
+ _java_exe,
+ '-jar',
+ MakePath('..', '..', 'o3d-internal', 'jscomp', 'JSCompiler_deploy.jar'),
+ '--property_renaming', 'OFF',
+ '--variable_renaming', 'LOCAL',
+ '--strict',
+ '--externs=%s' % externs_path,
+ ('--externs=%s' % o3d_externs_js_path),
+ ('--js_output_file=%s' % compiled_o3djs_outpath)] +
+ ['-js=%s' % (x, ) for x in o3djs_files]);
+
+ # strip out goog.exportSymbol and move o3djs.require to end
+ file = open(compiled_o3djs_outpath, 'r')
+ contents = file.read()
+ file.close()
+ contents = re.sub(r'goog.exportSymbol\([^\)]*\);', '', contents)
+ requires = set(re.findall(r'o3djs.require\([^\)]*\);', contents))
+ contents = re.sub(r'o3djs.require\([^\)]*\);', '', contents)
+ file = open(compiled_o3djs_outpath, 'w')
+ file.write(_js_copyright)
+ file.write(contents)
+ file.write('\n')
+ file.write('\n'.join(requires))
+ file.close()
+
+
+def CopyStaticFiles(o3d_docs_ezt_outpath, o3d_docs_html_outpath):
+ files = ['stylesheet.css',
+ 'prettify.css',
+ 'prettify.js',
+ 'tabs.css',
+ 'tab_l.gif',
+ 'tab_r.gif',
+ 'tab_b.gif']
+ for file in files:
+ shutil.copyfile(MakePath('jsdoc-toolkit-templates', 'static', file),
+ MakePath(os.path.join(o3d_docs_ezt_outpath, file)))
+ shutil.copyfile(MakePath('jsdoc-toolkit-templates', 'static', file),
+ MakePath(os.path.join(o3d_docs_html_outpath, file)))
+
+
+def main(argv):
+ """Builds the O3D API docs and externs and the o3djs docs."""
+ global _java_exe
+ _java_exe = argv[0]
+ global _third_party_dir
+ _third_party_dir = argv[1]
+ global _o3d_third_party_dir
+ _o3d_third_party_dir = os.path.normpath(
+ os.path.join(os.path.dirname(__file__), '..', 'third_party'))
+
+ # Fix up the python path of subprocesses by setting PYTHONPATH.
+ pythonpath = os.pathsep.join([MakePath(_o3d_third_party_dir, 'gflags', 'python'),
+ MakePath(_o3d_third_party_dir, 'ply')])
+
+ orig_pythonpath = os.environ.get('PYTHONPATH')
+ if orig_pythonpath:
+ pythonpath = os.pathsep.join([pythonpath, orig_pythonpath])
+
+ os.environ['PYTHONPATH'] = pythonpath
+
+ js_list_filename = MakePath('..', 'samples', 'o3djs', 'js_list.scons')
+ idl_list_filename = MakePath('..', 'plugin', 'idl_list.scons')
+ js_list_basepath = os.path.dirname(js_list_filename)
+ idl_list_basepath = os.path.dirname(idl_list_filename)
+
+ global _output_dir
+ _output_dir = argv[2]
+ docs_outpath = os.path.join(_output_dir, 'documentation')
+ docs_js_outpath = MakePath(docs_outpath, 'apijs')
+ externs_js_outpath = MakePath(_output_dir, 'externs')
+ o3d_docs_ezt_outpath = MakePath(docs_outpath, 'reference')
+ o3d_docs_html_outpath = MakePath(docs_outpath, 'local_html')
+ o3djs_docs_ezt_outpath = MakePath(docs_outpath, 'reference', 'jsdocs')
+ o3djs_docs_html_outpath = MakePath(docs_outpath, 'local_html', 'jsdocs')
+ o3d_externs_path = MakePath(_output_dir, 'o3d-externs.js')
+ o3djs_exports_path = MakePath(_output_dir, 'o3d-exports.js')
+ compiled_o3djs_outpath = MakePath(docs_outpath, 'base.js')
+ externs_path = MakePath('externs', 'externs.js')
+ o3d_extra_externs_path = MakePath('externs', 'o3d-extra-externs.js')
+
+ Import(js_list_filename)
+ Import(idl_list_filename)
+
+ idl_files = AppendBasePath(idl_list_basepath, GlobalsDict['O3D_IDL_SOURCES'])
+ o3djs_files = AppendBasePath(js_list_basepath, GlobalsDict['O3D_JS_SOURCES'])
+
+ # we need to put base.js first?
+ o3djs_files = (
+ filter(lambda x: x.endswith('base.js'), o3djs_files) +
+ filter(lambda x: not x.endswith('base.js'), o3djs_files))
+
+ docs_js_files = [os.path.join(
+ docs_js_outpath,
+ os.path.splitext(os.path.basename(f))[0] + '.js')
+ for f in GlobalsDict['O3D_IDL_SOURCES']]
+
+ DeleteOldDocs(MakePath(docs_outpath))
+ BuildJavaScriptForDocsFromIDLs(idl_files, docs_js_outpath)
+ BuildO3DDocsFromJavaScript([o3d_extra_externs_path] + docs_js_files,
+ o3d_docs_ezt_outpath, o3d_docs_html_outpath)
+ BuildO3DClassHierarchy(o3d_docs_html_outpath)
+ BuildJavaScriptForExternsFromIDLs(idl_files, externs_js_outpath)
+ BuildO3DExternsFile(externs_js_outpath,
+ o3d_extra_externs_path,
+ o3d_externs_path)
+ BuildO3DJSDocs(o3djs_files + [o3d_externs_path], o3djs_docs_ezt_outpath,
+ o3djs_docs_html_outpath, o3djs_exports_path)
+ CopyStaticFiles(o3d_docs_ezt_outpath, o3d_docs_html_outpath)
+ BuildCompiledO3DJS(o3djs_files + [o3djs_exports_path],
+ externs_path,
+ o3d_externs_path,
+ compiled_o3djs_outpath)
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
diff --git a/o3d/plugin/cross/main.h b/o3d/plugin/cross/main.h
index 049c688..5d77d59 100644
--- a/o3d/plugin/cross/main.h
+++ b/o3d/plugin/cross/main.h
@@ -55,16 +55,16 @@
#include "third_party/nixysa/static_glue/npapi/common.h"
#include "third_party/nixysa/static_glue/npapi/npn_api.h"
-#if defined(O3D_INTERNAL_PLUGIN)
-#define HANDLE_CRASHES void(0)
-#else // O3D_INTERNAL_PLUGIN
-
#if defined(OS_LINUX)
#define EXPORT_SYMBOL __attribute__((visibility ("default")))
#else
#define EXPORT_SYMBOL
#endif
+#if defined(O3D_INTERNAL_PLUGIN)
+#define HANDLE_CRASHES void(0)
+#else // O3D_INTERNAL_PLUGIN
+
extern ExceptionManager *g_exception_manager;
// BreakpadEnabler is a simple class to keep track of whether or not
diff --git a/o3d/plugin/idl/codegen.py b/o3d/plugin/idl/codegen.py
index 7494c21..d82d7ab 100644
--- a/o3d/plugin/idl/codegen.py
+++ b/o3d/plugin/idl/codegen.py
@@ -22,7 +22,7 @@ import os
script_dir = os.path.join(os.path.dirname(__file__))
third_party = os.path.normpath(
- os.path.join(script_dir, '..', '..', '..', 'third_party'))
+ os.path.join(script_dir, '..', '..', 'third_party'))
pythonpath = os.pathsep.join([os.path.join(third_party, 'gflags', 'python'),
os.path.join(third_party, 'ply')])
diff --git a/o3d/plugin/idl/idl.gyp b/o3d/plugin/idl/idl.gyp
index 7a393ae..1e710c1 100644
--- a/o3d/plugin/idl/idl.gyp
+++ b/o3d/plugin/idl/idl.gyp
@@ -9,7 +9,7 @@
'variables': {
'chromium_code': 0,
'idl_out_path': '<(SHARED_INTERMEDIATE_DIR)/idl_glue',
- 'static_glue_dir': '../../../third_party/nixysa/static_glue/npapi',
+ 'static_glue_dir': '../../../<(nixysadir)/static_glue/npapi',
'idl_files': [
'archive_request.idl',
'bitmap.idl',
@@ -117,6 +117,18 @@
},
'targets': [
{
+ # This target is only used when we're not built as part of Chrome,
+ # since chrome has its own implementation of the NPAPI from webkit.
+ 'target_name': 'o3dNpnApi',
+ 'type': 'static_library',
+ 'include_dirs': [
+ '../../../<(npapidir)/include',
+ ],
+ 'sources': [
+ '<(static_glue_dir)/npn_api.cc',
+ ],
+ },
+ {
'target_name': 'o3dPluginIdl',
'type': 'static_library',
'dependencies': [
@@ -136,14 +148,10 @@
'action_name': 'generate_idl',
'process_outputs_as_sources': 1,
'inputs': [
- '../../../<(nixysadir)/codegen.py',
- 'codegen.py',
'<@(idl_files)',
],
'outputs': [
- # TODO(bradnelson): fix gyp to be able to handle outputs without
- # and extension on linux.
- #'<(idl_out_path)/hash',
+ '<(idl_out_path)/hash',
'<(idl_out_path)/globals_glue.cc',
'<(idl_out_path)/globals_glue.h',
'<!@(python idl_filenames.py \'<(idl_out_path)\' <@(idl_files))',
@@ -165,7 +173,6 @@
'../cross/o3d_glue.cc',
'../cross/o3d_glue.h',
'<(static_glue_dir)/common.cc',
- '<(static_glue_dir)/npn_api.cc',
'<(static_glue_dir)/static_object.cc',
],
},
diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp
index 3c0effb..495e8b8 100644
--- a/o3d/plugin/plugin.gyp
+++ b/o3d/plugin/plugin.gyp
@@ -2,9 +2,59 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+# PLEASE NOTE: This file contains the targets for generating the
+# plugin two different ways -- once as a shared library, and once as a
+# static library. The static library is only built if we are inside
+# of a Chrome tree, and it gets built with different defined symbols,
+# and without the packaging code on the Mac. The shared library gets
+# built in an o3d tree, or in a chrome tree when built by an o3d
+# developer (someone who has added the .gclient stanza to include
+# DEPS_chrome). This results in having two targets in this file which
+# are largely identical, but still significantly different.
+#
+# Please be sure and synchronize these two targets so that we can
+# continue to build both the standalone plugin and the Chrome-embedded
+# plugin.
+
{
'variables': {
'chromium_code': 1,
+ 'plugin_sources': [
+ 'cross/async_loading.cc',
+ 'cross/async_loading.h',
+ 'cross/blacklist.cc',
+ 'cross/config.h',
+ 'cross/config_common.cc',
+ 'cross/download_stream.h',
+ 'cross/main.cc',
+ 'cross/main.h',
+ 'cross/main_thread_task_poster.cc',
+ 'cross/main_thread_task_poster.h',
+ 'cross/marshaling_utils.h',
+ 'cross/np_v8_bridge.cc',
+ 'cross/np_v8_bridge.h',
+ 'cross/out_of_memory.cc',
+ 'cross/out_of_memory.h',
+ 'cross/plugin_logging.h',
+ 'cross/plugin_main.h',
+ 'cross/stream_manager.cc',
+ 'cross/stream_manager.h',
+ 'cross/texture_static_glue.cc',
+ ],
+ 'plugin_depends': [
+ '../../<(jpegdir)/libjpeg.gyp:libjpeg',
+ '../../<(pngdir)/libpng.gyp:libpng',
+ '../../<(zlibdir)/zlib.gyp:zlib',
+ '../../base/base.gyp:base',
+ '../../skia/skia.gyp:skia',
+ '../../v8/tools/gyp/v8.gyp:v8',
+ '../core/core.gyp:o3dCore',
+ '../core/core.gyp:o3dCorePlatform',
+ '../import/archive.gyp:o3dArchive',
+ '../utils/utils.gyp:o3dUtils',
+ '../../native_client/src/shared/imc/imc.gyp:google_nacl_imc',
+ 'idl/idl.gyp:o3dPluginIdl',
+ ],
},
'includes': [
'../build/common.gypi',
@@ -24,43 +74,15 @@
},
'targets': [
{
+ # This is the shared library version of the plugin.
'target_name': 'npo3dautoplugin',
- 'type': '<(o3d_main_lib_type)',
+ 'type': 'loadable_module',
'dependencies': [
- '../../<(jpegdir)/libjpeg.gyp:libjpeg',
- '../../<(pngdir)/libpng.gyp:libpng',
- '../../<(zlibdir)/zlib.gyp:zlib',
- '../../base/base.gyp:base',
- '../../skia/skia.gyp:skia',
- '../../v8/tools/gyp/v8.gyp:v8',
- '../core/core.gyp:o3dCore',
- '../core/core.gyp:o3dCorePlatform',
- '../import/archive.gyp:o3dArchive',
- '../utils/utils.gyp:o3dUtils',
- '../../native_client/src/shared/imc/imc.gyp:google_nacl_imc',
- 'idl/idl.gyp:o3dPluginIdl',
+ '<@(plugin_depends)',
+ 'idl/idl.gyp:o3dNpnApi',
],
'sources': [
- 'cross/async_loading.cc',
- 'cross/async_loading.h',
- 'cross/blacklist.cc',
- 'cross/config.h',
- 'cross/config_common.cc',
- 'cross/download_stream.h',
- 'cross/main.cc',
- 'cross/main.h',
- 'cross/main_thread_task_poster.cc',
- 'cross/main_thread_task_poster.h',
- 'cross/marshaling_utils.h',
- 'cross/np_v8_bridge.cc',
- 'cross/np_v8_bridge.h',
- 'cross/out_of_memory.cc',
- 'cross/out_of_memory.h',
- 'cross/plugin_logging.h',
- 'cross/plugin_main.h',
- 'cross/stream_manager.cc',
- 'cross/stream_manager.h',
- 'cross/texture_static_glue.cc',
+ '<@(plugin_sources)',
],
'conditions' : [
['OS != "linux"',
@@ -239,19 +261,156 @@
'conditions': [
['o3d_in_chrome == "True"',
{
- 'variables': {
- 'o3d_main_lib_type': 'static_library',
- },
- 'target_defaults': {
- 'defines': [
- 'O3D_INTERNAL_PLUGIN=1',
- ],
- },
- },
- {
- 'variables': {
- 'o3d_main_lib_type': 'loadable_module',
- },
+ # Only use the "static_library" plugin target if we're
+ # building in a chrome tree, since we don't need it in an O3D
+ # tree.
+ 'targets': [
+ {
+ 'target_name': 'o3dPlugin',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<@(plugin_depends)',
+ ],
+ 'sources': [
+ '<@(plugin_sources)',
+ ],
+ 'defines':['O3D_INTERNAL_PLUGIN=1'],
+ 'conditions' : [
+ ['OS != "linux"',
+ {
+ 'dependencies': [
+ '../statsreport/statsreport.gyp:o3dStatsReport',
+ 'add_version',
+ 'o3dPluginLogging',
+ ],
+ },
+ ],
+ ['renderer == "gl"',
+ {
+ 'dependencies': [
+ '../build/libs.gyp:gl_libs',
+ '../build/libs.gyp:cg_libs',
+ ],
+ },
+ ],
+ ['OS == "mac"',
+ {
+ 'mac_bundle': 1,
+ 'product_extension': 'plugin',
+ 'product_name': 'O3D',
+ 'dependencies': [
+ '../../breakpad/breakpad.gyp:breakpad',
+ ],
+ 'xcode_settings': {
+ 'INFOPLIST_FILE': '<(SHARED_INTERMEDIATE_DIR)/plugin/Info.plist',
+ },
+ 'mac_bundle_resources': [
+ 'mac/Resources/English.lproj',
+ ],
+ 'sources': [
+ 'mac/config_mac.mm',
+ 'mac/main_mac.mm',
+ 'mac/o3d_plugin.r',
+ 'mac/plugin_logging-mac.mm',
+ 'mac/plugin_mac.h',
+ 'mac/plugin_mac.mm',
+ 'mac/graphics_utils_mac.mm',
+ ],
+ 'mac_framework_dirs': [
+ '../../<(cgdir)',
+ ],
+ 'include_dirs': [
+ '../../breakpad/src/client/mac/Framework',
+ ],
+ 'defines': [
+ 'XP_MACOSX=1',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
+ '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
+ '$(SDKROOT)/System/Library/Frameworks/AGL.framework',
+ '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
+ '$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
+ '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
+ '$(SDKROOT)/System/Library/Frameworks/QuickTime.framework',
+ 'libbreakpad.a',
+ 'libbreakpad_utilities.a',
+ '../../third_party/cg/files/mac/Cg.framework',
+ '../../third_party/glew/files/lib/libMacStaticGLEW.a',
+ ],
+ },
+ },
+ ],
+ ['OS == "linux"',
+ {
+ 'sources': [
+ 'linux/main_linux.cc',
+ 'linux/config.cc',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lGL',
+ ],
+ },
+ # On Linux, shared library targets aren't copied to the
+ # product dir automatically. Filed GYP issue #74 to address this.
+ # TODO(gspencer): Remove when issue #74 is resolved.
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ '<(PRODUCT_DIR)/obj/o3d/plugin/<(LIBRARY_PREFIX)<(_target_name)<(SHARED_LIB_SUFFIX)',
+ ],
+ },
+ ],
+ },
+ ],
+ ['OS == "win"',
+ {
+ 'dependencies': [
+ '../breakpad/breakpad.gyp:o3dBreakpad',
+ ],
+ 'sources': [
+ 'win/config.cc',
+ 'win/logger_main.cc',
+ 'win/main_win.cc',
+ 'win/o3dPlugin.def',
+ 'win/o3dPlugin.rc',
+ 'win/plugin_logging-win32.cc',
+ 'win/resource.h',
+ 'win/update_lock.cc',
+ 'win/update_lock.h',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lrpcrt4.lib',
+ ],
+ },
+ },
+ ],
+ ['OS == "win" and renderer == "d3d9"',
+ {
+ 'link_settings': {
+ 'libraries': [
+ '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"',
+ '-ld3d9.lib',
+ ],
+ },
+ },
+ ],
+ ['OS == "win" and (renderer == "d3d9" or cb_service == "d3d9")',
+ {
+ 'link_settings': {
+ 'libraries': [
+ '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"',
+ ],
+ },
+ },
+ ],
+ ],
+ },
+ ],
},
],
['OS != "linux"',
diff --git a/o3d/plugin/version_info.py b/o3d/plugin/version_info.py
index 5424cf4..cf908ce 100644
--- a/o3d/plugin/version_info.py
+++ b/o3d/plugin/version_info.py
@@ -22,7 +22,7 @@ import sys
script_dir = os.path.join(os.path.dirname(sys.argv[0]))
gflags_dir = os.path.normpath(
- os.path.join(script_dir, '..', '..', 'third_party', 'gflags', 'python'))
+ os.path.join(script_dir, '..', 'third_party', 'gflags', 'python'))
sys.path.append(gflags_dir)
import gflags
diff --git a/o3d/samples/split_samples.py b/o3d/samples/split_samples.py
deleted file mode 100644
index c101fdc..0000000
--- a/o3d/samples/split_samples.py
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2009 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 takes the samples and splits out the code and the HTML
-into separate files for the unified sample browser."""
-
-import datetime
-import os.path
-import re
-import sys
-
-gflags_dir = os.path.normpath(
- os.path.join(os.path.dirname(sys.argv[0]),
- '..', '..', 'third_party', 'gflags', 'python'))
-sys.path.append(gflags_dir)
-
-import gflags
-
-year = datetime.date.today().year
-copyright_header = """/*
- * Copyright %d, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-""" % year
-
-FLAGS = gflags.FLAGS
-gflags.DEFINE_string('products', None,
- 'Sets the output directory for products.')
-
-gflags.DEFINE_string('samples', None,
- 'Sets the directory for samples..')
-
-gflags.DEFINE_boolean('find_candidates', False,
- 'Tells the script to just output a list of '
- 'candidate samples.')
-
-def FindCandidates():
- contents = GetFileContents(
- os.path.join(FLAGS.samples, "interactive_samples.js")).splitlines()
- start_re = re.compile("var codeArray.*")
- end_re = re.compile("];")
- keepers = []
- inside = False
- for line in contents:
- if end_re.match(line):
- inside = False
- if inside:
- keepers.append(line)
- if start_re.match(line):
- inside = True
- keepers = ["["] + keepers + ["]"]
- candidate_data = eval("\n".join(keepers),
- {'__builtins__': None, 'true': 1, 'false': 0}, None)
-
- # Put them into a dict to make sure they're unique
- candidates = {}
- for category in candidate_data:
- for samples in category['samples']:
- candidates[samples['files'][0]] = 1
- candidates_array = candidates.keys()
- candidates_array.sort()
- for candidate in candidates_array:
- print candidate
-
-def GetFileContents(filename):
- try:
- fd = open(filename, "r")
- output = fd.read()
- fd.close()
- except IOError:
- print "Unable to read file '%s'" % (filename)
- return None
- return output
-
-def SetFileContentsIfDifferent(filename, contents):
- try:
- fd = open(filename, "r")
- old_contents = fd.read()
- fd.close()
- except IOError:
- old_contents = None
- pass
-
- # If nothing changed, then don't re-write anything.
- if old_contents == contents:
- return True
-
- try:
- fd = open(filename, "wb")
- except IOError:
- print "Unable to write file '%s'" % (filename)
- return False
- output = fd.write(contents)
- fd.close()
- return True
-
-def SplitSample(sample_file, output_html, output_js):
- script_re = re.compile(r'(.*)<script(\s+type="text/javascript")' +
- r'(\s+charset="utf-8")?(\s+id="o3dscript")?' +
- r'\s*>(.*)</script>(.*)',
- re.DOTALL)
-
- content = GetFileContents(sample_file)
- m = script_re.match(content)
- if not m:
- raise Exception('Script regexp failed on input file %s' % sample_file)
- (html_start, type, charset, id, script, html_end) = m.groups()
- if not type:
- raise Exception('Found a script (%s) that lacked the javascript tag!'
- % sample_file)
- if not charset:
- charset = ''
-
- html_content = (
- '%(html_start)s<script %(type)s%(id)s%(charset)s '
- 'src="%(js_path)s"></script>%(html_end)s' %
- {
- 'html_start' : html_start,
- 'type' : type,
- 'id' : id,
- 'charset' : charset,
- 'js_path' : os.path.basename(output_js),
- 'html_end' : html_end
- })
-
- if not SetFileContentsIfDifferent(output_html, html_content):
- return False
- if not SetFileContentsIfDifferent(output_js, copyright_header + script):
- return False
- return True
-
-def main(argv):
- try:
- files = FLAGS(argv) # Parse flags
- except gflags.FlagsError, e:
- print '%s.\nUsage: %s [<options>]\n%s' % \
- (e, sys.argv[0], FLAGS)
- sys.exit(2)
-
- # Strip off argv[0] to leave a list of html files to split.
- files = files[1:]
-
- if FLAGS.find_candidates:
- return FindCandidates()
-
- for file in files:
- basename = os.path.basename(file)
- output_html = os.path.join(FLAGS.products, basename)
- output_js = os.path.splitext(output_html)[0] + '.js'
- print "Splitting sample %s into %s and %s" % (file, output_html, output_js)
- if not SplitSample(file, output_html, output_js):
- sys.exit(2)
-
-if __name__ == "__main__":
- main(sys.argv)
diff --git a/o3d/tests/selenium/main.py b/o3d/tests/selenium/main.py
index cc19ad7..d8425a0 100644
--- a/o3d/tests/selenium/main.py
+++ b/o3d/tests/selenium/main.py
@@ -45,7 +45,8 @@ script_dir = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
o3d_dir = os.path.dirname(os.path.dirname(script_dir))
src_dir = os.path.dirname(o3d_dir)
third_party_dir = os.path.join(src_dir, 'third_party')
-gflags_dir = os.path.join(third_party_dir, 'gflags', 'python')
+o3d_third_party_dir = os.path.join(o3d_dir, 'third_party')
+gflags_dir = os.path.join(o3d_third_party_dir, 'gflags', 'python')
selenium_dir = os.path.join(third_party_dir, 'selenium_rc', 'files')
selenium_py_dir = os.path.join(selenium_dir, 'selenium-python-client-driver')
sys.path.append(gflags_dir)
diff --git a/o3d/tests/selenium/unpack_firefox.py b/o3d/tests/selenium/unpack_firefox.py
index 4cafefc..a969c44 100644
--- a/o3d/tests/selenium/unpack_firefox.py
+++ b/o3d/tests/selenium/unpack_firefox.py
@@ -8,7 +8,7 @@ import subprocess
script_dir = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
o3d_dir = os.path.dirname(os.path.dirname(script_dir))
src_dir = os.path.dirname(o3d_dir)
-third_party_dir = os.path.join(src_dir, 'third_party')
+third_party_dir = os.path.join(o3d_dir, 'third_party')
internal_dir = os.path.join(src_dir, 'o3d-internal')
gflags_dir = os.path.join(third_party_dir, 'gflags', 'python')
sys.path.append(gflags_dir)