mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-15 03:45:41 +08:00
D99 Enable compiler caches
This commit is contained in:
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
@@ -1,5 +1,19 @@
|
||||
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
|
||||
|
||||
regexDevBranch = /develop\/\d+\.\d+\.\d+/
|
||||
regexReleaseBranch = /release\/\d+\.\d+/
|
||||
regexNocacheBranch = /nocache\/.+/
|
||||
regexRecacheBranches = [regexDevBranch, regexReleaseBranch]
|
||||
|
||||
if (env.BRANCH_NAME && regexRecacheBranches.any{ env.BRANCH_NAME ==~ it }) {
|
||||
env.CCACHE_RECACHE = 1
|
||||
env.CLCACHE_RECACHE = 1
|
||||
}
|
||||
if (env.BRANCH_NAME && env.BRANCH_NAME ==~ regexNocacheBranch) {
|
||||
env.CCACHE_DISABLE = 1
|
||||
env.CLCACHE_DISABLE = 1
|
||||
}
|
||||
|
||||
abortPreviousRunningBuilds()
|
||||
|
||||
def builders = [:]
|
||||
@@ -147,7 +161,9 @@ builders['Build swift Win32'] = {
|
||||
throw error
|
||||
} finally {
|
||||
notifyDiscord('Win32', buildResults['swift-win32'])
|
||||
killDBusDaemon()
|
||||
killWindowsProcess('dbus-daemon.exe')
|
||||
killWindowsProcess('clcache.exe')
|
||||
killWindowsProcess('python.exe')
|
||||
cleanWs deleteDirs: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
@@ -192,7 +208,9 @@ builders['Build swift Win64'] = {
|
||||
throw error
|
||||
} finally {
|
||||
notifyDiscord('Win64', buildResults['swift-win64'])
|
||||
killDBusDaemon()
|
||||
killWindowsProcess('dbus-daemon.exe')
|
||||
killWindowsProcess('clcache.exe')
|
||||
killWindowsProcess('python.exe')
|
||||
cleanWs deleteDirs: true, notFailBuild: true
|
||||
}
|
||||
}
|
||||
@@ -250,7 +268,6 @@ node('master') {
|
||||
|
||||
node('master') {
|
||||
try {
|
||||
def regexDevBranch = /develop\/\d+\.\d+\.\d+/
|
||||
if (env.BRANCH_NAME && env.BRANCH_NAME ==~ regexDevBranch) {
|
||||
stage('Publish') {
|
||||
unstash name: 'swift-linux-64'
|
||||
@@ -384,8 +401,6 @@ def notifyDiscord(nodeName, buildStatus = 'UNSTABLE') {
|
||||
}
|
||||
|
||||
def getEolInMonth() {
|
||||
def regexDevBranch = /develop\/\d+\.\d+\.\d+/
|
||||
def regexReleaseBranch = /release\/\d+\.\d+/
|
||||
if (env.BRANCH_NAME && env.BRANCH_NAME ==~ regexDevBranch) {
|
||||
// 6 month for dev builds
|
||||
return 6
|
||||
@@ -410,10 +425,10 @@ def shouldUploadSymbols() {
|
||||
}
|
||||
}
|
||||
|
||||
def killDBusDaemon() {
|
||||
bat '''
|
||||
tasklist /FI "IMAGENAME eq dbus-daemon.exe" 2>NUL | find /I /N "dbus-daemon.exe">NUL
|
||||
if "%ERRORLEVEL%"=="0" taskkill /f /im dbus-daemon.exe
|
||||
def killWindowsProcess(name) {
|
||||
bat """
|
||||
tasklist /FI "IMAGENAME eq ${name}" 2>NUL | find /I /N "${name}">NUL
|
||||
if "%ERRORLEVEL%"=="0" taskkill /f /im ${name}
|
||||
EXIT 0
|
||||
'''
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -53,6 +53,17 @@ include(wordsize.pri)
|
||||
|
||||
contains(TEMPLATE, "vc.*"): QMAKE_CXXFLAGS *= /MP
|
||||
|
||||
################################
|
||||
# Cache intermediate files to improve build times
|
||||
################################
|
||||
|
||||
swiftConfig(ccache) {
|
||||
swiftConfig(profileRelease):error(profileRelease is incompatible with clcache)
|
||||
msvc: QMAKE_CXX = clcache
|
||||
else:macx: QMAKE_CXX = /usr/local/bin/ccache $$QMAKE_CXX
|
||||
else:gcc: QMAKE_CXX = ccache $$QMAKE_CXX
|
||||
}
|
||||
|
||||
################################
|
||||
# Release build with debug info
|
||||
################################
|
||||
|
||||
@@ -37,6 +37,7 @@ class Builder:
|
||||
"""
|
||||
print('Preparing environment ...')
|
||||
os.environ['PATH'] += os.pathsep + self._get_qt_binary_path()
|
||||
self._ccache_prepare()
|
||||
self._specific_prepare()
|
||||
|
||||
print('Updating from datastore ...')
|
||||
@@ -46,6 +47,15 @@ class Builder:
|
||||
shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share'))
|
||||
datastore.update_shared(host, datastore_version, shared_path)
|
||||
|
||||
def _ccache_prepare(self):
|
||||
os.environ['CCACHE_NODIRECT'] = '1'
|
||||
os.environ['CLCACHE_NODIRECT'] = '1'
|
||||
os.environ['CLCACHE_COMPRESS'] = '1'
|
||||
os.environ['CLCACHE_OBJECT_CACHE_TIMEOUT_MS'] = str(10 * 60 * 1000)
|
||||
os.environ['CLCACHE_DIR'] = 'C:\\clcache' # workaround https://github.com/frerich/clcache/issues/342
|
||||
os.environ['CLCACHE_BASEDIR'] = os.environ['WORKSPACE']
|
||||
os.environ['CCACHE_BASEDIR'] = os.environ['WORKSPACE']
|
||||
|
||||
def build(self, jobs, qmake_args, dev_build, eolInMonth):
|
||||
"""
|
||||
Run the build itself. Pass dev_build=True to enable a dev build
|
||||
@@ -69,6 +79,7 @@ class Builder:
|
||||
print('Setting EOL date to ' + eolDate.strftime('%Y%m%d'))
|
||||
qmake_call += ['SWIFT_CONFIG.endOfLife=' + eolDate.strftime('%Y%m%d')]
|
||||
|
||||
qmake_call += ['SWIFT_CONFIG.ccache=true']
|
||||
qmake_call += ['-r', os.pardir]
|
||||
subprocess.check_call(qmake_call, env=dict(os.environ))
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ INCLUDEPATH += ..
|
||||
DEPENDPATH += . ..
|
||||
|
||||
PRECOMPILED_HEADER = pch/pch.h
|
||||
INCLUDEPATH += pch
|
||||
|
||||
DEFINES += LOG_IN_FILE BUILD_BLACKCORE_LIB
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ else {
|
||||
DEPENDPATH += . ..
|
||||
|
||||
PRECOMPILED_HEADER = pch/pch.h
|
||||
INCLUDEPATH += pch
|
||||
|
||||
DEFINES += LOG_IN_FILE BUILD_BLACKGUI_LIB QWT_DLL
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ INCLUDEPATH += ..
|
||||
# DEPENDPATH += . .. // BlackMisc should be independent
|
||||
|
||||
PRECOMPILED_HEADER = pch/pch.h
|
||||
INCLUDEPATH += pch
|
||||
|
||||
DEFINES += LOG_IN_FILE BUILD_BLACKMISC_LIB
|
||||
RESOURCES += blackmisc.qrc
|
||||
|
||||
Reference in New Issue
Block a user