1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

chore: add current version in OSX's .plist file(s) with a script

Also add a script to update both osx and windows versions.
This commit is contained in:
Zetok Zalbavar 2016-12-07 15:51:26 +00:00
parent fb96dd633e
commit c717f128da
No known key found for this signature in database
GPG Key ID: C953D3880212068A
6 changed files with 142 additions and 9 deletions

View File

@ -17,7 +17,6 @@
<key>CFBundleName</key>
<string>qTox</string>
<key>CFBundleVersion</key>
<string>1.4.1</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleIdentifier</key>

View File

@ -212,6 +212,9 @@ update() {
build() {
fcho "------------------------------"
fcho "Starting build process ..."
# update version info
./tools/update-versions.sh
rm -rf $BUILD_DIR
rm -rf $DEPLOY_DIR
mkdir $BUILD_DIR

51
osx/update-plist-version.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
#
# Copyright © 2016 The qTox Project Contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# script to append correct qTox version to `.plist` file from
# `git describe`
#
# NOTE: it checkouts the files before appending a version to them!
#
# requires:
# * correctly formatted `*.plist file(s) in working dir
# * git tags in format `v0.0.0`
# * GNU sed
# usage:
#
# ./$script
set -eu -o pipefail
# uses `get_version()`
source "../tools/lib/git.source"
# append version to .plist file(s) after the right line
append_version() {
local after_line=' <key>CFBundleVersion'
local append=" <string>$(get_version)<\/string>"
for plist in *.plist
do
git checkout "$plist"
sed -i"" -e "/$after_line/a\\
$append" "$plist"
done
}
append_version

28
tools/lib/git.source Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright © 2016 The qTox Project Contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# source for scripts using git-based functionality
set -e -o pipefail
# Get numerical version from git tag, parts of version separated by dots
# from e.g. `v123.456.789` get `123.456.789` part
get_version() {
git describe --abbrev=0 \
| sed -e 's/^v//'
}

55
tools/update-versions.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
#
# Copyright © 2016 The qTox Project Contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# script to add versions to the files for osx and windows "packages"
#
# it should be run by the `qTox-Mac-Deployer-ULTIMATE.sh`
#
# NOTE: it checkouts the files before appending a version to them!
#
# requires:
# * git tags in format `v0.0.0`
# * GNU sed
# usage:
#
# ./$script
set -eu -o pipefail
update_windows() {
( cd windows
./qtox-nsi-version.sh )
}
update_osx() {
( cd osx
./update-plist-version.sh )
}
main() {
update_osx
# osx cannot into proper sed
if [[ ! "$OSTYPE" == "darwin"* ]]
then
update_windows
fi
}
main

View File

@ -18,6 +18,8 @@
# script to append correct qTox version to `.nsi` files from
# `git describe`
#
# NOTE: it checkouts the files before appending a version to them!
#
# requires:
# * files `qtox.nsi` and `qtox64.nsi` in working dir
# * git tags in format `v0.0.0`
@ -29,14 +31,8 @@
set -eu -o pipefail
# from e.g. `v123.456.789-321-asdf` get `123.456.789` part
get_version() {
git describe --tags \
| sed -r \
-e 's/^v//' \
-e 's/^(([[:digit:]]+\.){2}[[:digit:]]+)-.*/\1/'
}
# uses `get_version()`
source "../tools/lib/git.source"
# append version to .nsi files after a certain line
@ -46,6 +42,7 @@ append_version() {
for nsi in *.nsi
do
git checkout "$nsi"
sed -i "/$after_line/a\\$append \"$(get_version)\"" "$nsi"
done
}