diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 23:23:28 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 23:23:28 +0000 |
commit | b7b5d64a0515af71384867671a3c3f9182c79024 (patch) | |
tree | 43df992d7fd242685d1109cbdd68730c43634b31 /remoting | |
parent | 7e2a3998069548212040fb6f07d181b98f0cb002 (diff) | |
download | chromium_src-b7b5d64a0515af71384867671a3c3f9182c79024.zip chromium_src-b7b5d64a0515af71384867671a3c3f9182c79024.tar.gz chromium_src-b7b5d64a0515af71384867671a3c3f9182c79024.tar.bz2 |
Move remoting dark/candle/light steps to external script
This avoids the need to chain the output of gyp rules, which is not supported
across generators.
See also https://chromiumcodereview.appspot.com/10381103/ and https://groups.google.com/forum/?fromgroups#!topic/gyp-developer/f_oCV-Lavpw
R=alexeypa@chromium.org
BUG=127444
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/10392172
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/candle_and_light.py | 73 | ||||
-rw-r--r-- | remoting/dark_and_candle_and_light.py | 67 | ||||
-rw-r--r-- | remoting/remoting.gyp | 106 |
3 files changed, 162 insertions, 84 deletions
diff --git a/remoting/candle_and_light.py b/remoting/candle_and_light.py new file mode 100644 index 0000000..4416a83 --- /dev/null +++ b/remoting/candle_and_light.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# 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. + +"""Run 'candle' and 'light' to transform .wxs to .msi.""" + +from optparse import OptionParser +import os +import subprocess +import sys + +def run(command, filter=None): + popen = subprocess.Popen( + command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if filter and line.strip() != filter: + print line + return popen.returncode + +def main(): + parser = OptionParser() + parser.add_option('--wix_path', dest='wix_path') + parser.add_option('--version', dest='version') + parser.add_option('--product_dir', dest='product_dir') + parser.add_option('--intermediate_dir', dest='intermediate_dir') + parser.add_option('--platformsdk_path', dest='platformsdk_path') + parser.add_option('-d', dest='define_list', action='append') + parser.add_option('--input', dest='input') + parser.add_option('--output', dest='output') + options, args = parser.parse_args() + if args: + parser.error("no positional arguments expected") + parameters = dict(options.__dict__) + + parameters['basename'] = os.path.splitext(os.path.basename(options.input))[0] + parameters['defines'] = '-d' + ' -d'.join(parameters['define_list']) + + common = ( + '-nologo ' + '-ext %(wix_path)s\\WixFirewallExtension.dll ' + '-ext %(wix_path)s\\WixUIExtension.dll ' + '-ext %(wix_path)s\\WixUtilExtension.dll ' + '-dVersion=%(version)s ' + '-dFileSource=%(product_dir)s ' + '-dIconPath=resources/chromoting.ico ' + '-dSasDllPath=%(platformsdk_path)s/redist/x86/sas.dll ' + '%(defines)s ' + ) + + candle_template = ('%(wix_path)s\\candle ' + + common + + '-out %(intermediate_dir)s/%(basename)s.wixobj ' + + '%(input)s ') + rc = run(candle_template % parameters, os.path.basename(parameters['input'])) + if rc: + return rc + + light_template = ('%(wix_path)s\\light ' + + common + + '-cultures:en-us ' + + '-sw1076 ' + + '-out %(output)s ' + + '%(intermediate_dir)s/%(basename)s.wixobj ') + rc = run(light_template % parameters) + if rc: + return rc + + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/remoting/dark_and_candle_and_light.py b/remoting/dark_and_candle_and_light.py new file mode 100644 index 0000000..47c2a09 --- /dev/null +++ b/remoting/dark_and_candle_and_light.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# 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. + +"""Run 'dark', 'candle', and 'light', to confirm that an msi can be unpacked +repacked successfully.""" + +from optparse import OptionParser +import os +import subprocess +import sys + +def run(command, filter=None): + popen = subprocess.Popen( + command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if filter and line.strip() != filter: + print line + return popen.returncode + +def main(): + parser = OptionParser() + parser.add_option('--wix_path', dest='wix_path') + parser.add_option('--input', dest='input') + parser.add_option('--intermediate_dir', dest='intermediate_dir') + parser.add_option('--output', dest='output') + options, args = parser.parse_args() + if args: + parser.error("no positional arguments expected") + parameters = dict(options.__dict__) + + parameters['basename'] = os.path.splitext(os.path.basename(options.output))[0] + + dark_template = ('%(wix_path)s\\dark ' + + '-nologo ' + + '%(input)s ' + + '-o %(intermediate_dir)s/%(basename)s.wxs ' + + '-x %(intermediate_dir)s') + rc = run(dark_template % parameters) + if rc: + return rc + + candle_template = ('%(wix_path)s\\candle ' + + '-nologo ' + + '%(intermediate_dir)s/%(basename)s.wxs ' + + '-o %(intermediate_dir)s/%(basename)s.wixobj ' + + '-ext %(wix_path)s\\WixFirewallExtension.dll') + rc = run(candle_template % parameters, parameters['basename'] + '.wxs') + if rc: + return rc + + light_template = ('%(wix_path)s\\light ' + + '-nologo ' + + '%(intermediate_dir)s/%(basename)s.wixobj ' + + '-o %(output)s ' + + '-ext %(wix_path)s\\WixFirewallExtension.dll ' + + '-sw1076 ') + rc = run(light_template % parameters) + if rc: + return rc + + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index a7cdcc1..ef16878 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -684,7 +684,7 @@ ], 'rules': [ { - 'rule_name': 'candle', + 'rule_name': 'candle_and_light', 'extension': 'wxs', 'inputs': [ '<(PRODUCT_DIR)/remoting_host_controller.exe', @@ -692,58 +692,24 @@ '<(PRODUCT_DIR)/remoting_service.exe', '<(platformsdk_path)/redist/x86/sas.dll', 'resources/chromoting.ico', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).wixobj', - ], - 'process_outputs_as_sources': 1, - 'msvs_cygwin_shell': 0, - 'action': [ - '<(wix_path)\\candle', - '-ext', '<(wix_path)\\WixFirewallExtension.dll', - '-ext', '<(wix_path)\\WixUIExtension.dll', - '-ext', '<(wix_path)\\WixUtilExtension.dll', - '-dVersion=<(version_full)', - '-dFileSource=<(PRODUCT_DIR).', - '-dIconPath=resources/chromoting.ico', - '-dSasDllPath=<(platformsdk_path)/redist/x86/sas.dll', - '<@(_wix_defines)', - '-out', '<@(_outputs)', - '<(RULE_INPUT_PATH)', - ], - 'message': 'Generating <@(_outputs)', - }, - { - 'rule_name': 'light', - 'extension': 'wixobj', - 'inputs': [ - '<(PRODUCT_DIR)/remoting_host_controller.exe', - '<(PRODUCT_DIR)/remoting_me2me_host.exe', - '<(PRODUCT_DIR)/remoting_service.exe', - '<(platformsdk_path)/redist/x86/sas.dll', - 'resources/chromoting.ico', + 'candle_and_light.py', ], 'outputs': [ '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).msi', - '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).wixpdb', ], 'msvs_cygwin_shell': 0, 'action': [ - '<(wix_path)\\light', - '-ext', '<(wix_path)\\WixFirewallExtension.dll', - '-ext', '<(wix_path)\\WixUIExtension.dll', - '-ext', '<(wix_path)\\WixUtilExtension.dll', - '-cultures:en-us', - '-sw1076', - '-dVersion=<(version_full)', - '-dFileSource=<(PRODUCT_DIR).', - '-dIconPath=resources/chromoting.ico', - '-dSasDllPath=<(platformsdk_path)/redist/x86/sas.dll', + 'python', 'candle_and_light.py', + '--wix_path', '<(wix_path)', + '--version', '<(version_full)', + '--product_dir', '<(PRODUCT_DIR).', + '--intermediate_dir', '<(INTERMEDIATE_DIR).', + '--platformsdk_path', '<(platformsdk_path)', + '--input', '<(RULE_INPUT_PATH)', + '--output', '<@(_outputs)', '<@(_wix_defines)', - '-out', '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).msi', - '<(RULE_INPUT_PATH)', ], - 'message': 'Generating <(PRODUCT_DIR)/<(RULE_INPUT_ROOT).msi', + 'message': 'Generating <@(_outputs)', }, ], }, # end of target 'remoting_host_installation' @@ -771,52 +737,24 @@ ], 'rules': [ { - 'rule_name': 'dark', + 'rule_name': 'dark_and_candle_and_light', 'extension': 'msi', - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).wxs', - ], - 'process_outputs_as_sources': 1, - 'msvs_cygwin_shell': 0, - 'action': [ - '<(wix_path)\\dark', - '<(RULE_INPUT_PATH)', - '-o', '<@(_outputs)', - '-x', '<(INTERMEDIATE_DIR).', - ], - 'message': 'Dark: unpacking <(RULE_INPUT_PATH)', - }, - { - 'rule_name': 'candle', - 'extension': 'wxs', - 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).wixobj', - ], - 'process_outputs_as_sources': 1, - 'msvs_cygwin_shell': 0, - 'action': [ - '<(wix_path)\\candle', - '<(RULE_INPUT_PATH)', - '-o', '<@(_outputs)', - '-ext', '<(wix_path)\\WixFirewallExtension.dll', + 'inputs': [ + 'dark_and_candle_and_light.py', ], - 'message': 'Candle: compiling <(RULE_INPUT_PATH)', - }, - { - 'rule_name': 'light', - 'extension': 'wixobj', 'outputs': [ - '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT)-test.msi', + '<(INTERMEDIATE_DIR)/chromoting-test.msi', ], 'msvs_cygwin_shell': 0, 'action': [ - '<(wix_path)\\light', - '<(RULE_INPUT_PATH)', - '-o', '<@(_outputs)', - '-ext', '<(wix_path)\\WixFirewallExtension.dll', - '-sw1076', + 'python', + 'dark_and_candle_and_light.py', + '--wix_path', '<(wix_path)', + '--input', '<(RULE_INPUT_PATH)', + '--intermediate_dir', '<(INTERMEDIATE_DIR).', + '--output', '<@(_outputs)', ], - 'message': 'Light: linking <(RULE_INPUT_PATH)', + 'message': 'Unpacking and repacking to <@(_outputs)', }, ], }, # end of target 'remoting_host_installation_unittest' |