Externalized version numbers.

This commit is contained in:
Brad Nelson
2024-01-15 11:52:11 -08:00
parent 8aff943a00
commit 29bd06fed8
2 changed files with 24 additions and 8 deletions

5
BUILD
View File

@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
SetVersions(
version='7.0.7.17',
stable='7.0.6.19',
old_stable='7.0.5.4')
Include('posix') Include('posix')
Include('windows') Include('windows')
Include('web') Include('web')

View File

@ -18,10 +18,6 @@ import os
import sys import sys
import subprocess import subprocess
VERSION = '7.0.7.17'
STABLE_VERSION = '7.0.6.19'
OLD_STABLE_VERSION = '7.0.5.4'
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = SCRIPT_DIR ROOT_DIR = SCRIPT_DIR
NINJA_BUILD = os.path.join(ROOT_DIR, 'build.ninja') NINJA_BUILD = os.path.join(ROOT_DIR, 'build.ninja')
@ -130,6 +126,7 @@ WIN_RC64 = 'UNSUPPORTED'
# Mutable global state. # Mutable global state.
build_files = [] build_files = []
output = '' output = ''
versions = {}
def Escape(path): def Escape(path):
return path.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)') return path.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)')
@ -198,17 +195,29 @@ def FastOption():
return '' return ''
def SetVersions(**kwargs):
versions.update(kwargs)
def SelectHeader():
version = versions['version']
stable = versions['stable']
old_stable = versions['old_stable']
return f"""
ninja_required_version = 1.1
VERSION = {version}
STABLE_VERSION = {stable}
OLD_STABLE_VERSION = {old_stable}
"""
def InitOutput(): def InitOutput():
global output global output
output = f""" output = f"""
ninja_required_version = 1.1
src = {SRC_DIR} src = {SRC_DIR}
dst = {DST_DIR} dst = {DST_DIR}
ninjadir = {NINJA_DIR} ninjadir = {NINJA_DIR}
builddir = $dst builddir = $dst
VERSION = {VERSION}
STABLE_VERSION = {STABLE_VERSION}
OLD_STABLE_VERSION = {OLD_STABLE_VERSION}
CFLAGS = {' '.join(CFLAGS)} CFLAGS = {' '.join(CFLAGS)}
STRIP_ARGS = {' '.join(STRIP_ARGS)} STRIP_ARGS = {' '.join(STRIP_ARGS)}
LIBS = {' '.join(LIBS)} LIBS = {' '.join(LIBS)}
@ -551,7 +560,9 @@ def Main():
DetectWindowsTools(args) DetectWindowsTools(args)
InitOutput() InitOutput()
Include('.') Include('.')
header = SelectHeader()
with open('build.ninja', 'w') as fh: with open('build.ninja', 'w') as fh:
fh.write(header)
fh.write(output) fh.write(output)
fh.write(f'build $ninjadir/build.ninja: config $src/configure.py ' + ' '.join(build_files) + '\n') fh.write(f'build $ninjadir/build.ninja: config $src/configure.py ' + ' '.join(build_files) + '\n')
if not args.quiet: if not args.quiet: