OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
3 # for details. All rights reserved. Use of this source code is governed by | |
4 # BSD-style license that can be found in the LICENSE file. | |
5 | |
6 # Fail if a command failed | |
7 set -e | |
8 | |
9 if [ $# -ne 5 ]; then | |
10 echo "Usage $0 <app-folder> <editor-build-directory> <dart-sdk> " \ | |
11 "<Chromium.app> <icon.icns>" | |
12 exit 1 | |
13 fi | |
14 | |
15 OUTPUT_APP_FOLDER=$1 | |
16 INPUT_EDITOR_BUILD_DIRECTORY=$2 | |
17 INPUT_DART_SDK_DIRECTORY=$3 | |
18 INPUT_CHROMIUM_APP_DIRECTORY=$4 | |
19 INPUT_ICON_PATH=$5 | |
20 | |
21 # Input validations | |
22 if [ "${OUTPUT_APP_FOLDER##*.}" != "app" ]; then | |
23 echo "Application folder has to end in '.app' " \ | |
24 "(but was $APP_FOLDER_NAME)." | |
25 exit 1 | |
26 fi | |
27 if [ "${INPUT_ICON_PATH##*.}" != "icns" ]; then | |
28 echo "Application icon has to end in '.icns'." | |
29 exit 1 | |
30 fi | |
31 | |
32 function ensure_exists { | |
33 if [ ! -e "$1" ]; then | |
34 echo "Directory or file does not exist: $1." | |
35 exit 1 | |
36 fi | |
37 } | |
38 ensure_exists "$INPUT_EDITOR_BUILD_DIRECTORY" | |
39 ensure_exists "$INPUT_DART_SDK_DIRECTORY" | |
40 | |
41 # Remove old directory if present | |
42 if [ -e "$OUTPUT_APP_FOLDER" ]; then | |
43 rm -r "$OUTPUT_APP_FOLDER" | |
44 fi | |
45 | |
46 # Make directory structure and copy necessary files | |
47 mkdir -p "$OUTPUT_APP_FOLDER/Contents/MacOS" | |
48 LAUNCHER_SUBPATH="DartEditor.app/Contents/MacOS/DartEditor" | |
49 cp "$INPUT_EDITOR_BUILD_DIRECTORY/$LAUNCHER_SUBPATH" \ | |
50 "$OUTPUT_APP_FOLDER/Contents/MacOS/" | |
51 cp "$INPUT_EDITOR_BUILD_DIRECTORY/$LAUNCHER_SUBPATH.ini" \ | |
52 "$OUTPUT_APP_FOLDER/Contents/MacOS/" | |
53 mkdir -p "$OUTPUT_APP_FOLDER/Contents/Resources" | |
54 cp "$INPUT_ICON_PATH" "$OUTPUT_APP_FOLDER/Contents/Resources/dart.icns" | |
55 cp -R "$INPUT_DART_SDK_DIRECTORY" \ | |
56 "$OUTPUT_APP_FOLDER/Contents/Resources/dart-sdk" | |
57 cp -R "$INPUT_CHROMIUM_APP_DIRECTORY" \ | |
58 "$OUTPUT_APP_FOLDER/Contents/Resources/Chromium.app" | |
59 for dirname in $(echo configuration plugins features samples); do | |
60 cp -R "$INPUT_EDITOR_BUILD_DIRECTORY/$dirname" \ | |
61 "$OUTPUT_APP_FOLDER/Contents/Resources/" | |
62 done | |
63 | |
64 EQUINOX_LAUNCHER_JARFILE=$(cd "$OUTPUT_APP_FOLDER"; \ | |
65 ls Contents/Resources/plugins/org.eclipse.equinox.launcher_*.jar); | |
66 | |
67 EQUINOX_LAUNCHER_LIBRARY=$(cd "$OUTPUT_APP_FOLDER"; ls \ | |
68 Contents/Resources/plugins/org.eclipse.equinox.launcher.cocoa.*/eclipse_*.so); | |
69 | |
70 cat > "$OUTPUT_APP_FOLDER/Contents/Info.plist" << EOF | |
71 <?xml version="1.0" encoding="UTF-8"?> | |
72 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" | |
73 "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
74 <plist version="1.0"> | |
75 <dict> | |
76 <key>NSHighResolutionCapable</key> | |
77 <true/> | |
78 <key>CFBundleExecutable</key> | |
79 <string>DartEditor</string> | |
80 <key>CFBundleGetInfoString</key> | |
81 <string>Eclipse 3.7 for Mac OS X, Copyright IBM Corp. and others 2002, | |
82 2011. All rights reserved.</string> | |
83 <key>CFBundleIconFile</key> | |
84 <string>dart.icns</string> | |
85 <key>CFBundleIdentifier</key> | |
86 <string>org.eclipse.eclipse</string> | |
87 <key>CFBundleInfoDictionaryVersion</key> | |
88 <string>6.0</string> | |
89 <key>CFBundleName</key> | |
90 <string>DartEditor</string> | |
91 <key>CFBundlePackageType</key> | |
92 <string>APPL</string> | |
93 <key>CFBundleShortVersionString</key> | |
94 <string>3.7</string> | |
95 <key>CFBundleSignature</key> | |
96 <string>????</string> | |
97 <key>CFBundleVersion</key> | |
98 <string>3.7</string> | |
99 <key>CFBundleDevelopmentRegion</key> | |
100 <string>English</string> | |
101 <key>CFBundleLocalizations</key> | |
102 <array> | |
103 <string>en</string> | |
104 <key>WorkingDirectory</key> | |
105 <string>\$APP_PACKAGE/Contents/Resources</string> | |
106 </array> | |
107 <key>Eclipse</key> | |
108 <array> | |
109 <string>-startup</string> | |
110 <string>\$APP_PACKAGE/$EQUINOX_LAUNCHER_JARFILE</string> | |
111 <string>--launcher.library</string> | |
112 <string>\$APP_PACKAGE/$EQUINOX_LAUNCHER_LIBRARY</string> | |
113 <string>-keyring</string><string>~/.eclipse_keyring</string> | |
114 <string>-showlocation</string> | |
115 <key>WorkingDirectory</key> | |
116 <string>\$APP_PACKAGE/Contents/Resources</string> | |
117 </array> | |
118 </dict> | |
119 </plist> | |
120 EOF | |
121 | |
OLD | NEW |