fix #267644: Add auto updater to MuseScore development versions

This commit is contained in:
lasconic 2018-07-17 16:08:03 +02:00
parent 1c387ee237
commit 6f2d96b4e9
11 changed files with 87 additions and 13 deletions

View file

@ -48,3 +48,14 @@ after_build:
artifacts:
- path: $(ARTIFACT_NAME)
deploy:
provider: S3
access_key_id:
secure: k68f3wMKIC5AzrfNMuC4kdPaxzvKdFVkRsietUKqc+E=
secret_access_key:
secure: IbpdpiHzGfMasaSA6uGrskE4xu9wE+HzElW7tIDOUww+ivHj+gN+mPgUHKCcV9Cn
bucket: update.musescore.org
region: us-east-1
set_public: true
artifact: C:\MuseScore\update_win_nightly.xml

View file

@ -24,6 +24,7 @@ CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSOR
PREFIX = "/usr/local"
VERSION = "3.0b-${REVISION}"
#VERSION = 3.0.0
BUILD_NUMBER=""
# Override SUFFIX and LABEL when multiple versions are installed to avoid conflicts.
SUFFIX=""# E.g.: SUFFIX="dev" --> "mscore" becomes "mscoredev"
@ -54,6 +55,7 @@ release:
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DMSCORE_INSTALL_SUFFIX="${SUFFIX}" \
-DMUSESCORE_LABEL="${LABEL}" \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
-DBUILD_LAME="${BUILD_LAME}" \
-DBUILD_PULSEAUDIO="${BUILD_PULSEAUDIO}" \
-DBUILD_JACK="${BUILD_JACK}" \
@ -80,6 +82,7 @@ debug:
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DMSCORE_INSTALL_SUFFIX="${SUFFIX}" \
-DMUSESCORE_LABEL="${LABEL}" \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
-DBUILD_LAME="${BUILD_LAME}" \
-DBUILD_PULSEAUDIO="${BUILD_PULSEAUDIO}" \
-DBUILD_JACK="${BUILD_JACK}" \

View file

@ -22,6 +22,7 @@
REVISION = $(shell type mscore\revision.h)
VERSION = 3.0b-${REVISION}
#VERSION = 3.0.0
BUILD_NUMBER=""
CPUS = %NUMBER_OF_PROCESSORS%
BUILD_FOR_WINSTORE="OFF" # Override with "ON" to enable.

View file

@ -21,6 +21,7 @@
REVISION = `cat mscore/revision.h`
VERSION = "3.0b-${REVISION}"
#VERSION = 3.0.0
BUILD_NUMBER = ""
PREFIX=../applebuild
XCODEPROJ = mscore.xcodeproj
@ -35,6 +36,7 @@ release:
mkdir build.release; \
cd build.release; \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
.. -G Xcode; \
xcodebuild -project ${XCODEPROJ} -target lrelease; \
$(FORMATTER_START) xcodebuild -project ${XCODEPROJ} -configuration Release -target ALL_BUILD $(FORMATTER_END); \
@ -43,6 +45,7 @@ debug:
mkdir build.debug; \
cd build.debug; \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
.. -G Xcode; \
xcodebuild -project ${XCODEPROJ} -target lrelease; \
$(FORMATTER_START) xcodebuild -project ${XCODEPROJ} -configuration Debug -target ALL_BUILD $(FORMATTER_END); \
@ -51,6 +54,7 @@ xcode:
mkdir build.xcode; \
cd build.xcode; \
cmake -DCMAKE_INSTALL_PREFIX=../build.xcode/mscore/Debug -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
.. -G Xcode; \
xcodebuild -project ${XCODEPROJ} -target lrelease;
@ -81,6 +85,7 @@ ci: revision
mkdir build.release; \
cd build.release; \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_BUILD_NUMBER="${BUILD_NUMBER}" \
.. -G Xcode; \
xcodebuild -project ${XCODEPROJ} -target lrelease; \
$(FORMATTER_START) xcodebuild -project ${XCODEPROJ} -configuration Release -target install $(FORMATTER_END);

