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
/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:
import os
import urllib.request
from ambuild.command import Command
from ambuild.command import ShellCommand
try:
import urllib.request as urllib
except ImportError:
import urllib2 as urllib
class IterateDebugInfoCommand(Command):
def run(self, master, job):
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
def GetVersion():
args = ['hg', 'parent', '-R', AMBuild.sourceFolder]
p = command.RunDirectCommand(AMBuild, args)
m = re.match('changeset:\s+(\d+):(.+)', p.stdoutText)
if m == None:
rev = command.RunDirectCommand(AMBuild, ['git', 'rev-list', '--count', 'HEAD']).stdoutText.strip()
cset = command.RunDirectCommand(AMBuild, ['git', 'log', '--pretty=format:%h', '-n', '1']).stdoutText.strip()
if not rev or not cset:
raise Exception('Could not determine repository version')
return m.groups()
return (rev, cset)
def PerformReversioning():
rev, cset = GetVersion()

View File

@ -1 +0,0 @@
Lemons.

View File

@ -13,24 +13,24 @@ def BuildEverything():
BuildExtension();
def BuildBreakpad():
breakpad = AMBuild.AddJob('google-breakpad')
breakpad = AMBuild.AddJob('breakpad')
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
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'))
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
gyp = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'tools', 'gyp', 'gyp.bat')
gyppath = os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src', 'client', 'windows', 'handler', 'exception_handler.gyp')
gyp = os.path.join(AMBuild.sourceFolder, 'src', 'src', 'tools', 'gyp', 'gyp.bat')
gyppath = os.path.join(AMBuild.sourceFolder, 'src', 'src', 'client', 'windows', 'handler', 'exception_handler.gyp')
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']))
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', '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']:
compiler['POSTLINKFLAGS'].append('-lstdc++')
@ -61,7 +61,7 @@ def BuildExtension():
if AMBuild.target['platform'] in ['linux']:
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:
os.lstat(link)
except:
@ -71,7 +71,7 @@ def BuildExtension():
elif AMBuild.target['platform'] in ['windows']:
libs = ['exception_handler', 'common', 'crash_generation_client']
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):
binary.RelinkIfNewer(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 subprocess
import zipfile
import ftplib
platform = 'unknown'
if sys.platform.startswith('linux'):
platform = 'linux'
elif sys.platform.startswith('win32'):
platform = 'windows'
elif sys.platform.startswith('darwin'):
platform = 'mac'
def HGVersion():
p = subprocess.Popen(['hg', 'identify', '-n'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = p.communicate()
stdout = stdout.decode('UTF-8')
return stdout.rstrip('+\r\n')
def ReleaseVersion():
productFile = open('product.version', 'r')
productContents = productFile.read()
productFile.close()
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
if m == None:
raise Exception('Could not detremine product version')
major, minor, release, tag = m.groups()
return '.'.join([major, minor, release])
filename = '-'.join([os.environ.get('project', 'accelerator'), ReleaseVersion(), 'hg' + HGVersion(), platform])
debug_build = os.environ.get('is_debug_build', False) == "1"
if debug_build:
filename += '-debug'
filename += '.zip'
zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED)
for base, dirs, files in os.walk('package'):
for file in files:
fn = os.path.join(base, file)
fns = fn[(len('package') + 1):]
zip.write(fn, fns)
print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size"))
for zinfo in zip.infolist():
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size))
zip.close()
if 'ftp_hostname' in os.environ:
print('')
ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
print('Connected to server, uploading build...')
ftp.cwd(os.environ['ftp_directory'])
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
ftp.quit()
print('Uploaded as \'' + filename + '\'')
os.unlink(filename)
import re, os, sys
import subprocess
import zipfile
import ftplib
platform = 'unknown'
if sys.platform.startswith('linux'):
platform = 'linux'
elif sys.platform.startswith('win32'):
platform = 'windows'
elif sys.platform.startswith('darwin'):
platform = 'mac'
def GITHash():
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = p.communicate()
stdout = stdout.decode('UTF-8')
return stdout.rstrip('\r\n')
def GITVersion():
p = subprocess.Popen(['git', 'rev-list', '--count', '--first-parent', 'HEAD'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = p.communicate()
stdout = stdout.decode('UTF-8')
return stdout.rstrip('\r\n')
filename = '-'.join(['accelerator', 'git' + GITVersion(), GITHash(), platform])
debug_build = os.environ.get('is_debug_build', False) == "1"
if debug_build:
filename += '-debug'
filename += '.zip'
zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED)
for base, dirs, files in os.walk('package'):
for file in files:
fn = os.path.join(base, file)
fns = fn[(len('package') + 1):]
zip.write(fn, fns)
print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size"))
for zinfo in zip.infolist():
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size))
zip.close()
if 'ftp_hostname' in os.environ:
print('')
ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
print('Connected to server, uploading build...')
ftp.cwd(os.environ['ftp_directory'])
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
ftp.quit()
print('Uploaded as \'' + filename + '\'')
os.unlink(filename)