From 68fe5db62dd06e8d92ba67d3bb55fff7444d705d Mon Sep 17 00:00:00 2001 From: "a.yankovich" Date: Fri, 31 Jan 2020 14:55:49 +0300 Subject: [PATCH] added separate builders --- BuildBotLib/CrossplatformQmake.py | 46 +++++++++++++++++++++++++++++++ BuildBotLib/basemodule.py | 30 ++++++-------------- BuildBotLib/buildBotShedulers.py | 7 +++-- BuildBotLib/buildBotWorkers.py | 14 ++++++---- BuildBotLib/cmake.py | 4 +-- BuildBotLib/make.py | 28 +++++++------------ BuildBotLib/qmake.py | 29 ++++++++----------- master.cfg | 14 +++++----- 8 files changed, 98 insertions(+), 74 deletions(-) create mode 100644 BuildBotLib/CrossplatformQmake.py diff --git a/BuildBotLib/CrossplatformQmake.py b/BuildBotLib/CrossplatformQmake.py new file mode 100644 index 0000000..b6ca2d4 --- /dev/null +++ b/BuildBotLib/CrossplatformQmake.py @@ -0,0 +1,46 @@ +# This Python file uses the following encoding: utf-8 +from BuildBotLib.qmake import QMake +from BuildBotLib.secretManager import SecretManager + + +class CrossplatformQmake (QMake): + + def __init__(self, platform): + QMake.__init__(self, platform) + + def linuxXmakeCmd(self, props): + command = [ + 'qmake-linux', + "-r", + "CONFIG+=qtquickcompiler", + 'ONLINE="~/repo"' + ] + + return command + + def windowsXmakeCmd(self, props): + command = [ + 'qmake-windows', + '-spec', 'win32-g++', + "-r", + "CONFIG+=qtquickcompiler", + 'ONLINE="~/repo"' + ] + + return command + + def androidXmakeCmd(self, props): + secret = SecretManager(self.home + "/buildBotSecret/secret.json") + + command = [ + 'qmake-android', + '-spec', 'android-clang', + "-r", + "CONFIG+=qtquickcompiler", + 'SIGN_PATH="' + secret.getValue('SIGPATH') + '"', + 'SIGN_ALIES="quasarapp"', + 'SIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"' + + ] + + return command diff --git a/BuildBotLib/basemodule.py b/BuildBotLib/basemodule.py index 9f965a8..c946d65 100644 --- a/BuildBotLib/basemodule.py +++ b/BuildBotLib/basemodule.py @@ -8,18 +8,23 @@ from pathlib import Path class BaseModule: - def __init__(self): + P_Windows = 'Windows' + P_Linux = 'Linux' + P_Android = 'Android' + + def __init__(self, platform): self.MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"] self.home = str(Path.home()) + self.platform = platform def isWin(self, step): - return step.getProperty('Windows') + return self.platform == BaseModule.P_Windows def isLinux(self, step): - return step.getProperty('Linux') + return self.platform == BaseModule.P_Linux def isAndroid(self, step): - return step.getProperty('Android') + return self.platform == BaseModule.P_Android def generateCmd(self, bashString): @@ -47,23 +52,6 @@ class BaseModule: def getPropertyes(self): return [ - util.BooleanParameter( - name='Windows', - label='Windows version project', - default=True - ), - - util.BooleanParameter( - name='Linux', - label='Linux version project', - default=True - ), - - util.BooleanParameter( - name='Android', - label='Android version project', - default=True - ), ] def copyRegExp(self, source, dist): diff --git a/BuildBotLib/buildBotShedulers.py b/BuildBotLib/buildBotShedulers.py index d25466d..eb64f7d 100644 --- a/BuildBotLib/buildBotShedulers.py +++ b/BuildBotLib/buildBotShedulers.py @@ -26,9 +26,12 @@ class BuildBotShedulers(BuildBotModule): self.masterConf['schedulers'] = self.shedulers + [ schedulers.AnyBranchScheduler( - name='github-tester', + name='github', change_filter=util.ChangeFilter(project_re="qmake-*"), - builderNames=['github-tester'], + builderNames=['LinuxBuilder', + 'AndroidBuilder', + 'WindowBuilder', + ], properties={ 'clean': True, 'test': True, diff --git a/BuildBotLib/buildBotWorkers.py b/BuildBotLib/buildBotWorkers.py index 5a6c0c7..f1878a5 100644 --- a/BuildBotLib/buildBotWorkers.py +++ b/BuildBotLib/buildBotWorkers.py @@ -2,6 +2,7 @@ from BuildBotLib.buildBotModule import BuildBotModule from buildbot.plugins import worker +from BuildBotLib.secretManager import SecretManager class BuildBotWorkers(BuildBotModule): @@ -14,13 +15,14 @@ class BuildBotWorkers(BuildBotModule): # a Worker object, specifying a unique worker # name and password. The same # worker name and password must be configured on the worker. - self.masterConf['workers'] = [ - worker.Worker("github-worker", "pass"), - worker.Worker("github-tester", "pass"), - worker.Worker("qtBuilder", "pass"), - worker.Worker("NPM", "pass"), - worker.Worker("assets-builder", "pass") + secret = SecretManager(self.home + "/buildBotSecret/secret.json") + password = secret.getValue('WorkerPass') + + self.masterConf['workers'] = [ + worker.Worker("AndroidBuilder", password), + worker.Worker("LinuxBuilder", password), + worker.Worker("WindowBuilder", password), ] # 'protocols' contains information diff --git a/BuildBotLib/cmake.py b/BuildBotLib/cmake.py index 02190c4..eae66c0 100644 --- a/BuildBotLib/cmake.py +++ b/BuildBotLib/cmake.py @@ -11,8 +11,8 @@ from BuildBotLib.secretManager import * class CMake(Make): - def __init__(self): - Make.__init__(self); + def __init__(self, platform): + Make.__init__(self, platform); def linuxXmakeCmd(self, props): secret = SecretManager(self.home + "/buildBotSecret/secret.json") diff --git a/BuildBotLib/make.py b/BuildBotLib/make.py index 9a4ff44..73d6b2f 100644 --- a/BuildBotLib/make.py +++ b/BuildBotLib/make.py @@ -8,8 +8,8 @@ from BuildBotLib.secretManager import SecretManager class Make(BaseModule): - def __init__(self): - BaseModule.__init__(self) + def __init__(self, platform): + BaseModule.__init__(self, platform) def isClean(self, step): return step.getProperty('clean') @@ -90,25 +90,19 @@ class Make(BaseModule): def generateStep(self, cmd, platform, desc, checkFunc): - platformCgek = { - 'linux': self.isLinux, - 'windows': self.isWin, - 'android': self.isAndroid, - } - @util.renderer def envWraper(step): platformEnv = { - 'linux': self.linuxXmakeEnv, - 'windows': self.windowsXmakeEnv, - 'android': self.androidXmakeEnv, + BaseModule.P_Linux: self.linuxXmakeEnv, + BaseModule.P_Windows: self.windowsXmakeEnv, + BaseModule.P_Android: self.androidXmakeEnv, } return platformEnv[platform](step) def dustepIf(step): - return checkFunc(step) and platformCgek[platform](step) + return checkFunc(step) res = steps.Compile( command=self.getWraper(cmd), @@ -126,9 +120,9 @@ class Make(BaseModule): def generatePlatformSteps(self, platform): platformXcmd = { - 'linux': self.linuxXmakeCmd, - 'windows': self.windowsXmakeCmd, - 'android': self.androidXmakeCmd, + BaseModule.P_Linux: self.linuxXmakeCmd, + BaseModule.P_Windows: self.windowsXmakeCmd, + BaseModule.P_Android: self.androidXmakeCmd, } res = [] @@ -185,9 +179,7 @@ class Make(BaseModule): ) ) - factory.addSteps(self.generatePlatformSteps('linux')) - factory.addSteps(self.generatePlatformSteps('windows')) - factory.addSteps(self.generatePlatformSteps('android')) + factory.addSteps(self.generatePlatformSteps(self.platform)) factory.addStep( steps.DirectoryUpload( diff --git a/BuildBotLib/qmake.py b/BuildBotLib/qmake.py index 3114489..8762b78 100644 --- a/BuildBotLib/qmake.py +++ b/BuildBotLib/qmake.py @@ -6,12 +6,15 @@ from BuildBotLib.secretManager import SecretManager class QMake(Make): - def __init__(self): + def __init__(self, platform): Make.__init__(self) - def linuxXmakeCmd(self, props): + def makePrefix(self): + return "Q" + + def mainCmd(self): command = [ - 'qmake-linux', + 'qmake', "-r", "CONFIG+=qtquickcompiler", 'ONLINE="~/repo"' @@ -19,22 +22,17 @@ class QMake(Make): return command + def linuxXmakeCmd(self, props): + return self.mainCmd() + def windowsXmakeCmd(self, props): - command = [ - 'qmake-windows', - '-spec', 'win32-g++', - "-r", - "CONFIG+=qtquickcompiler", - 'ONLINE="~/repo"' - ] - - return command + return self.mainCmd() def androidXmakeCmd(self, props): secret = SecretManager(self.home + "/buildBotSecret/secret.json") command = [ - 'qmake-android', + 'qmake', '-spec', 'android-clang', "-r", "CONFIG+=qtquickcompiler", @@ -45,8 +43,3 @@ class QMake(Make): ] return command - - def androidXmakeEnv(self, props): - return {'ANDROID_NDK_ROOT': self.home + '/Android/ndk-bundle', - 'JAVA_HOME': '/usr', - 'ANDROID_HOME': self.home + '/Android'} diff --git a/master.cfg b/master.cfg index 92a958e..637867d 100644 --- a/master.cfg +++ b/master.cfg @@ -8,6 +8,7 @@ from BuildBotLib.cmake import CMake from BuildBotLib.qmake import QMake from BuildBotLib.asssetsinstaller import AsssetsInstaller from BuildBotLib.qtUpdater import QtUpdater +from BuildBotLib.basemodule import BaseModule # This is a sample buildmaster config file. It must be installed as # 'master.cfg' in your buildmaster's base directory. @@ -18,14 +19,13 @@ from BuildBotLib.qtUpdater import QtUpdater bot = BuildBot() -qmake = QMake() -asssetsinstaller = AsssetsInstaller() -qtUpdater = QtUpdater() +qmakeLinux = QMake(BaseModule.P_Linux) +qmakeWindows = QMake(BaseModule.P_Windows) +qmakeAndroid = QMake(BaseModule.P_Android) -bot.addBuilder("github-worker", qmake) -bot.addBuilder("github-tester", qmake) -bot.addBuilder("qtBuilder", qtUpdater) -bot.addBuilder("assets-builder", asssetsinstaller) +bot.addBuilder("LinuxBuilder", qmakeLinux) +bot.addBuilder("WindowBuilder", qmakeWindows) +bot.addBuilder("AndroidBuilder", qmakeAndroid) c = BuildmasterConfig = bot.getMaster()