View file

@ -19,7 +19,7 @@ for /f "delims=" %%f in ('dir /a-d /b /s "%dSource%\*.dll" "%dSource%\*.exe"') d
)
:: Create msi package
mingw32-make -f Makefile.mingw package
mingw32-make -f Makefile.mingw package BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%
:: find the MSI file without the hardcoded version
for /r %%i in (build.release\*.msi) do ( SET FILEPATH=%%i )
@ -56,6 +56,29 @@ SET BUILD_DATE=%Date:~10,4%-%Date:~4,2%-%Date:~7,2%-%hh%%time:~3,2%
SET ARTIFACT_NAME=MuseScoreNightly-%BUILD_DATE%-%APPVEYOR_REPO_BRANCH%-%MSversion%.7z
7z a C:\MuseScore\%ARTIFACT_NAME% C:\MuseScore\MuseScoreNightly
:: create update file for S3
SET SHORT_DATE=%Date:~10,4%-%Date:~4,2%-%Date:~7,2%
SET input=C:\MuseScore\CMakeLists.txt
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_MAJOR" %input%') DO set VERSION_MAJOR=%%A
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_MINOR" %input%') DO set VERSION_MINOR=%%A
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_PATCH" %input%') DO set VERSION_PATCH=%%A
SET MUSESCORE_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%.%APPVEYOR_BUILD_NUMBER%
@echo off
(
echo ^<update^>
echo ^<version^>%MUSESCORE_VERSION%^</version^>
echo ^<revision^>%MSversion%^</revision^>
echo ^<releaseType^>nightly^</releaseType^>
echo ^<date^>%SHORT_DATE%^</date^>
echo ^<description^>MuseScore %MUSESCORE_VERSION% %MSversion%^</description^>
echo ^<downloadUrl^>https://ftp.osuosl.org/pub/musescore-nightlies/windows/%ARTIFACT_NAME%^</downloadUrl^>
echo ^<infoUrl^>https://ftp.osuosl.org/pub/musescore-nightlies/windows/^</infoUrl^>
echo ^</update^>
)>"update_win_nightly.xml"
:UPLOAD
SET SSH_IDENTITY=C:\MuseScore\build\appveyor\resources\osuosl_nighlies_rsa_nopp

View file

@ -1,2 +1,2 @@
mingw32-make -f Makefile.mingw release
mingw32-make -f Makefile.mingw install
mingw32-make -f Makefile.mingw release BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%
mingw32-make -f Makefile.mingw install BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%

View file

@ -38,6 +38,7 @@
#define INSTALL_NAME "${Mscore_INSTALL_NAME}"
#define INSTPREFIX "${CMAKE_INSTALL_PREFIX}"
#define VERSION "${MUSESCORE_VERSION_FULL}"
#define BUILD_NUMBER "${CMAKE_BUILD_NUMBER}"
#cmakedefine AEOLUS
#cmakedefine ZERBERUS

View file

@ -39,6 +39,7 @@ then # Build is marked UNSTABLE inside CMakeLists.txt
then # This is a nightly build
makefile_overrides="PREFIX='MuseScoreNightly-$date-$branch-$revision' \
SUFFIX='-portable-nightly' \
BUILD_NUMBER='${TRAVIS_BUILD_NUMBER}' \
LABEL='Portable Nightly Build'"
cp -f build/travis/resources/splash-nightly.png mscore/data/splash.png
else

View file

@ -23,7 +23,7 @@ else
python build/add-mc-keys.py $MC_CONSUMER_KEY $MC_CONSUMER_SECRET
fi
make -f Makefile.osx ci
make -f Makefile.osx ci BUILD_NUMBER=${TRAVIS_BUILD_NUMBER}
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
then # Build is marked UNSTABLE inside CMakeLists.txt
build/package_mac $BRANCH-$REVISION
@ -53,4 +53,29 @@ scp -C -i $SSH_INDENTITY build/travis/job_macos/web/nightly.xml musescore-nightl
# trigger distribution
ssh -i $SSH_INDENTITY musescore-nightlies@ftp-osl.osuosl.org "~/trigger-musescore-nightlies"
# send nightly update to S3
VERSION_MAJOR=$(grep 'SET(MUSESCORE_VERSION_MAJOR' CMakeLists.txt | cut -d \" -f2)
VERSION_MINOR=$(grep 'SET(MUSESCORE_VERSION_MINOR' CMakeLists.txt | cut -d \" -f2)
VERSION_PATCH=$(grep 'SET(MUSESCORE_VERSION_PATCH' CMakeLists.txt | cut -d \" -f2)
BUILD_NUMBER=${TRAVIS_BUILD_NUMBER}
MUSESCORE_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${BUILD_NUMBER}
SHORT_DATE="$(date -u +%Y-%m-%d)"
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
then
echo "<update>
<version>${MUSESCORE_VERSION}</version>
<revision>${REVISION}</revision>
<releaseType>nightly</releaseType>
<date>${SHORT_DATE}</date>
<description>MuseScore ${MUSESCORE_VERSION} ${REVISION}</description>
<downloadUrl>https://ftp.osuosl.org/pub/musescore-nightlies/macosx/$DMGFILE</downloadUrl>
<infoUrl>https://ftp.osuosl.org/pub/musescore-nightlies/macosx/</infoUrl>
</update>" >> update_mac_nightly.xml
ARTIFACTS_AWS_REGION=us-east-1
ARTIFACTS_S3_BUCKET=update.musescore.org
ARTIFACTS_CACHE_CONTROL='public, max-age=315360000'
ARTIFACTS_PATHS=update_mac_nightly.xml
artifacts upload
fi

View file

@ -146,21 +146,18 @@ void UpdateChecker::check(QString currentVersion, bool m)
#if defined(Q_OS_MAC)
os = "mac";
#endif
if (qApp->applicationName() == "MuseScore3") { //avoid nightly cymbals
if (MuseScore::unstable())
release = "pre";
else
release = "stable";
if (MuseScore::unstable()) {
release = "nightly";
_currentVersion = QString("%1.%2").arg(currentVersion).arg(BUILD_NUMBER);
}
else {
release = "nightly";
release = "stable";
_currentVersion = currentVersion;
}
if (MScore::debugMode)
qDebug("release type: %s", release.toLatin1().constData());
if (!os.isEmpty() && !release.isEmpty() && release != "nightly") {
_currentVersion = currentVersion;
if (!os.isEmpty() && !release.isEmpty())
manager->get(QNetworkRequest(QUrl("http://update.musescore.org/update_" + os +"_" + release +".xml")));
}
}
UpdateCheckerBase::UpdateCheckerBase(QObject* parent)

View file

@ -57,7 +57,14 @@ void TestUtils::tst_compareVersion()
QVERIFY(compareVersion("2.0", "2.1") == true);
QVERIFY(compareVersion("2.1.1.2", "2.0") == false);
QVERIFY(compareVersion("2.0", "2.1.1.3") == true);
QVERIFY(compareVersion("2.1", "2.1.1.3") == true);
QVERIFY(compareVersion("2.2.0.3", "2.1.1.3") == false);
QVERIFY(compareVersion("2.1.0.3", "2.1.1.3") == true);
QVERIFY(compareVersion("2.1.0.0", "2.1.1.3") == true);
QVERIFY(compareVersion("2.1.1.2", "2.1.1.3") == true);
QVERIFY(compareVersion("2.1.1.9", "2.1.1.10") == true);
QVERIFY(compareVersion("2.1.1.9", "2.1.1.100") == true);
QVERIFY(compareVersion("2.1.1.99", "2.1.1.100") == true);
QVERIFY(compareVersion("test", "2.1") == true);
QVERIFY(compareVersion("test1", "test") == false);
}