Merge pull request #1764 from bentrm/win-build

Updated build script to run target integration-test in Win
This commit is contained in:
Tom Payne
2014-02-26 13:22:04 +01:00
+46 -48
View File
@@ -4,7 +4,7 @@ from cStringIO import StringIO
import gzip import gzip
import json import json
import os import os
import os.path import glob
import regex as re import regex as re
import shutil import shutil
import sys import sys
@@ -14,60 +14,59 @@ from pake import ifind, main, output, rule, target, variables, virtual, which
if sys.platform == 'win32': if sys.platform == 'win32':
""" windows_defaults assumes that jsdoc was installed at a specific place
(C:\jsdoc). It also fixes a certain version (1.9.0) of phantomjs which
might not anymore be proposed on
http://code.google.com/p/phantomjs/downloads/list"""
windows_defaults = { win = {
'ProgramFiles': os.environ.get('ProgramFiles', 'C:\\Program Files'), 'GIT': 'git.exe',
'Python27': os.environ.get('SystemDrive', 'C:') + '\\Python27', 'GJSLINT': 'gjslint.exe',
'jsdoc': os.environ.get('SystemDrive', 'C:') + '\\jsdoc3', 'JAVA': 'java.exe',
'phantomjs': (os.environ.get('SystemDrive', 'C:') + 'JAR': 'jar.exe',
'\\phantomjs-1.9.0-windows') 'JSDOC': 'jsdoc.cmd',
'PYTHON': 'python.exe',
'PHANTOMJS': 'phantomjs.cmd'
} }
if which('git.exe'): sys_dir = os.environ.get('SYSTEMDRIVE')
variables.GIT = 'git.exe' program_files = os.environ.get('PROGRAMFILES')
else: java_home = os.environ.get('JAVA_HOME')
variables.GIT = os.path.join(windows_defaults['ProgramFiles'],
'Git', 'bin', 'git.exe')
if which('gjslint.exe'): if not java_home:
variables.GJSLINT = 'gjslint.exe' # Following lines choose sensible defaults to guess JAVA_HOME in
else: # 32/64bit Program Files folder opting for the most current version.
variables.GJSLINT = os.path.join(windows_defaults['Python27'], search_term = os.path.join(sys_dir, os.sep, 'Program Files*', 'Java', 'jdk*')
'Scripts', 'gjslint.exe') found_jdks = sorted(glob.glob(search_term), key=lambda x: x[-8:])
if found_jdks:
java_home = found_jdks[-1]
if which('java.exe'): if java_home:
variables.JAVA = 'java.exe' if not which(win['JAVA']):
else: win['JAVA'] = os.path.join(java_home, 'bin', 'java.exe')
variables.JAVA = os.path.join(windows_defaults['ProgramFiles'], if not which(win['JAR']):
'Java', 'jre7', 'bin', 'java.exe') win['JAR'] = os.path.join(java_home, 'bin', 'jar.exe')
elif not which(win['JAVA']):
win['JAVA'] = os.path.join(program_files,
'Java', 'jre7', 'bin', 'java.exe')
if which('jar.exe'): if not which(win['GIT']):
variables.JAR = 'jar.exe' win['GIT'] = os.path.join(program_files, 'Git', 'cmd', 'git.exe')
else: if not which(win['GIT']):
variables.JAR = os.path.join(windows_defaults['ProgramFiles'], win['GIT'] = os.path.join(program_files, 'Git', 'bin', 'git.exe')
'Java', 'jdk1.7.0_17', 'bin', 'jar.exe')
if which('jsdoc.cmd'): if not which(win['PYTHON']):
variables.JSDOC = 'jsdoc.cmd' win['PYTHON'] = os.path.join(sys_dir, 'Python27', 'python.exe')
else:
variables.JSDOC = os.path.join(windows_defaults['jsdoc'],
'jsdoc.cmd')
if which('python.exe'): if not which(win['GJSLINT']):
variables.PYTHON = 'python.exe' win['GJSLINT'] = os.path.join(sys_dir, 'Python27', 'Scripts', 'gjslint.exe')
else:
variables.PYTHON = os.path.join(windows_defaults['Python27'],
'python.exe')
if which('phantomjs.exe'): if not which(win['PHANTOMJS']):
variables.PHANTOMJS = 'phantomjs.exe' win['PHANTOMJS'] = 'phantomjs.exe'
else: if not which(win['PHANTOMJS']):
variables.PHANTOMJS = os.path.join(windows_defaults['phantomjs'], win['PHANTOMJS'] = os.path.join(sys_dir, 'phantomjs-1.9.7-windows', 'phantomjs.exe')
'phantomjs.exe')
if not which(win['JSDOC']):
win['JSDOC'] = os.path.join(program_files, 'jsdoc3', 'jsdoc.cmd')
for program, path in win.iteritems():
setattr(variables, program, path)
else: else:
variables.GIT = 'git' variables.GIT = 'git'
@@ -75,7 +74,6 @@ else:
variables.JAVA = 'java' variables.JAVA = 'java'
variables.JAR = 'jar' variables.JAR = 'jar'
variables.JSDOC = 'jsdoc' variables.JSDOC = 'jsdoc'
variables.NODE = 'node'
variables.PYTHON = 'python' variables.PYTHON = 'python'
variables.PHANTOMJS = 'phantomjs' variables.PHANTOMJS = 'phantomjs'
@@ -306,7 +304,7 @@ def build_examples_all_combined_js(t):
@target('build/examples/all.js', EXAMPLES_SRC) @target('build/examples/all.js', EXAMPLES_SRC)
def build_examples_all_js(t): def build_examples_all_js(t):
t.output('bin/combine-examples.py', t.dependencies) t.output('%(PYTHON)s', 'bin/combine-examples.py', t.dependencies)
@rule(r'\Abuild/examples/(?P<id>.*).json\Z') @rule(r'\Abuild/examples/(?P<id>.*).json\Z')