Complete switch to git

This commit is contained in:
Asher Baker 2015-10-22 12:09:46 +01:00
parent 7192253626
commit 28b4932b86
8 changed files with 117 additions and 89 deletions

6
.gitignore vendored
View File

@ -1,2 +1,8 @@
# Build output
/build /build
/extension/version_auto.h /extension/version_auto.h
# Breakpad stuff, it apparently has to be called src
/src
/.gclient
/.gclient_entries

25
.travis.yml Normal file
View File

@ -0,0 +1,25 @@
sudo: false
language: cpp
addons:
apt:
packages:
- g++-multilib
compiler:
- clang
before_script:
- cd ..
- git clone --depth=1 --branch=master https://chromium.googlesource.com/chromium/tools/depot_tools.git
- git clone --depth=1 --branch=1.7-dev https://github.com/alliedmodders/sourcemod sourcemod-1.5
- git clone --depth=1 --branch=master https://github.com/alliedmodders/ambuild
- cd ambuild
- python setup.py install --user
- cd $TRAVIS_BUILD_DIR
- git fetch --unshallow
- ../depot_tools/fetch breakpad
script:
- mkdir build
- cd build
- python ../configure.py --enable-optimize
- python ./build.py
after_success:
- python ../upload.py

View File

@ -1,9 +1,13 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python: # vim: set ts=2 sw=2 tw=99 noet ft=python:
import os import os
import urllib.request
from ambuild.command import Command from ambuild.command import Command
from ambuild.command import ShellCommand from ambuild.command import ShellCommand
try:
import urllib.request as urllib
except ImportError:
import urllib2 as urllib
class IterateDebugInfoCommand(Command): class IterateDebugInfoCommand(Command):
def run(self, master, job): def run(self, master, job):
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt') pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')

View File

@ -7,12 +7,13 @@ import ambuild.command as command
#Quickly try to ascertain the current repository revision #Quickly try to ascertain the current repository revision
def GetVersion(): def GetVersion():
args = ['hg', 'parent', '-R', AMBuild.sourceFolder] rev = command.RunDirectCommand(AMBuild, ['git', 'rev-list', '--count', 'HEAD']).stdoutText.strip()
p = command.RunDirectCommand(AMBuild, args) cset = command.RunDirectCommand(AMBuild, ['git', 'log', '--pretty=format:%h', '-n', '1']).stdoutText.strip()
m = re.match('changeset:\s+(\d+):(.+)', p.stdoutText)
if m == None: if not rev or not cset:
raise Exception('Could not determine repository version') raise Exception('Could not determine repository version')
return m.groups()
return (rev, cset)
def PerformReversioning(): def PerformReversioning():
rev, cset = GetVersion() rev, cset = GetVersion()

View File

@ -1 +0,0 @@
Lemons.

View File

@ -13,24 +13,24 @@ def BuildEverything():
BuildExtension(); BuildExtension();
def BuildBreakpad(): def BuildBreakpad():
breakpad = AMBuild.AddJob('google-breakpad') breakpad = AMBuild.AddJob('breakpad')
if AMBuild.target['platform'] in ['linux']: if AMBuild.target['platform'] in ['linux']:
if osutil.FileExists(os.path.join(AMBuild.outputFolder, 'google-breakpad', 'src', 'client', 'linux', 'libbreakpad_client.a')): if osutil.FileExists(os.path.join(AMBuild.outputFolder, 'src', 'src', 'client', 'linux', 'libbreakpad_client.a')):
return return
breakpad.AddCommand(ShellCommand('CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ' + os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'configure'))) breakpad.AddCommand(ShellCommand('CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ' + os.path.join(AMBuild.sourceFolder, 'src', 'configure')))
breakpad.AddCommand(ShellCommand('make src/client/linux/libbreakpad_client.a')) breakpad.AddCommand(ShellCommand('make src/client/linux/libbreakpad_client.a'))
elif AMBuild.target['platform'] in ['windows']: elif AMBuild.target['platform'] in ['windows']:
if osutil.FileExists(os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'exception_handler.lib')): if osutil.FileExists(os.path.join(AMBuild.sourceFolder, 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'exception_handler.lib')):
return return
gyp = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'tools', 'gyp', 'gyp.bat') gyp = os.path.join(AMBuild.sourceFolder, 'src', 'src', 'tools', 'gyp', 'gyp.bat')
gyppath = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'client', 'windows', 'handler', 'exception_handler.gyp') gyppath = os.path.join(AMBuild.sourceFolder, 'src', 'src', 'client', 'windows', 'handler', 'exception_handler.gyp')
breakpad.AddCommand(DirectCommand([gyp, gyppath])) breakpad.AddCommand(DirectCommand([gyp, gyppath]))
slnpath = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'client', 'windows', 'handler', 'exception_handler.sln') slnpath = os.path.join(AMBuild.sourceFolder, 'src', 'src', 'client', 'windows', 'handler', 'exception_handler.sln')
breakpad.AddCommand(DirectCommand(['msbuild', slnpath, '/p:Configuration=Release'])) breakpad.AddCommand(DirectCommand(['msbuild', slnpath, '/p:Configuration=Release']))
def BuildExtension(): def BuildExtension():
@ -43,7 +43,7 @@ def BuildExtension():
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD15'], 'public', 'extensions')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD15'], 'public', 'extensions'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD15'], 'public', 'sourcepawn')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD15'], 'public', 'sourcepawn'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src')) compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'src', 'src'))
if AMBuild.target['platform'] in ['linux']: if AMBuild.target['platform'] in ['linux']:
compiler['POSTLINKFLAGS'].append('-lstdc++') compiler['POSTLINKFLAGS'].append('-lstdc++')
@ -61,7 +61,7 @@ def BuildExtension():
if AMBuild.target['platform'] in ['linux']: if AMBuild.target['platform'] in ['linux']:
link = os.path.join(AMBuild.outputFolder, extension.workFolder, 'libbreakpad_client.a') link = os.path.join(AMBuild.outputFolder, extension.workFolder, 'libbreakpad_client.a')
target = os.path.join(AMBuild.outputFolder, 'google-breakpad', 'src', 'client', 'linux', 'libbreakpad_client.a') target = os.path.join(AMBuild.outputFolder, 'breakpad', 'src', 'client', 'linux', 'libbreakpad_client.a')
try: try:
os.lstat(link) os.lstat(link)
except: except:
@ -71,7 +71,7 @@ def BuildExtension():
elif AMBuild.target['platform'] in ['windows']: elif AMBuild.target['platform'] in ['windows']:
libs = ['exception_handler', 'common', 'crash_generation_client'] libs = ['exception_handler', 'common', 'crash_generation_client']
for lib in libs: for lib in libs:
path = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'client', 'windows', 'handler', 'Release', 'lib', lib + '.lib') path = os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'client', 'windows', 'handler', 'Release', 'lib', lib + '.lib')
if os.path.isfile(path): if os.path.isfile(path):
binary.RelinkIfNewer(path) binary.RelinkIfNewer(path)
binary['POSTLINKFLAGS'].extend([path]) binary['POSTLINKFLAGS'].extend([path])

View File

@ -1 +1 @@
2.0.1 2.1.0

135
upload.py
View File

@ -1,71 +1,64 @@
import re, os, sys import re, os, sys
import subprocess import subprocess
import zipfile import zipfile
import ftplib import ftplib
platform = 'unknown' platform = 'unknown'
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
platform = 'linux' platform = 'linux'
elif sys.platform.startswith('win32'): elif sys.platform.startswith('win32'):
platform = 'windows' platform = 'windows'
elif sys.platform.startswith('darwin'): elif sys.platform.startswith('darwin'):
platform = 'mac' platform = 'mac'
def HGVersion(): def GITHash():
p = subprocess.Popen(['hg', 'identify', '-n'], stdout = subprocess.PIPE, stderr = subprocess.PIPE) p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
stdout = stdout.decode('UTF-8') stdout = stdout.decode('UTF-8')
return stdout.rstrip('\r\n')
return stdout.rstrip('+\r\n')
def GITVersion():
def ReleaseVersion(): p = subprocess.Popen(['git', 'rev-list', '--count', '--first-parent', 'HEAD'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
productFile = open('product.version', 'r') (stdout, stderr) = p.communicate()
productContents = productFile.read() stdout = stdout.decode('UTF-8')
productFile.close() return stdout.rstrip('\r\n')
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents) filename = '-'.join(['accelerator', 'git' + GITVersion(), GITHash(), platform])
if m == None:
raise Exception('Could not detremine product version') debug_build = os.environ.get('is_debug_build', False) == "1"
major, minor, release, tag = m.groups() if debug_build:
return '.'.join([major, minor, release]) filename += '-debug'
filename = '-'.join([os.environ.get('project', 'accelerator'), ReleaseVersion(), 'hg' + HGVersion(), platform]) filename += '.zip'
debug_build = os.environ.get('is_debug_build', False) == "1" zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED)
if debug_build: for base, dirs, files in os.walk('package'):
filename += '-debug' for file in files:
fn = os.path.join(base, file)
filename += '.zip' fns = fn[(len('package') + 1):]
zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED) zip.write(fn, fns)
for base, dirs, files in os.walk('package'): print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size"))
for file in files: for zinfo in zip.infolist():
fn = os.path.join(base, file) date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
fns = fn[(len('package') + 1):] print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size))
zip.write(fn, fns) zip.close()
print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size")) if 'ftp_hostname' in os.environ:
for zinfo in zip.infolist(): print('')
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size)) ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
print('Connected to server, uploading build...')
zip.close() ftp.cwd(os.environ['ftp_directory'])
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
if 'ftp_hostname' in os.environ: ftp.quit()
print('')
print('Uploaded as \'' + filename + '\'')
ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
print('Connected to server, uploading build...') os.unlink(filename)
ftp.cwd(os.environ['ftp_directory'])
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
ftp.quit()
print('Uploaded as \'' + filename + '\'')
os.unlink(filename)