4
0
mirror of https://github.com/QuasarApp/QuasarAppCI.git synced 2025-04-28 14:44:36 +00:00

75 lines
1.6 KiB
Python
Raw Normal View History

2019-07-22 10:20:59 +03:00
from buildbot.plugins import util
import multiprocessing
import glob
import shutil
2019-12-26 16:18:17 +03:00
from pathlib import Path
2019-07-22 10:20:59 +03:00
2019-12-26 11:29:22 +03:00
2019-10-06 19:15:02 +03:00
class BaseModule:
2019-12-25 19:35:31 +03:00
MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"]
2019-12-26 16:18:17 +03:00
home = str(Path.home())
2019-12-25 19:35:31 +03:00
2019-10-06 19:15:02 +03:00
def __init__(self):
2019-12-26 11:29:22 +03:00
self
2019-12-26 16:18:17 +03:00
def isWin(self, step):
return step.getProperty('Windows')
def isLinux(self, step):
return step.getProperty('Linux')
def isAndroid(self, step):
return step.getProperty('Android')
2019-12-26 11:29:22 +03:00
def generateCmd(self, bashString):
return self.MULTIPLE_SH_COMMAND + [bashString]
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getFactory(self):
return util.BuildFactory()
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getRepo(self):
2019-12-26 11:29:22 +03:00
return ""
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getPropertyes(self):
2019-12-26 16:18:17 +03:00
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
),
]
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def copyRegExp(self, source, dist):
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
res = []
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
for file in glob.glob(source):
res.append(file)
shutil.copy(file, dist)
2019-07-22 10:20:59 +03:00
2019-12-26 11:29:22 +03:00
return res
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
@util.renderer
def makeCommand(self, props):
command = ['make']
cpus = multiprocessing.cpu_count()
if cpus:
command.extend(['-j', str(cpus)])
else:
command.extend(['-j', '1'])
return command