2
2
3
3
#
4
4
# input params: choose a platform to build for (default: all)
5
- # and choose a name for the app (default: IBM Cloud Functions Shell)
6
5
#
7
6
PLATFORM=${1-all}
8
- APP_NAME=" ${APP_NAME-IBM Cloud Functions Shell} "
9
7
10
- VERSION= ` git rev-parse master `
11
- BUILDDIR= build
8
+ # product name
9
+ PRODUCT_NAME= " ${PRODUCT_NAME-`cat .. / build/ config.json | jq --raw-output .productName` "
12
10
13
- # openwhisk icons
14
- # ICON_MAC=../assets/icons/icns/OpenWhisk-512x512.icns
15
- # ICON_WIN32=../assets/icons/ico/openwhisk_512x512_jnb_icon.ico
11
+ # filesystem icons
12
+ ICON_MAC=` cat ../build/config.json | jq --raw-output .filesystemIcons.darwin`
13
+ ICON_WIN32=` cat ../build/config.json | jq --raw-output .filesystemIcons.win32`
14
+ ICON_LINUX=` cat ../build/config.json | jq --raw-output .filesystemIcons.linux`
16
15
17
- # dolphin icons
18
- ICON_MAC=../assets/icons/icns/blue-dolphin-transparent.icns
19
- ICON_WIN32=../assets/icons/ico/blue-dolphin-transparent.ico
20
- ICON_LINUX=../assets/icons/png/blue-dolphin-transparent.png
16
+ VERSION=` git rev-parse master`
17
+ BUILDDIR=build
21
18
22
19
function init {
23
20
# make the build directory
@@ -58,26 +55,26 @@ function win32 {
58
55
# create the bundles
59
56
./node_modules/.bin/electron-packager \
60
57
../app \
61
- " $APP_NAME " \
58
+ " $PRODUCT_NAME " \
62
59
--asar=true \
63
60
--build-version=$VERSION \
64
61
--out=$BUILDDIR \
65
62
--platform=win32 \
66
63
--icon=$ICON_WIN32 \
67
- --protocol=wsk --protocol-name=" Execute ${APP_NAME } commands" \
64
+ --protocol=wsk --protocol-name=" Execute ${PRODUCT_NAME } commands" \
68
65
--overwrite \
69
66
--win32metadata.CompanyName=" Apache" \
70
- --win32metadata.ProductName=" ${APP_NAME } "
67
+ --win32metadata.ProductName=" ${PRODUCT_NAME } "
71
68
72
69
# CLI scripts
73
- cp ../app/bin/fsh " $BUILDDIR /${APP_NAME } -win32-x64/fsh"
74
- cp ../app/bin/fsh.bat " $BUILDDIR /${APP_NAME } -win32-x64"
70
+ cp ../app/bin/fsh " $BUILDDIR / ${PRODUCT_NAME } -win32-x64/ fsh"
71
+ cp ../app/bin/fsh.bat " $BUILDDIR / ${PRODUCT_NAME } -win32-x64"
75
72
76
73
#
77
74
# deal with win32 packaging
78
75
#
79
76
if [ -z " $NO_INSTALLER " ]; then
80
- (cd $BUILDDIR && zip -q -r " ${APP_NAME } -win32-x64" " ${APP_NAME } -win32-x64" -x \* ~)
77
+ (cd $BUILDDIR && zip -q -r " ${PRODUCT_NAME } -win32-x64" " ${PRODUCT_NAME } -win32-x64" -x \*~)
81
78
fi
82
79
fi
83
80
}
@@ -90,30 +87,30 @@ function mac {
90
87
if [ " $PLATFORM " == " all" ] || [ " $PLATFORM " == " mac" ] || [ " $PLATFORM " == " macos" ] || [ " $PLATFORM " == " darwin" ]; then
91
88
./node_modules/.bin/electron-packager \
92
89
../app \
93
- " ${APP_NAME } " \
90
+ " ${PRODUCT_NAME } " \
94
91
--asar=true \
95
92
--build-version=$VERSION \
96
93
--ignore='~$' \
97
94
--out=$BUILDDIR \
98
95
--platform=darwin \
99
96
--icon=$ICON_MAC \
100
- --protocol=wsk --protocol-name=" Execute ${APP_NAME } commands" \
97
+ --protocol=wsk --protocol-name=" Execute ${PRODUCT_NAME } commands" \
101
98
--overwrite
102
99
103
100
# use a custom icon for mac
104
- cp $ICON_MAC " $BUILDDIR /${APP_NAME } -darwin-x64/${APP_NAME } .app/Contents/Resources/electron.icns"
101
+ cp $ICON_MAC " $BUILDDIR / ${PRODUCT_NAME } -darwin-x64/ ${PRODUCT_NAME } .app/ Contents/ Resources/ electron.icns"
105
102
106
103
# CLI script
107
- cp ../app/bin/fsh " $BUILDDIR /${APP_NAME } -darwin-x64/${APP_NAME } .app/Contents/MacOS/"
104
+ cp ../app/bin/fsh " $BUILDDIR / ${PRODUCT_NAME } -darwin-x64/ ${PRODUCT_NAME } .app/ Contents/ MacOS/ "
108
105
109
106
# create the installers
110
107
if [ -n " $ZIP_INSTALLER " ]; then
111
- (cd $BUILDDIR && zip -q -r " ${APP_NAME } -darwin-x64" " ${APP_NAME } -darwin-x64" -x \* ~)
108
+ (cd $BUILDDIR && zip -q -r " ${PRODUCT_NAME } -darwin-x64" " ${PRODUCT_NAME } -darwin-x64" -x \*~)
112
109
113
110
elif [ -z " $NO_INSTALLER " ]; then
114
111
./node_modules/.bin/electron-installer-dmg \
115
- " $BUILDDIR /${APP_NAME } -darwin-x64/${APP_NAME } .app" \
116
- " ${APP_NAME } " \
112
+ " $BUILDDIR / ${PRODUCT_NAME } -darwin-x64/ ${PRODUCT_NAME } .app" \
113
+ " ${PRODUCT_NAME } " \
117
114
--out=$BUILDDIR \
118
115
--icon=$ICON_MAC \
119
116
--icon-size=128 \
@@ -129,20 +126,20 @@ function linux {
129
126
if [ " $PLATFORM " == " all" ] || [ " $PLATFORM " == " linux" ]; then
130
127
./node_modules/.bin/electron-packager \
131
128
../app \
132
- " ${APP_NAME } " \
129
+ " ${PRODUCT_NAME } " \
133
130
--asar=true \
134
131
--build-version=$VERSION \
135
132
--out=$BUILDDIR \
136
133
--platform=linux \
137
- --protocol=wsk --protocol-name=" Execute ${APP_NAME } commands" \
134
+ --protocol=wsk --protocol-name=" Execute ${PRODUCT_NAME } commands" \
138
135
--icon=$ICON_LINUX \
139
136
--overwrite
140
137
141
138
# CLI script
142
- cp ../app/bin/fsh " $BUILDDIR /${APP_NAME } -linux-x64"
139
+ cp ../app/bin/fsh " $BUILDDIR / ${PRODUCT_NAME } -linux-x64"
143
140
144
141
if [ -z " $NO_INSTALLER " ]; then
145
- (cd $BUILDDIR && zip -q -r " ${APP_NAME } -linux-x64" " ${APP_NAME } -linux-x64" -x \* ~)
142
+ (cd $BUILDDIR && zip -q -r " ${PRODUCT_NAME } -linux-x64" " ${PRODUCT_NAME } -linux-x64" -x \*~)
146
143
fi
147
144
fi
148
145
}
@@ -154,7 +151,3 @@ win32
154
151
mac
155
152
linux
156
153
cleanup
157
-
158
- # TODO:
159
- # upload to OS
160
- # (cd ../prebuilt && npm version publish)
0 commit comments