mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 13:47:50 +00:00
Remove gyp entries for editor and java based analyzer
Also, remove some editor specific tools and remove support from annotated steps R=kustermann@google.com, danrubel@google.com BUG= Review URL: https://codereview.chromium.org//1130963003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45630 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
a29715af79
commit
7c0a00cf0c
|
@ -185,10 +185,7 @@ def main():
|
||||||
# The buildbot will set a BUILDBOT_JAVA_HOME relative to the dart
|
# The buildbot will set a BUILDBOT_JAVA_HOME relative to the dart
|
||||||
# root directory, set JAVA_HOME based on that.
|
# root directory, set JAVA_HOME based on that.
|
||||||
FixJavaHome()
|
FixJavaHome()
|
||||||
if name.startswith('dart-editor'):
|
if name.startswith('pub-'):
|
||||||
# Run the old annotated steps script
|
|
||||||
status = ProcessTools('release', name, version)
|
|
||||||
elif name.startswith('pub-'):
|
|
||||||
status = ProcessBot(name, 'pub')
|
status = ProcessBot(name, 'pub')
|
||||||
elif name.startswith('vm-android'):
|
elif name.startswith('vm-android'):
|
||||||
status = ProcessBot(name, 'android')
|
status = ProcessBot(name, 'android')
|
||||||
|
@ -197,8 +194,6 @@ def main():
|
||||||
custom_env=EnvironmentWithoutBotoConfig())
|
custom_env=EnvironmentWithoutBotoConfig())
|
||||||
elif name.startswith('linux-distribution-support'):
|
elif name.startswith('linux-distribution-support'):
|
||||||
status = ProcessBot(name, 'linux_distribution_support')
|
status = ProcessBot(name, 'linux_distribution_support')
|
||||||
elif name.startswith('ft'):
|
|
||||||
status = ProcessBot(name, 'functional_testing')
|
|
||||||
elif name.startswith('version-checker'):
|
elif name.startswith('version-checker'):
|
||||||
status = ProcessBot(name, 'version_checker')
|
status = ProcessBot(name, 'version_checker')
|
||||||
elif name.startswith('dart2js-dump-info'):
|
elif name.startswith('dart2js-dump-info'):
|
||||||
|
|
48
dart.gyp
48
dart.gyp
|
@ -9,11 +9,9 @@
|
||||||
'type': 'none',
|
'type': 'none',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'analysis_server',
|
'analysis_server',
|
||||||
'analyzer_java',
|
|
||||||
'create_sdk',
|
'create_sdk',
|
||||||
'dart2js',
|
'dart2js',
|
||||||
'dartanalyzer',
|
'dartanalyzer',
|
||||||
'editor',
|
|
||||||
'packages',
|
'packages',
|
||||||
'runtime',
|
'runtime',
|
||||||
'samples',
|
'samples',
|
||||||
|
@ -56,13 +54,6 @@
|
||||||
'utils/dartanalyzer/dartanalyzer.gyp:dartanalyzer',
|
'utils/dartanalyzer/dartanalyzer.gyp:dartanalyzer',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'target_name': 'analyzer_java',
|
|
||||||
'type': 'none',
|
|
||||||
'dependencies': [
|
|
||||||
'editor/analyzer_java.gyp:analyzer',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'target_name': 'dartfmt',
|
'target_name': 'dartfmt',
|
||||||
'type': 'none',
|
'type': 'none',
|
||||||
|
@ -109,45 +100,6 @@
|
||||||
'utils/apidoc/docgen.gyp:dartdocgen',
|
'utils/apidoc/docgen.gyp:dartdocgen',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'target_name': 'editor',
|
|
||||||
'type': 'none',
|
|
||||||
'dependencies': [
|
|
||||||
'editor/build/generated/editor_deps.gyp:editor_deps',
|
|
||||||
|
|
||||||
# This dependency on create_sdk does not mean that the
|
|
||||||
# Editor is rebuilt if the SDK is. It only means that when you build
|
|
||||||
# the Editor, you should also build the SDK. If we wanted to
|
|
||||||
# make sure that the editor is rebuilt when the SDK is, we
|
|
||||||
# should list a *file* in PRODUCT_DIR which the action below
|
|
||||||
# uses as input.
|
|
||||||
# This is the desired behavior as we would otherwise have to
|
|
||||||
# rebuild the editor each time the VM, dart2js, or library
|
|
||||||
# code changes.
|
|
||||||
'create_sdk',
|
|
||||||
],
|
|
||||||
'actions': [
|
|
||||||
{
|
|
||||||
'action_name': 'create_editor_py',
|
|
||||||
'inputs': [
|
|
||||||
'tools/create_editor.py',
|
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/editor_deps/editor.stamp',
|
|
||||||
'<!@(["python", "tools/list_files.py", "", "editor/tools/features/'
|
|
||||||
'com.google.dart.tools.deploy.feature_releng"])',
|
|
||||||
],
|
|
||||||
'outputs': [
|
|
||||||
'<(PRODUCT_DIR)/editor/VERSION',
|
|
||||||
],
|
|
||||||
'action': [
|
|
||||||
'python',
|
|
||||||
'tools/create_editor.py',
|
|
||||||
'--out', '<(PRODUCT_DIR)/editor',
|
|
||||||
'--build', '<(INTERMEDIATE_DIR)',
|
|
||||||
],
|
|
||||||
'message': 'Creating editor.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'target_name': 'samples',
|
'target_name': 'samples',
|
||||||
'type': 'none',
|
'type': 'none',
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
"""
|
|
||||||
Buildbot steps for functional testing master and slaves
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import bot
|
|
||||||
import bot_utils
|
|
||||||
|
|
||||||
utils = bot_utils.GetUtils()
|
|
||||||
|
|
||||||
FT_BUILDER = r'ft-slave-(linux|mac)'
|
|
||||||
FT_MASTER = r'ft-master'
|
|
||||||
|
|
||||||
HOST_OS = utils.GuessOS()
|
|
||||||
|
|
||||||
def IsWindows():
|
|
||||||
return HOST_OS == 'win32'
|
|
||||||
|
|
||||||
def SrcConfig(name, is_buildbot):
|
|
||||||
"""Returns info for the current buildbot based on the name of the builder.
|
|
||||||
|
|
||||||
- mode: always "release"
|
|
||||||
- system: always "linux" or "mac"
|
|
||||||
"""
|
|
||||||
pattern = re.match(FT_BUILDER, name)
|
|
||||||
master_pattern = re.match(FT_MASTER, name)
|
|
||||||
if not pattern and not master_pattern:
|
|
||||||
return None
|
|
||||||
if master_pattern:
|
|
||||||
tag = 'master'
|
|
||||||
system = 'linux'
|
|
||||||
else:
|
|
||||||
tag = 'slave'
|
|
||||||
system = pattern.group(1)
|
|
||||||
return bot.BuildInfo('none', 'none', 'release', system,
|
|
||||||
builder_tag=tag)
|
|
||||||
|
|
||||||
def Run(args):
|
|
||||||
print "Running: %s" % ' '.join(args)
|
|
||||||
sys.stdout.flush()
|
|
||||||
bot.RunProcess(args)
|
|
||||||
|
|
||||||
def FTSlave(config):
|
|
||||||
|
|
||||||
# Run SWTBot tests
|
|
||||||
if len(sys.argv) > 0:
|
|
||||||
scriptdir = os.path.dirname(sys.argv[0])
|
|
||||||
builddir = os.path.join(scriptdir, '..', '..', 'editor', 'build')
|
|
||||||
testScript = os.path.join(builddir, 'testswteditor.py')
|
|
||||||
cmd = [sys.executable, testScript]
|
|
||||||
try:
|
|
||||||
subprocess.call(cmd, shell=IsWindows())
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Prepare to run EggPlant tests
|
|
||||||
with bot.BuildStep('Fetching editor'):
|
|
||||||
revision = int(os.environ['BUILDBOT_GOT_REVISION'])
|
|
||||||
bot_name, _ = bot.GetBotName()
|
|
||||||
print bot_name
|
|
||||||
channel = bot_utils.GetChannelFromName(bot_name)
|
|
||||||
namer = bot_utils.GCSNamer(channel=channel)
|
|
||||||
system = config.system
|
|
||||||
if system == 'mac':
|
|
||||||
system = 'macos'
|
|
||||||
editor_path = namer.editor_zipfilepath(revision, system, 'x64')
|
|
||||||
gsutils = bot_utils.GSUtil()
|
|
||||||
editor_location='/home/chrome-bot/Desktop'
|
|
||||||
if system == 'macos':
|
|
||||||
editor_location='/Users/chrome-bot/Desktop'
|
|
||||||
local_path = os.path.join(editor_location, 'editor.zip')
|
|
||||||
if os.path.exists(local_path):
|
|
||||||
os.remove(local_path)
|
|
||||||
local_extracted = os.path.join(editor_location, 'dart')
|
|
||||||
shutil.rmtree(local_extracted, ignore_errors=True)
|
|
||||||
gsutils.execute(['cp', editor_path, local_path])
|
|
||||||
Run(['unzip', local_path, '-d', editor_location])
|
|
||||||
|
|
||||||
def FTMaster(config):
|
|
||||||
run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN'])
|
|
||||||
with bot.BuildStep('Master run %s' % run):
|
|
||||||
if run == 1:
|
|
||||||
print 'Not doing anything on master before the triggers'
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
builddir = os.path.join(bot_utils.DART_DIR,
|
|
||||||
utils.GetBuildDir(HOST_OS),
|
|
||||||
'functional_testing')
|
|
||||||
shutil.rmtree(builddir, ignore_errors=True)
|
|
||||||
os.makedirs(builddir)
|
|
||||||
script_locations = os.path.join(bot_utils.DART_DIR, 'editor', 'ft')
|
|
||||||
Run(['/home/chrome-bot/func-test/bot-run', builddir, script_locations])
|
|
||||||
#TODO Copy builddir to shared storage somewhere.
|
|
||||||
|
|
||||||
def FTSteps(config):
|
|
||||||
if config.builder_tag == 'master':
|
|
||||||
FTMaster(config)
|
|
||||||
else:
|
|
||||||
FTSlave(config)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
bot.RunBot(SrcConfig, FTSteps, build_step=None)
|
|
|
@ -1,79 +0,0 @@
|
||||||
#!/bin/bash --posix
|
|
||||||
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Setting SCRIPT_DIR this way is ugly, but is needed to handle the case where
|
|
||||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
|
||||||
# with this case.
|
|
||||||
SCRIPT_DIR="$(cd "${0%/*}" ; pwd -P)"
|
|
||||||
DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)"
|
|
||||||
|
|
||||||
FOUND_BATCH=0
|
|
||||||
FOUND_SDK=0
|
|
||||||
for ARG in "$@"
|
|
||||||
do
|
|
||||||
case $ARG in
|
|
||||||
-batch|--batch)
|
|
||||||
FOUND_BATCH=1
|
|
||||||
;;
|
|
||||||
--dart-sdk)
|
|
||||||
FOUND_SDK=1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
DART_SDK=""
|
|
||||||
if [ $FOUND_SDK = 0 ] ; then
|
|
||||||
if [ -f $DART_ANALYZER_HOME/lib/core/core.dart ] ; then
|
|
||||||
DART_SDK="--dart-sdk $DART_ANALYZER_HOME"
|
|
||||||
else
|
|
||||||
DART_SDK_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk
|
|
||||||
if [ -d $DART_SDK_HOME ] ; then
|
|
||||||
DART_SDK="--dart-sdk $DART_SDK_HOME"
|
|
||||||
else
|
|
||||||
DART_SDK_HOME=$(dirname $DART_SDK_HOME)/dart-sdk
|
|
||||||
if [ -d $DART_SDK_HOME ] ; then
|
|
||||||
DART_SDK="--dart-sdk $DART_SDK_HOME"
|
|
||||||
else
|
|
||||||
echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f $DART_SDK_HOME/util/analyzer/dart_analyzer.jar ] ; then
|
|
||||||
DART_ANALYZER_LIBS=$DART_SDK_HOME/util/analyzer
|
|
||||||
elif [ -f $DART_ANALYZER_HOME/util/analyzer/dart_analyzer.jar ] ; then
|
|
||||||
DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/analyzer
|
|
||||||
else
|
|
||||||
echo "Configuration problem. Couldn't find dart_analyzer.jar."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -x /usr/libexec/java_home ]; then
|
|
||||||
export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXTRA_JVMARGS="-Xss2M "
|
|
||||||
OS=`uname | tr "[A-Z]" "[a-z]"`
|
|
||||||
if [ "$OS" == "darwin" ] ; then
|
|
||||||
# Bump up the heap on Mac VMs, some of which default to 128M or less.
|
|
||||||
# Users can specify DART_JVMARGS in the environment to override this
|
|
||||||
# setting.
|
|
||||||
EXTRA_JVMARGS+=" -Xmx256M -client "
|
|
||||||
else
|
|
||||||
# On other architectures
|
|
||||||
# -batch invocations will do better with a server vm
|
|
||||||
# invocations for analyzing a single file do better with a client vm
|
|
||||||
if [ $FOUND_BATCH = 0 ] ; then
|
|
||||||
EXTRA_JVMARGS+=" -client "
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \
|
|
||||||
com.google.dart.compiler.DartCompiler ${DART_SDK} $@
|
|
|
@ -1,52 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def Main():
|
|
||||||
def normjoin(*args):
|
|
||||||
return os.path.normpath(os.path.join(*args))
|
|
||||||
|
|
||||||
dart_dir = normjoin(__file__, '..', '..', '..')
|
|
||||||
compiler_scripts = normjoin(dart_dir, 'tools', 'compiler_scripts')
|
|
||||||
editor = normjoin(dart_dir, 'editor')
|
|
||||||
|
|
||||||
locations = {
|
|
||||||
'compiler_scripts': compiler_scripts,
|
|
||||||
'editor': editor,
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_source_list_calls = [
|
|
||||||
# The paths are relative to dart/editor/
|
|
||||||
{
|
|
||||||
"name" : "plugin_engine_java",
|
|
||||||
"output" : "%(editor)s/plugin_engine_sources" % locations,
|
|
||||||
"path" : "tools/plugins/com.google.dart.engine",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "plugin_command_analyze_java",
|
|
||||||
"output" : "%(editor)s/plugin_command_analyze_sources" % locations,
|
|
||||||
"path" : "tools/plugins/com.google.dart.command.analyze",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
for call_options in generate_source_list_calls:
|
|
||||||
command = (("python %(compiler_scripts)s/generate_source_list.py "
|
|
||||||
% locations) +
|
|
||||||
("%(name)s %(output)s %(path)s" % call_options))
|
|
||||||
exit_code = os.system(command)
|
|
||||||
if exit_code:
|
|
||||||
return exit_code
|
|
||||||
|
|
||||||
if '--no-gyp' in sys.argv:
|
|
||||||
print '--no-gyp is deprecated.'
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(Main())
|
|
|
@ -1,129 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
from __future__ import with_statement
|
|
||||||
import StringIO
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
class GenerateError(Exception):
|
|
||||||
|
|
||||||
def __init__(self, value):
|
|
||||||
self.value = value
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return repr(self.value)
|
|
||||||
|
|
||||||
|
|
||||||
class Generator:
|
|
||||||
|
|
||||||
def __init__(self, base_directory, name, output, path, *excludes):
|
|
||||||
self.base_directory = base_directory
|
|
||||||
self.name = name
|
|
||||||
self.output = output
|
|
||||||
self.path = path
|
|
||||||
self.excludes = set()
|
|
||||||
for x in excludes:
|
|
||||||
self.excludes.add(x)
|
|
||||||
self.sources = []
|
|
||||||
self.resources = []
|
|
||||||
|
|
||||||
def _list_files(self):
|
|
||||||
start_directory = os.path.join(self.base_directory, self.path)
|
|
||||||
for fullpath, dirs, filenames in os.walk(start_directory):
|
|
||||||
path = fullpath[len(start_directory) + 1:]
|
|
||||||
remove_me = [d for d in dirs if d.startswith('.') or
|
|
||||||
d == 'CVS' or
|
|
||||||
(d in self.excludes)]
|
|
||||||
for d in remove_me:
|
|
||||||
dirs.remove(d)
|
|
||||||
for filename in filenames:
|
|
||||||
if (filename.endswith('.java')):
|
|
||||||
self.sources.append(os.path.join(path, filename))
|
|
||||||
elif (filename.endswith('~')):
|
|
||||||
pass
|
|
||||||
elif (filename.endswith('.pyc')):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.resources.append(os.path.join(path, filename))
|
|
||||||
self.sources.sort()
|
|
||||||
self.resources.sort()
|
|
||||||
|
|
||||||
def _print_gypi_files(self, out, name, files):
|
|
||||||
out.write(" '%s': [\n" % name)
|
|
||||||
for filename in files:
|
|
||||||
out.write(''' r'%s/%s',%s''' % (self.path, filename,'\n'))
|
|
||||||
out.write(" ],\n")
|
|
||||||
|
|
||||||
def _print_txt_files(self, out, files):
|
|
||||||
for filename in files:
|
|
||||||
out.write('%s\n' % os.path.join(self.path, filename))
|
|
||||||
|
|
||||||
def _print_ant_files(self, out, name, files):
|
|
||||||
out.write(" <filelist id='%s' dir='%s'>\n" % (name, self.path))
|
|
||||||
for filename in files:
|
|
||||||
out.write(" <file name='%s'/>\n" % filename)
|
|
||||||
out.write(" </filelist>\n")
|
|
||||||
out.write(" <pathconvert pathsep=',' property='%s' refid='%s'>\n"
|
|
||||||
% (name, name))
|
|
||||||
out.write(" <map from='${basedir}/%s/' to=''/>\n" % self.path)
|
|
||||||
out.write(" </pathconvert>\n")
|
|
||||||
|
|
||||||
def _make_output(self, file_name):
|
|
||||||
if os.path.exists(file_name):
|
|
||||||
return StringIO.StringIO()
|
|
||||||
else:
|
|
||||||
return file(file_name, 'w')
|
|
||||||
|
|
||||||
def _close(self, file_name, output):
|
|
||||||
if not isinstance(output, StringIO.StringIO):
|
|
||||||
output.close()
|
|
||||||
return
|
|
||||||
new_text = output.getvalue()
|
|
||||||
output.close()
|
|
||||||
with open(file_name, 'r') as f:
|
|
||||||
old_text = f.read()
|
|
||||||
if old_text == new_text:
|
|
||||||
return
|
|
||||||
sys.stderr.write('Updating %s\n' % file_name)
|
|
||||||
with open(file_name, 'w') as f:
|
|
||||||
f.write(new_text)
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
self._list_files()
|
|
||||||
|
|
||||||
file_name = self.output + '.gypi'
|
|
||||||
gypi = self._make_output(file_name)
|
|
||||||
gypi.write("{\n 'variables': {\n")
|
|
||||||
self._print_gypi_files(gypi, self.name + '_sources', self.sources)
|
|
||||||
self._print_gypi_files(gypi, self.name + '_resources', self.resources)
|
|
||||||
gypi.write(" },\n}\n")
|
|
||||||
self._close(file_name, gypi)
|
|
||||||
|
|
||||||
file_name = self.output + '.xml'
|
|
||||||
ant = self._make_output(file_name)
|
|
||||||
ant.write("<project>\n")
|
|
||||||
self._print_ant_files(ant, self.name + '_sources', self.sources)
|
|
||||||
self._print_ant_files(ant, self.name + '_resources', self.resources)
|
|
||||||
ant.write("</project>\n")
|
|
||||||
self._close(file_name, ant)
|
|
||||||
|
|
||||||
file_name = self.output + '.txt'
|
|
||||||
txt = self._make_output(file_name)
|
|
||||||
self._print_txt_files(txt, self.sources)
|
|
||||||
self._close(file_name, txt)
|
|
||||||
|
|
||||||
|
|
||||||
def Main(script_name = None, name = None, output = None, path = None,
|
|
||||||
*rest):
|
|
||||||
if not path:
|
|
||||||
raise GenerateError("usage: %s NAME OUTPUT PATH EXCLUDE_DIR_NAME ..."
|
|
||||||
% script_name)
|
|
||||||
base_directory = os.path.dirname(output)
|
|
||||||
Generator(base_directory, name, output, path, *rest).generate()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(Main(*sys.argv))
|
|
|
@ -1,391 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# A script to generate a windows installer for the editor bundle.
|
|
||||||
# As input the script takes a zip file, a version and the location
|
|
||||||
# to store the resulting msi file in.
|
|
||||||
#
|
|
||||||
# Usage: ./tools/create_windows_installer.py --version <version>
|
|
||||||
# --zip_file_location <zip_file> --msi_location <output>
|
|
||||||
# [--wix_bin <wix_bin_location>]
|
|
||||||
# [--print_wxs]
|
|
||||||
#
|
|
||||||
# This script assumes that wix is either in path or passed in as --wix_bin.
|
|
||||||
# You can get wix from http://wixtoolset.org/.
|
|
||||||
|
|
||||||
import optparse
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import utils
|
|
||||||
import zipfile
|
|
||||||
|
|
||||||
# This should _never_ change, please don't change this value.
|
|
||||||
UPGRADE_CODE = '7bacdc33-2e76-4f36-a206-ea58220c0b44'
|
|
||||||
|
|
||||||
# The content of the xml
|
|
||||||
xml_content = []
|
|
||||||
|
|
||||||
# The components we want to add to our feature.
|
|
||||||
feature_components = []
|
|
||||||
|
|
||||||
# Indentation level, each level is indented 2 spaces
|
|
||||||
current_indentation = 0
|
|
||||||
|
|
||||||
def GetOptions():
|
|
||||||
options = optparse.OptionParser(usage='usage: %prog [options]')
|
|
||||||
options.add_option("--zip_file_location",
|
|
||||||
help='Where the zip file including the editor is located.')
|
|
||||||
options.add_option("--input_directory",
|
|
||||||
help='Directory where all the files needed is located.')
|
|
||||||
options.add_option("--msi_location",
|
|
||||||
help='Where to store the resulting msi.')
|
|
||||||
options.add_option("--version",
|
|
||||||
help='The version specified as Major.Minor.Build.Patch.')
|
|
||||||
options.add_option("--wix_bin",
|
|
||||||
help='The location of the wix binary files.')
|
|
||||||
options.add_option("--print_wxs", action="store_true", dest="print_wxs",
|
|
||||||
default=False,
|
|
||||||
help="Prints the generated wxs to stdout.")
|
|
||||||
(options, args) = options.parse_args()
|
|
||||||
if len(args) > 0:
|
|
||||||
raise Exception("This script takes no arguments, only options")
|
|
||||||
ValidateOptions(options)
|
|
||||||
return options
|
|
||||||
|
|
||||||
def ValidateOptions(options):
|
|
||||||
if not options.version:
|
|
||||||
raise Exception('You must supply a version')
|
|
||||||
if options.zip_file_location and options.input_directory:
|
|
||||||
raise Exception('Please pass either zip_file_location or input_directory')
|
|
||||||
if not options.zip_file_location and not options.input_directory:
|
|
||||||
raise Exception('Please pass either zip_file_location or input_directory')
|
|
||||||
if (options.zip_file_location and
|
|
||||||
not os.path.isfile(options.zip_file_location)):
|
|
||||||
raise Exception('Passed in zip file not found')
|
|
||||||
if (options.input_directory and
|
|
||||||
not os.path.isdir(options.input_directory)):
|
|
||||||
raise Exception('Passed in directory not found')
|
|
||||||
|
|
||||||
def GetInputDirectory(options, temp_dir):
|
|
||||||
if options.zip_file_location:
|
|
||||||
ExtractZipFile(options.zip_file_location, temp_dir)
|
|
||||||
return os.path.join(temp_dir, 'dart')
|
|
||||||
return options.input_directory
|
|
||||||
|
|
||||||
# We combine the build and patch into a single entry since
|
|
||||||
# the windows installer does _not_ consider a change in Patch
|
|
||||||
# to require a new install.
|
|
||||||
# In addition to that, the limits on the size are:
|
|
||||||
# Major: 256
|
|
||||||
# Minor: 256
|
|
||||||
# Patch: 65536
|
|
||||||
# To circumvent this we create the version like this:
|
|
||||||
# Major.Minor.X
|
|
||||||
# from "major.minor.patch-prerelease.prerelease_patch"
|
|
||||||
# where X is "patch<<10 + prerelease<<5 + prerelease_patch"
|
|
||||||
# Example version 1.2.4-dev.2.3 will go to 1.2.4163
|
|
||||||
def GetMicrosoftProductVersion(version):
|
|
||||||
version_parts = version.split('.')
|
|
||||||
if len(version_parts) is not 5:
|
|
||||||
raise Exception(
|
|
||||||
"Version string (%s) does not follow specification" % version)
|
|
||||||
(major, minor, patch, prerelease, prerelease_patch) = map(int, version_parts)
|
|
||||||
|
|
||||||
if major > 255 or minor > 255:
|
|
||||||
raise Exception('Major/Minor can not be above 256')
|
|
||||||
if patch > 63:
|
|
||||||
raise Exception('Patch can not be above 63')
|
|
||||||
if prerelease > 31:
|
|
||||||
raise Exception('Prerelease can not be above 31')
|
|
||||||
if prerelease_patch > 31:
|
|
||||||
raise Exception('PrereleasePatch can not be above 31')
|
|
||||||
|
|
||||||
combined = (patch << 10) + (prerelease << 5) + prerelease_patch
|
|
||||||
return '%s.%s.%s' % (major, minor, combined)
|
|
||||||
|
|
||||||
# Append using the current indentation level
|
|
||||||
def Append(data, new_line=True):
|
|
||||||
str = ((' ' * current_indentation) +
|
|
||||||
data +
|
|
||||||
('\n' if new_line else ''))
|
|
||||||
xml_content.append(str)
|
|
||||||
|
|
||||||
# Append without any indentation at the current position
|
|
||||||
def AppendRaw(data, new_line=True):
|
|
||||||
xml_content.append(data + ('\n' if new_line else ''))
|
|
||||||
|
|
||||||
def AppendComment(comment):
|
|
||||||
Append('<!--%s-->' % comment)
|
|
||||||
|
|
||||||
def AppendBlankLine():
|
|
||||||
Append('')
|
|
||||||
|
|
||||||
def GetContent():
|
|
||||||
return ''.join(xml_content)
|
|
||||||
|
|
||||||
def XmlHeader():
|
|
||||||
Append('<?xml version="1.0" encoding="UTF-8"?>')
|
|
||||||
|
|
||||||
def TagIndent(str, indentation_string):
|
|
||||||
return ' ' * len(indentation_string) + str
|
|
||||||
|
|
||||||
def IncreaseIndentation():
|
|
||||||
global current_indentation
|
|
||||||
current_indentation += 1
|
|
||||||
|
|
||||||
def DecreaseIndentation():
|
|
||||||
global current_indentation
|
|
||||||
current_indentation -= 1
|
|
||||||
|
|
||||||
class WixAndProduct(object):
|
|
||||||
def __init__(self, version):
|
|
||||||
self.version = version
|
|
||||||
self.product_name = 'Dart Editor'
|
|
||||||
self.manufacturer = 'Google Inc.'
|
|
||||||
self.upgrade_code = UPGRADE_CODE
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
self.start_wix()
|
|
||||||
self.start_product()
|
|
||||||
|
|
||||||
def __exit__(self, *_):
|
|
||||||
self.close_product()
|
|
||||||
self.close_wix()
|
|
||||||
|
|
||||||
def get_product_id(self):
|
|
||||||
# This needs to change on every install to guarantee that
|
|
||||||
# we get a full uninstall + reinstall
|
|
||||||
# We let wix choose. If we need to do patch releases later on
|
|
||||||
# we need to retain the value over several installs.
|
|
||||||
return '*'
|
|
||||||
|
|
||||||
def start_product(self):
|
|
||||||
product = '<Product '
|
|
||||||
Append(product, new_line=False)
|
|
||||||
AppendRaw('Id="%s"' % self.get_product_id())
|
|
||||||
Append(TagIndent('Version="%s"' % self.version, product))
|
|
||||||
Append(TagIndent('Name="%s"' % self.product_name, product))
|
|
||||||
Append(TagIndent('UpgradeCode="%s"' % self.upgrade_code,
|
|
||||||
product))
|
|
||||||
Append(TagIndent('Language="1033"', product))
|
|
||||||
Append(TagIndent('Manufacturer="%s"' % self.manufacturer,
|
|
||||||
product),
|
|
||||||
new_line=False)
|
|
||||||
AppendRaw('>')
|
|
||||||
IncreaseIndentation()
|
|
||||||
|
|
||||||
def close_product(self):
|
|
||||||
DecreaseIndentation()
|
|
||||||
Append('</Product>')
|
|
||||||
|
|
||||||
def start_wix(self):
|
|
||||||
Append('<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">')
|
|
||||||
IncreaseIndentation()
|
|
||||||
|
|
||||||
def close_wix(self):
|
|
||||||
DecreaseIndentation()
|
|
||||||
Append('</Wix>')
|
|
||||||
|
|
||||||
class Directory(object):
|
|
||||||
def __init__(self, id, name=None):
|
|
||||||
self.id = id
|
|
||||||
self.name = name
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
directory = '<Directory '
|
|
||||||
Append(directory, new_line=False)
|
|
||||||
AppendRaw('Id="%s"' % self.id, new_line=self.name is not None)
|
|
||||||
if self.name:
|
|
||||||
Append(TagIndent('Name="%s"' % self.name, directory), new_line=False)
|
|
||||||
AppendRaw('>')
|
|
||||||
IncreaseIndentation()
|
|
||||||
|
|
||||||
def __exit__(self, *_):
|
|
||||||
DecreaseIndentation()
|
|
||||||
Append('</Directory>')
|
|
||||||
|
|
||||||
class Component(object):
|
|
||||||
def __init__(self, id):
|
|
||||||
self.id = 'CMP_%s' % id
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
component = '<Component '
|
|
||||||
Append(component, new_line=False)
|
|
||||||
AppendRaw('Id="%s"' % self.id)
|
|
||||||
Append(TagIndent('Guid="*">', component))
|
|
||||||
IncreaseIndentation()
|
|
||||||
|
|
||||||
def __exit__(self, *_):
|
|
||||||
DecreaseIndentation()
|
|
||||||
Append('</Component>')
|
|
||||||
feature_components.append(self.id)
|
|
||||||
|
|
||||||
class Feature(object):
|
|
||||||
def __enter__(self):
|
|
||||||
feature = '<Feature '
|
|
||||||
Append(feature, new_line=False)
|
|
||||||
AppendRaw('Id="MainFeature"')
|
|
||||||
Append(TagIndent('Title="Dart Editor"', feature))
|
|
||||||
# Install by default
|
|
||||||
Append(TagIndent('Level="1">', feature))
|
|
||||||
IncreaseIndentation()
|
|
||||||
|
|
||||||
def __exit__(self, *_):
|
|
||||||
DecreaseIndentation()
|
|
||||||
Append('</Feature>')
|
|
||||||
|
|
||||||
def Package():
|
|
||||||
package = '<Package '
|
|
||||||
Append(package, new_line=False)
|
|
||||||
AppendRaw('InstallerVersion="301"')
|
|
||||||
Append(TagIndent('Compressed="yes" />', package))
|
|
||||||
|
|
||||||
def MediaTemplate():
|
|
||||||
Append('<MediaTemplate EmbedCab="yes" />')
|
|
||||||
|
|
||||||
def File(name, id):
|
|
||||||
file = '<File '
|
|
||||||
Append(file, new_line=False)
|
|
||||||
AppendRaw('Id="FILE_%s"' % id)
|
|
||||||
Append(TagIndent('Source="%s"' % name, file))
|
|
||||||
Append(TagIndent('KeyPath="yes" />', file))
|
|
||||||
|
|
||||||
def Shortcut(id, name, ref):
|
|
||||||
shortcut = '<Shortcut '
|
|
||||||
Append(shortcut, new_line=False)
|
|
||||||
AppendRaw('Id="%s"' % id)
|
|
||||||
Append(TagIndent('Name="%s"' % name, shortcut))
|
|
||||||
Append(TagIndent('Target="%s" />' % ref, shortcut))
|
|
||||||
|
|
||||||
def RemoveFolder(id):
|
|
||||||
remove = '<RemoveFolder '
|
|
||||||
Append(remove, new_line=False)
|
|
||||||
AppendRaw('Id="%s"' % id)
|
|
||||||
Append(TagIndent('On="uninstall" />', remove))
|
|
||||||
|
|
||||||
def RegistryEntry(location):
|
|
||||||
registry = '<RegistryValue '
|
|
||||||
Append(registry, new_line=False)
|
|
||||||
AppendRaw('Root="HKCU"')
|
|
||||||
Append(TagIndent('Key="Software\\Microsoft\\%s"' % location, registry))
|
|
||||||
Append(TagIndent('Name="installed"', registry))
|
|
||||||
Append(TagIndent('Type="integer"', registry))
|
|
||||||
Append(TagIndent('Value="1"', registry))
|
|
||||||
Append(TagIndent('KeyPath="yes" />', registry))
|
|
||||||
|
|
||||||
|
|
||||||
def MajorUpgrade():
|
|
||||||
upgrade = '<MajorUpgrade '
|
|
||||||
Append(upgrade, new_line=False)
|
|
||||||
down_message = 'You already have a never version installed.'
|
|
||||||
AppendRaw('DowngradeErrorMessage="%s" />' % down_message)
|
|
||||||
|
|
||||||
|
|
||||||
# This is a very simplistic id generation.
|
|
||||||
# Unfortunately there is no easy way to generate good names,
|
|
||||||
# since there is a 72 character limit, and we have way longer
|
|
||||||
# paths. We don't really have an issue with files and ids across
|
|
||||||
# releases since we do full installs.
|
|
||||||
counter = 0
|
|
||||||
def FileToId(name):
|
|
||||||
global counter
|
|
||||||
counter += 1
|
|
||||||
return '%s' % counter
|
|
||||||
|
|
||||||
def ListFiles(path):
|
|
||||||
for entry in os.listdir(path):
|
|
||||||
full_path = os.path.join(path, entry)
|
|
||||||
id = FileToId(full_path)
|
|
||||||
if os.path.isdir(full_path):
|
|
||||||
with Directory('DIR_%s' % id, entry):
|
|
||||||
ListFiles(full_path)
|
|
||||||
elif os.path.isfile(full_path):
|
|
||||||
# We assume 1 file per component, a File is always a KeyPath.
|
|
||||||
# A KeyPath on a file makes sure that we can always repair and
|
|
||||||
# remove that file in a consistent manner. A component
|
|
||||||
# can only have one child with a KeyPath.
|
|
||||||
with Component(id):
|
|
||||||
File(full_path, id)
|
|
||||||
|
|
||||||
def ComponentRefs():
|
|
||||||
for component in feature_components:
|
|
||||||
Append('<ComponentRef Id="%s" />' % component)
|
|
||||||
|
|
||||||
def ExtractZipFile(zip, temp_dir):
|
|
||||||
print 'Extracting files'
|
|
||||||
f = zipfile.ZipFile(zip)
|
|
||||||
f.extractall(temp_dir)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def GenerateInstaller(wxs_content, options, temp_dir):
|
|
||||||
wxs_file = os.path.join(temp_dir, 'installer.wxs')
|
|
||||||
wixobj_file = os.path.join(temp_dir, 'installer.wixobj')
|
|
||||||
print 'Saving wxs output to: %s' % wxs_file
|
|
||||||
with open(wxs_file, 'w') as f:
|
|
||||||
f.write(wxs_content)
|
|
||||||
|
|
||||||
candle_bin = 'candle.exe'
|
|
||||||
light_bin = 'light.exe'
|
|
||||||
if options.wix_bin:
|
|
||||||
candle_bin = os.path.join(options.wix_bin, 'candle.exe')
|
|
||||||
light_bin = os.path.join(options.wix_bin, 'light.exe')
|
|
||||||
print 'Calling candle on %s' % wxs_file
|
|
||||||
subprocess.check_call('%s %s -o %s' % (candle_bin, wxs_file,
|
|
||||||
wixobj_file))
|
|
||||||
print 'Calling light on %s' % wixobj_file
|
|
||||||
subprocess.check_call('%s %s -o %s' % (light_bin, wixobj_file,
|
|
||||||
options.msi_location))
|
|
||||||
print 'Created msi file to %s' % options.msi_location
|
|
||||||
|
|
||||||
|
|
||||||
def Main(argv):
|
|
||||||
if sys.platform != 'win32':
|
|
||||||
raise Exception("This script can only be run on windows")
|
|
||||||
options = GetOptions()
|
|
||||||
version = GetMicrosoftProductVersion(options.version)
|
|
||||||
with utils.TempDir('installer') as temp_dir:
|
|
||||||
input_location = GetInputDirectory(options, temp_dir)
|
|
||||||
print "Generating wix XML"
|
|
||||||
XmlHeader()
|
|
||||||
with WixAndProduct(version):
|
|
||||||
AppendBlankLine()
|
|
||||||
Package()
|
|
||||||
MediaTemplate()
|
|
||||||
AppendComment('We always do a major upgrade, at least for now')
|
|
||||||
MajorUpgrade()
|
|
||||||
|
|
||||||
AppendComment('Directory structure')
|
|
||||||
with Directory('TARGETDIR', 'SourceDir'):
|
|
||||||
with Directory('ProgramFilesFolder'):
|
|
||||||
with Directory('RootInstallDir', 'Dart Editor'):
|
|
||||||
AppendComment("Add all files and directories")
|
|
||||||
print 'Installing files and directories in xml'
|
|
||||||
ListFiles(input_location)
|
|
||||||
AppendBlankLine()
|
|
||||||
AppendComment("Create shortcuts")
|
|
||||||
with Directory('ProgramMenuFolder'):
|
|
||||||
with Directory('ShortcutFolder', 'Dart Editor'):
|
|
||||||
with Component('shortcut'):
|
|
||||||
# When generating a shortcut we need an entry with
|
|
||||||
# a KeyPath (RegistryEntry) below - to be able to remove
|
|
||||||
# the shortcut again. The RemoveFolder tag is needed
|
|
||||||
# to clean up everything
|
|
||||||
Shortcut('editor_shortcut', 'Dart Editor',
|
|
||||||
'[RootInstallDir]DartEditor.exe')
|
|
||||||
RemoveFolder('RemoveShortcuts')
|
|
||||||
RegistryEntry('DartEditor')
|
|
||||||
with Feature():
|
|
||||||
# We have only one feature, and it consists of all the
|
|
||||||
# files=components we have listed above"
|
|
||||||
ComponentRefs()
|
|
||||||
xml = GetContent()
|
|
||||||
if options.print_wxs:
|
|
||||||
print xml
|
|
||||||
GenerateInstaller(xml, options, temp_dir)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(Main(sys.argv))
|
|
|
@ -1,121 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# Fail if a command failed
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ $# -ne 5 ]; then
|
|
||||||
echo "Usage $0 <app-folder> <editor-build-directory> <dart-sdk> " \
|
|
||||||
"<Chromium.app> <icon.icns>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
OUTPUT_APP_FOLDER=$1
|
|
||||||
INPUT_EDITOR_BUILD_DIRECTORY=$2
|
|
||||||
INPUT_DART_SDK_DIRECTORY=$3
|
|
||||||
INPUT_CHROMIUM_APP_DIRECTORY=$4
|
|
||||||
INPUT_ICON_PATH=$5
|
|
||||||
|
|
||||||
# Input validations
|
|
||||||
if [ "${OUTPUT_APP_FOLDER##*.}" != "app" ]; then
|
|
||||||
echo "Application folder has to end in '.app' " \
|
|
||||||
"(but was $APP_FOLDER_NAME)."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "${INPUT_ICON_PATH##*.}" != "icns" ]; then
|
|
||||||
echo "Application icon has to end in '.icns'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
function ensure_exists {
|
|
||||||
if [ ! -e "$1" ]; then
|
|
||||||
echo "Directory or file does not exist: $1."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
ensure_exists "$INPUT_EDITOR_BUILD_DIRECTORY"
|
|
||||||
ensure_exists "$INPUT_DART_SDK_DIRECTORY"
|
|
||||||
|
|
||||||
# Remove old directory if present
|
|
||||||
if [ -e "$OUTPUT_APP_FOLDER" ]; then
|
|
||||||
rm -r "$OUTPUT_APP_FOLDER"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make directory structure and copy necessary files
|
|
||||||
mkdir -p "$OUTPUT_APP_FOLDER/Contents/MacOS"
|
|
||||||
LAUNCHER_SUBPATH="DartEditor.app/Contents/MacOS/DartEditor"
|
|
||||||
cp "$INPUT_EDITOR_BUILD_DIRECTORY/$LAUNCHER_SUBPATH" \
|
|
||||||
"$OUTPUT_APP_FOLDER/Contents/MacOS/"
|
|
||||||
cp "$INPUT_EDITOR_BUILD_DIRECTORY/$LAUNCHER_SUBPATH.ini" \
|
|
||||||
"$OUTPUT_APP_FOLDER/Contents/MacOS/"
|
|
||||||
mkdir -p "$OUTPUT_APP_FOLDER/Contents/Resources"
|
|
||||||
cp "$INPUT_ICON_PATH" "$OUTPUT_APP_FOLDER/Contents/Resources/dart.icns"
|
|
||||||
cp -R "$INPUT_DART_SDK_DIRECTORY" \
|
|
||||||
"$OUTPUT_APP_FOLDER/Contents/Resources/dart-sdk"
|
|
||||||
cp -R "$INPUT_CHROMIUM_APP_DIRECTORY" \
|
|
||||||
"$OUTPUT_APP_FOLDER/Contents/Resources/Chromium.app"
|
|
||||||
for dirname in $(echo configuration plugins features samples); do
|
|
||||||
cp -R "$INPUT_EDITOR_BUILD_DIRECTORY/$dirname" \
|
|
||||||
"$OUTPUT_APP_FOLDER/Contents/Resources/"
|
|
||||||
done
|
|
||||||
|
|
||||||
EQUINOX_LAUNCHER_JARFILE=$(cd "$OUTPUT_APP_FOLDER"; \
|
|
||||||
ls Contents/Resources/plugins/org.eclipse.equinox.launcher_*.jar);
|
|
||||||
|
|
||||||
EQUINOX_LAUNCHER_LIBRARY=$(cd "$OUTPUT_APP_FOLDER"; ls \
|
|
||||||
Contents/Resources/plugins/org.eclipse.equinox.launcher.cocoa.*/eclipse_*.so);
|
|
||||||
|
|
||||||
cat > "$OUTPUT_APP_FOLDER/Contents/Info.plist" << EOF
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
|
||||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
|
||||||
<true/>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>DartEditor</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>Eclipse 3.7 for Mac OS X, Copyright IBM Corp. and others 2002,
|
|
||||||
2011. All rights reserved.</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>dart.icns</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.eclipse.eclipse</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>DartEditor</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>3.7</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>3.7</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleLocalizations</key>
|
|
||||||
<array>
|
|
||||||
<string>en</string>
|
|
||||||
<key>WorkingDirectory</key>
|
|
||||||
<string>\$APP_PACKAGE/Contents/Resources</string>
|
|
||||||
</array>
|
|
||||||
<key>Eclipse</key>
|
|
||||||
<array>
|
|
||||||
<string>-startup</string>
|
|
||||||
<string>\$APP_PACKAGE/$EQUINOX_LAUNCHER_JARFILE</string>
|
|
||||||
<string>--launcher.library</string>
|
|
||||||
<string>\$APP_PACKAGE/$EQUINOX_LAUNCHER_LIBRARY</string>
|
|
||||||
<string>-keyring</string><string>~/.eclipse_keyring</string>
|
|
||||||
<string>-showlocation</string>
|
|
||||||
<key>WorkingDirectory</key>
|
|
||||||
<string>\$APP_PACKAGE/Contents/Resources</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
EOF
|
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# This is partly based on
|
|
||||||
# https://bitbucket.org/rmacnak/nsvm/src/
|
|
||||||
# b2de52432a2baff9c4ada099430fb16a771d34ef/vm/onebuild/installer-Darwin.gmk
|
|
||||||
|
|
||||||
# Fail if a command failed
|
|
||||||
set -e
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
|
|
||||||
if [ $# -ne 4 ]; then
|
|
||||||
echo "Usage $0 <output.dmg> <raw-editor-bundle> <folder-icon> <volume-name>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
OUTPUT_DMG_FILE=$1
|
|
||||||
INPUT_FOLDER_PATH=$2
|
|
||||||
FOLDER_ICON=$3
|
|
||||||
INPUT_VOLUME_NAME=$4
|
|
||||||
|
|
||||||
FOLDER_NAME="Dart"
|
|
||||||
VOLUME_MOUNTPOINT="/Volumes/$INPUT_VOLUME_NAME"
|
|
||||||
SPARSEIMAGE="$OUTPUT_DMG_FILE.sparseimage"
|
|
||||||
|
|
||||||
# Input validations
|
|
||||||
if [ ! -d "$INPUT_FOLDER_PATH" ]; then
|
|
||||||
echo "Editor bundle folder does not exist ($INPUT_FOLDER_PATH)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If an old image is still mounted, umount it
|
|
||||||
if [ -e "$VOLUME_MOUNTPOINT" ]; then
|
|
||||||
hdiutil eject "$VOLUME_MOUNTPOINT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove old output files
|
|
||||||
if [ -f "$SPARSEIMAGE" ]; then
|
|
||||||
rm "$SPARSEIMAGE"
|
|
||||||
fi
|
|
||||||
if [ -f "$OUTPUT_DMG_FILE" ]; then
|
|
||||||
rm "$OUTPUT_DMG_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This function will set (or replace) the icon of a folder.
|
|
||||||
# Finder displays a default folder icon. Since the installer
|
|
||||||
# will consist of a folder and a link to "/Applications", we want
|
|
||||||
# the folder to have a nice icon.
|
|
||||||
# In order to make Finder display a custom icon, we need to
|
|
||||||
# - Have a "FOLDER/Icon\r" file which contains the icon resource
|
|
||||||
# (i.e. the metadata of this file will contain an icon)
|
|
||||||
# - Have the 'custom icon' attribute set on "FOLDER"
|
|
||||||
# Additionally we mark the "FOLDER/Icon\r" file as invisible, so it
|
|
||||||
# is not shown in Finder (although it's visible on the commandline).
|
|
||||||
replace_folder_icon() {
|
|
||||||
FOLDER="$1"
|
|
||||||
ICON="$2"
|
|
||||||
TEMP_ICON_RESOURCE='/tmp/icns.rsrc'
|
|
||||||
ICON_RESOURCE="$FOLDER"/$'Icon\r'
|
|
||||||
|
|
||||||
# Add finder icon to the image file
|
|
||||||
sips -i "$ICON" > /dev/null
|
|
||||||
|
|
||||||
# Extract the finder icon resource
|
|
||||||
DeRez -only icns "$ICON" > "$TEMP_ICON_RESOURCE"
|
|
||||||
|
|
||||||
# Create the icon resource
|
|
||||||
rm -f "$ICON_RESOURCE"
|
|
||||||
Rez -append "$TEMP_ICON_RESOURCE" -o "$ICON_RESOURCE"
|
|
||||||
rm "$TEMP_ICON_RESOURCE"
|
|
||||||
|
|
||||||
# Set the 'custom icon' attribute on $FOLDER
|
|
||||||
SetFile -a C "$FOLDER"
|
|
||||||
|
|
||||||
# Make the $ICON_RESOURCE invisible for finder
|
|
||||||
SetFile -a V "$ICON_RESOURCE"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Create a new image and attach it
|
|
||||||
hdiutil create -size 400m -type SPARSE -volname "$INPUT_VOLUME_NAME" -fs \
|
|
||||||
'Journaled HFS+' "$SPARSEIMAGE"
|
|
||||||
hdiutil attach "$SPARSEIMAGE"
|
|
||||||
|
|
||||||
# Add link to /Applications (so the user can drag-and-drop into it)
|
|
||||||
ln -s /Applications "$VOLUME_MOUNTPOINT/"
|
|
||||||
# Copy our application
|
|
||||||
ditto "$INPUT_FOLDER_PATH" "$VOLUME_MOUNTPOINT/$FOLDER_NAME"
|
|
||||||
# Set custom icon on this folder
|
|
||||||
replace_folder_icon "$VOLUME_MOUNTPOINT/$FOLDER_NAME" "$FOLDER_ICON"
|
|
||||||
# Make sure that the dmg gets opened when mounting the image
|
|
||||||
bless --folder "$VOLUME_MOUNTPOINT" --openfolder "$VOLUME_MOUNTPOINT"
|
|
||||||
|
|
||||||
# Use an applescript to setup the layout of the folder.
|
|
||||||
osascript << EOF
|
|
||||||
tell application "Finder"
|
|
||||||
tell disk "$INPUT_VOLUME_NAME"
|
|
||||||
open
|
|
||||||
tell container window
|
|
||||||
set current view to icon view
|
|
||||||
set toolbar visible to false
|
|
||||||
set statusbar visible to false
|
|
||||||
set position to {100, 100}
|
|
||||||
set bounds to {100, 100, 512, 256}
|
|
||||||
end tell
|
|
||||||
tell icon view options of container window
|
|
||||||
set arrangement to not arranged
|
|
||||||
set icon size to 128
|
|
||||||
end tell
|
|
||||||
set position of item "$FOLDER_NAME" to {64, 64}
|
|
||||||
set position of item "Applications" to {320, 64}
|
|
||||||
eject
|
|
||||||
end tell
|
|
||||||
end tell
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Wait until the script above has umounted the image
|
|
||||||
while [ -e "$VOLUME_MOUNTPOINT" ]; do
|
|
||||||
echo "Waiting for Finder to eject $VOLUME_MOUNTPOINT"
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
# Compress the sparse image
|
|
||||||
hdiutil convert "$SPARSEIMAGE" -format UDBZ -o "$OUTPUT_DMG_FILE"
|
|
||||||
|
|
||||||
# Remove sparse image
|
|
||||||
rm "$SPARSEIMAGE"
|
|
||||||
|
|
Loading…
Reference in a new issue