mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Replace qmake variable BLACK_CONFIG with a system based on json files.
The config is loaded from json files by qmake, and we define the qmake function `swiftConfig` for checking whether a feature is enabled. This function can be directly used in `buildconfig_gen.cpp.in`, so the trick with C++ comment tokens in variables is not needed.
This commit is contained in:
@@ -45,7 +45,7 @@ class Builder:
|
||||
shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share'))
|
||||
datastore.update_shared(host, datastore_version, shared_path)
|
||||
|
||||
def build(self, jobs, dev_build, eolInMonth):
|
||||
def build(self, jobs, qmake_args, dev_build, eolInMonth):
|
||||
"""
|
||||
Run the build itself. Pass dev_build=True to enable a dev build
|
||||
"""
|
||||
@@ -55,9 +55,9 @@ class Builder:
|
||||
os.makedirs(build_path)
|
||||
os.chdir(build_path)
|
||||
|
||||
qmake_call = ['qmake']
|
||||
qmake_call = ['qmake'] + qmake_args
|
||||
if dev_build:
|
||||
qmake_call += ['"BLACK_CONFIG+=SwiftDevBranch"']
|
||||
qmake_call += ['"SWIFT_CONFIG.devBranch=true"']
|
||||
|
||||
if eolInMonth > 0:
|
||||
eolYear = date.today().year
|
||||
@@ -66,7 +66,7 @@ class Builder:
|
||||
eolMonth = eolMonth % 12 + 1
|
||||
eolDate = date(int(eolYear), int(eolMonth), 1)
|
||||
print('Setting EOL date to ' + eolDate.strftime('%Y%m%d'))
|
||||
qmake_call += ['BLACK_EOL=' + eolDate.strftime('%Y%m%d')]
|
||||
qmake_call += ['SWIFT_CONFIG.endOfLife=' + eolDate.strftime('%Y%m%d')]
|
||||
|
||||
qmake_call += ['-r', os.pardir]
|
||||
subprocess.check_call(qmake_call, env=dict(os.environ))
|
||||
@@ -384,7 +384,7 @@ def print_help():
|
||||
'Windows': ['msvc', 'mingw']
|
||||
}
|
||||
compiler_help = '|'.join(supported_compilers[platform.system()])
|
||||
print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>]')
|
||||
print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>] [-q <extra qmake argument>]')
|
||||
|
||||
|
||||
# Entry point if called as a standalone program
|
||||
@@ -396,9 +396,10 @@ def main(argv):
|
||||
jobs = None
|
||||
upload_symbols = False
|
||||
eolInMonth = 0
|
||||
qmake_args = []
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv, 'hc:w:t:j:due:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol'])
|
||||
opts, args = getopt.getopt(argv, 'hc:w:t:j:due:q:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol', 'qmake-arg='])
|
||||
except getopt.GetoptError:
|
||||
print_help()
|
||||
sys.exit(2)
|
||||
@@ -428,6 +429,8 @@ def main(argv):
|
||||
upload_symbols = True
|
||||
elif opt in ('-e', '--eol'):
|
||||
eolInMonth = int(arg)
|
||||
elif opt in ('-q', '--qmake-arg'):
|
||||
qmake_args += [arg]
|
||||
|
||||
if word_size not in ['32', '64']:
|
||||
print('Unsupported word size. Choose 32 or 64')
|
||||
@@ -450,7 +453,7 @@ def main(argv):
|
||||
builder = builders[platform.system()][tool_chain](config_file, word_size)
|
||||
|
||||
builder.prepare()
|
||||
builder.build(jobs, dev_build, eolInMonth)
|
||||
builder.build(jobs, qmake_args, dev_build, eolInMonth)
|
||||
builder.checks()
|
||||
builder.install()
|
||||
builder.publish()
|
||||
|
||||
Reference in New Issue
Block a user