Skip to content

Commit b0d7556

Browse files
authored
Merge pull request #74 from PropGit/demo
Mac build/sign/package updates plus project version script
2 parents 728590f + 97cc445 commit b0d7556

File tree

6 files changed

+105
-5
lines changed

6 files changed

+105
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ venv/
66
VPython/
77
*.app
88
*.pkg
9+
*.bak
910

1011
#################
1112
## Eclipse

BlocklyPropClient.macos.spec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ coll = COLLECT(exe,
4343
app = BUNDLE(coll,
4444
name='BlocklyPropClient.app',
4545
icon='BlocklyPropClient.icns',
46-
bundle_identifier='com.ParallaxInc.BlocklyPropClient',
47-
info_plist={'CFBundleShortVersionString': '0.5.3'})
46+
bundle_identifier='com.ParallaxInc.BlocklyPropClient')
4847

4948
# From Analysis
5049
# pathex=['/Users/<username>/PythonProjects/BlocklyPropClient'],

about.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CurrentVersion: v0.5.3
1+
Version: v0.5.3
22

33
Contributors:
44
- Michel Lampo
@@ -8,4 +8,4 @@ Contributors:
88

99
Repository Source Code: http://github.com/parallaxinc/BlocklyPropClient
1010

11-
Copyright 2015 - 2017 Parallax Inc
11+
Copyright 2015 - 2017 Parallax Inc.

package/blocklypropclient-installer.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define MyAppName "BlocklyPropClient"
55
#define MyAppVersion "0.5.3"
6-
#define MyAppPublisher "Parallax, Inc."
6+
#define MyAppPublisher "Parallax Inc."
77
#define MyAppURL "http://blockly.parallax.com/"
88
#define MyAppExeName "BlocklyPropClient.exe"
99

package/mac_app_sign_and_package.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,31 @@ fi
243243

244244
echo
245245

246+
#
247+
# Set bundle version number (in Info.plist)
248+
#
249+
if [[ -e ${DISTRIBUTION}${APP_BUNDLE} ]]
250+
then
251+
if [[ -e ${DISTRIBUTION}${APP_BUNDLE}/Contents/Info.plist ]]
252+
then
253+
if sed -i.bak s_\<string\>0.0.0\<\/string\>_\<string\>${VERSION}\<\/string\>_ ${DISTRIBUTION}${APP_BUNDLE}/Contents/Info.plist > ${DISTRIBUTION}${APP_BUNDLE}/Contents/Info2.plist
254+
then
255+
echo "Set bundle's Info.plist to version: \"${VERSION}\""
256+
else
257+
echo "[Error] Could not set bundle's version in Info.plist."
258+
exit 1
259+
fi
260+
else
261+
echo "[Error] Application bundle does not include an Info.plist file."
262+
exit 1
263+
fi
264+
else
265+
echo "[Error] Application bundle not found: ${DISTRIBUTION}${APP_BUNDLE}"
266+
exit 1
267+
fi
268+
269+
echo
270+
246271
#
247272
# Attempt to deeply codesign the app bundle
248273
#

set_version.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh --
2+
#
3+
# This script sets version number entries in various files in the BlocklyPropClient project.
4+
# Works in Ubuntu and OS X.
5+
#
6+
# Usage: $ ./set_version "1.2.3"
7+
8+
9+
#
10+
# Error if no version string declared
11+
#
12+
# if [ $1X == X ] <-- this doesn't work in Ubuntu
13+
if [ -z "$1" ]
14+
then
15+
echo "ERROR: Must specify a version number. Ex: \$ $0 \"1.2.3\""
16+
exit 1
17+
fi
18+
19+
20+
#
21+
# Get version string
22+
#
23+
VERSION=$1
24+
25+
26+
#
27+
# FindAndSetVersion function
28+
# Find and update version string in form "Version = #.#.#"
29+
# Search is: case-insensitive, space, tabs, or nothing around '=', and one or more # in each placeholder.
30+
# Replace is: performed in-place inside of file; however, a backup (.bak) of the original file is also made.
31+
#
32+
# NOTE: sed on Mac doesn't include a case-insensitive option. To keep the search pattern equivalent for both
33+
# grep and sed, must use an expanded pattern for text where each letter is expressed in both upper/lower case.
34+
# ex: Ver should be [vV][eE][rR]
35+
#
36+
# function FindAndSetVersion { <-- this doesn't work in Ubuntu
37+
FindAndSetVersion() {
38+
if grep -q -E ${VERSIONPATTERN} ${VERSIONFILE} ; then
39+
if sed -i.bak -E "s/${VERSIONPATTERN}/${VERSIONSTRING}/" ${VERSIONFILE} ; then
40+
echo "Updated file \"${VERSIONFILE}\" to include: ${VERSIONSTRING}"
41+
fi
42+
else
43+
echo "ERROR: Unable to find version string in file \"${VERSIONFILE}\""
44+
fi
45+
}
46+
47+
48+
#
49+
# Adjust BlocklyPropClient.py file - [format: VERSION = "#.#.#"]
50+
#
51+
VERSIONFILE=BlocklyPropClient.py
52+
VERSIONPATTERN=[vV][eE][rR][sS][iI][oO][nN][[:blank:]]*=[[:blank:]]*\"[0-9]+\.[0-9]+\.[0-9]+\"
53+
VERSIONSTRING="VERSION = \"${VERSION}\""
54+
55+
FindAndSetVersion
56+
57+
58+
#
59+
# Adjust about.txt file - [format: Version: v#.#.#]
60+
#
61+
VERSIONFILE=about.txt
62+
VERSIONPATTERN=[vV][eE][rR][sS][iI][oO][nN]:[[:blank:]]*v[[:blank:]]*[0-9]+\.[0-9]+\.[0-9]+
63+
VERSIONSTRING="Version: v${VERSION}"
64+
65+
FindAndSetVersion
66+
67+
68+
#
69+
# Adjust package/blocklypropclient-installer.iss file - [format: MyAppVersion "#.#.#"]
70+
#
71+
VERSIONFILE=package/blocklypropclient-installer.iss
72+
VERSIONPATTERN=[mM][yY][aA][pP][pP][vV][eE][rR][sS][iI][oO][nN][[:blank:]]+\"[0-9]+\.[0-9]+\.[0-9]+\"
73+
VERSIONSTRING="MyAppVersion \"${VERSION}\""
74+
75+
FindAndSetVersion

0 commit comments

Comments
 (0)