Compare commits

..

No commits in common. "master" and "BS-44" have entirely different histories.

49 changed files with 56 additions and 569 deletions

View File

@ -15,16 +15,14 @@ Global
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhone.Build.0 = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|Any CPU.Build.0 = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhone.ActiveCfg = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhone.Build.0 = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{10AA179F-818F-4E3F-947E-DE1C0C87BB76}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhone.ActiveCfg = Debug|iPhone
@ -32,13 +30,13 @@ Global
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Release|iPhone.ActiveCfg = Release|iPhone
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Release|iPhone.Build.0 = Release|iPhone
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Debug|iPhone.Build.0 = Debug|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Release|iPhone.ActiveCfg = Release|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Release|iPhone.Build.0 = Release|Any CPU
{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU

View File

@ -17,7 +17,6 @@
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>DroidApp</AssemblyName>
<TargetFrameworkVersion>v4.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -53,7 +52,6 @@
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Main.axml" />

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="DroidApp.DroidApp">
<uses-sdk />
<application android:label="DroidApp">
</application>
</manifest>

View File

@ -1,47 +0,0 @@
Добавить символьную ссылку на скрипт сборки. Заменить <builder_path> на абсолютный путь к корню репозитория билд скрипта
sudo ln -s <builder_path>/scripts/TouchinBuild/taskRunner.py /usr/local/bin/tibuild
Чтобы работала система сборки необходимо выполнить формальные шаги:
0. [iOS] Убедиться что в собираемом проекте выбор профиля обеспечения и сертификата производится автоматически.
Так следует сделать чтобы любой разработчик мог собрать проект, на билд сервере будут подставлены необоходимы значения автоматически
1. [iOS, Android] Убедиться что в названии проекта нет пробелов.
2. [iOS, Android] В корне репозитория создать папку scripts
mkdir scripts
3. [iOS] Положить в папку scripts профили обеспечения со следующими названиями
development.mobileprovision
distribution.mobileprovision
4. [iOS, Android] В папке scripts создать файл settings.txt
touch scripts/settings.txt
5. [iOS, Android] Скопировать содержимое примера scripts/common/setting.txt в свой файл settings.txt и переопределить все необходимые настройки
Стоит обратить внимание на комментации
# required эти настройки необходимо задать, иначе ничего не будет работать
# dont change это можно менять если есть четкое осознание того что происходит
6. [iOS, Android] вызвать скрипт, заменив параметры
на сервере. <builder_path> скорее всего это /BuildServer/Scripts
tibuild --settings=scripts/settings.txt build=%build.number% builder_path=<builder_path>
локально. path_to_local_direcotry путь к папке вне репозитория проекта (чтобы ничего не потерлось) или добавить папку в настройку backup_ignore
tibuild --settings=scripts/settings.txt build=777 builder_path=<builder_path> publish_path=<path_to_local_direcotry>
Пояснение значения некоторых настроек:
publish_step_type enum(development|distribution) в зависимости от этого значения будет вызван один из следующих шагов
'ios publish development.txt' копирование файла ipa в папку @publish_path/
'ios publish distribution.txt' - создание zip архива (app файла) и копирование его в папку @publish_path/
Это значение было введено чтобы поддерживать сборку с разными профилями обеспечения.
Типичный кейс. У нас 2 профайла:
development.mobileprovision сборка для наших тестировщиков [publish_step_type=development]
distribution.mobileprovision сборка для апстора [publish_step_type=distribution]
Расширенный кейс. У нас 3 профайла
development.mobileprovision сборка для наших тестировщиков [publish_step_type=development]
customer.mobileprovision сборка для тестировщиков заказчиков [publish_step_type=development]
distribution.mobileprovision сборка для апстора [publish_step_type=distribution]
bundle_id BundleId который будет подставлен в Info.Plist файл. Настройка нужна для поддержки сборки с разными профилями обсеспечеиня. Так например в профиле обеспечения предоставляемом заказчиком будет указан другой BunldeId, те не com.touchin.projectname

View File

@ -1,19 +0,0 @@
restore from backup
create backup
inside 'BuildSample/BuildSample.sln' remove 'CoolApp:NotCompileApp:Domain' project
inside 'BuildSample/DroidApp/DroidApp.csproj' set OutputPath to 'Output' for '{@sln_config}'
inside 'BuildSample/DroidApp/Properties/AndroidManifest.xml' set android:versionCode to '17'
inside 'BuildSample/DroidApp/Properties/AndroidManifest.xml' set android:versionName to '1.2.3'
clean 'BuildSample/BuildSample.sln' for '{@sln_config}'
sign android 'BuildSample/BuildSample.sln' for '{@sln_config_build}' project 'DroidApp'
create dirs 'Output/GooglePlay/Artifacts'
sh cp BuildSample/DroidApp/Output/*.apk Output/GooglePlay/Artifacts
sh cp -a BuildSample/DroidApp/Output/ Output/GooglePlay/
restore from backup
delete backup

View File

@ -1,7 +1,7 @@
restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными)
create backup
# restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными)
# create backup
sh echo 'Hello from setup.txt'
sh echo '{@sln_config}'
inside 'BuildSample/BuildSample.sln' remove 'NotCompileApp:DroidApp' project

View File

@ -7,7 +7,7 @@ create dirs 'Output/Appstore/Artifacts'
copy 'BuildSample/BuildSample/Output/{@assembly_name}-{@version}.ipa' to 'Output/Appstore/Artifacts'
sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/
#publish 'Output/Appstore/Artifacts/{@assembly_name}-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}'
publish 'Output/Appstore/Artifacts/{@assembly_name}-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}'
restore from backup
delete backup
#restore from backup
#delete backup

View File

@ -1,12 +0,0 @@
from parsers.ValuesStriper import ValuesStripper
class BaseBackupCommandBuilder:
def __init__(self, ignoreBackupStr):
if ignoreBackupStr:
splitter = ValuesStripper(',')
values = splitter.strip(ignoreBackupStr)
self.ignoreBackup = values
else:
self.ignoreBackup = []

View File

@ -1 +0,0 @@
__author__ = 'rzaitov'

View File

@ -1,11 +1,10 @@
from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder
from commands.BaseBackupCommand.CreateBackupCommand import CreateBackupCommand
from parsers.ParserBackup.CreateBackupParser import CreateBackupParser
class CreateBackupCommandBuilder(BaseBackupCommandBuilder):
def __init__(self, ignoreBackupStr):
BaseBackupCommandBuilder.__init__(self, ignoreBackupStr)
class CreateBackupCommandBuilder:
def __init__(self):
pass
def isCreateBackup(self, line):
assert line is not None
@ -19,5 +18,5 @@ class CreateBackupCommandBuilder(BaseBackupCommandBuilder):
parser = CreateBackupParser()
parser.parseLine(line)
command = CreateBackupCommand(self.ignoreBackup)
command = CreateBackupCommand()
return command

View File

@ -1,11 +1,10 @@
from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder
from commands.BaseBackupCommand.DeleteBackupCommand import DeleteBackupCommand
from parsers.ParserBackup.DeleteBackupParser import DeleteBackupParser
class DeleteBackupCommandBuilder(BaseBackupCommandBuilder):
def __init__(self, ignoreBackupStr):
BaseBackupCommandBuilder.__init__(self, ignoreBackupStr)
class DeleteBackupCommandBuilder:
def __init__(self):
pass
def isDeleteBackup(self, line):
assert line is not None
@ -21,5 +20,5 @@ class DeleteBackupCommandBuilder(BaseBackupCommandBuilder):
parser = DeleteBackupParser()
parser.parseLine(line)
command = DeleteBackupCommand(self.ignoreBackup)
command = DeleteBackupCommand()
return command

View File

@ -1,24 +0,0 @@
from commands.PatchManifestCommand import PatchManifestCommand
from parsers.InsideParser.InsideSetParser import InsideSetParser
class PatchManifestCommandBuilder:
def __init__(self):
pass
def isManifestCommand(self, line):
assert line is not None
parser = InsideSetParser('xml')
isValid = parser.isValidLine(line)
return isValid
def getCommandFor(self, line):
assert line is not None
parser = InsideSetParser('xml')
result = parser.parseLine(line)
command = PatchManifestCommand(result[0], result[1], result[2])
return command

View File

@ -1,11 +1,10 @@
from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder
from commands.BaseBackupCommand.RestoreBackupCommand import RestoreBackupCommand
from parsers.ParserBackup.RestoreBackupParser import RestoreBackupParser
class RestoreBackupCommandBuilder(BaseBackupCommandBuilder):
def __init__(self, ignoreBackupStr):
BaseBackupCommandBuilder.__init__(self, ignoreBackupStr)
class RestoreBackupCommandBuilder:
def __init__(self):
pass
def isRestoreBackup(self, line):
assert line is not None
@ -21,5 +20,5 @@ class RestoreBackupCommandBuilder(BaseBackupCommandBuilder):
parser = RestoreBackupParser()
parser.parseLine(line)
command = RestoreBackupCommand(self.ignoreBackup)
command = RestoreBackupCommand()
return command

View File

@ -1,30 +0,0 @@
from commands.CleanBuildCommands.SignApkCommand import SignApkCommand
from parsers.SignApkParser import SignApkParser
class SignApkCommandBuilder:
def __init__(self, pathToBuildUtil):
assert pathToBuildUtil is not None
self.pathToBuildUtil = pathToBuildUtil
def isSignApk(self, line):
assert line is not None
parser = SignApkParser()
isValid = parser.isValidLine(line)
return isValid
def getCommandFor(self, line):
assert line is not None
parser = SignApkParser()
result = parser.parseLine(line)
slnPath = result[0]
slnConfig = result[1]
projectName = result[2]
command = SignApkCommand(self.pathToBuildUtil, slnPath, slnConfig, projectName)
return command

View File

@ -1,18 +1,15 @@
from CommandBuilders.BuilderBackupCommands.CreateBackupCommandBuilder import CreateBackupCommandBuilder
from CommandBuilders.BuilderBackupCommands.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
from CommandBuilders.BuilderBackupCommands.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
from CommandBuilders.CleanBuildCommandBuilder import CleanBuildCommandBuilder
from CommandBuilders.CopyCommandBuilder import CopyCommandBuilder
from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
from CommandBuilders.InstallProfileCommandBuilder import InstallProfileCommandBuilder
from CommandBuilders.MakeDirsCommandBuilder import MakeDirsCommandBuilder
from CommandBuilders.PatchCsprojCommandBuilder import PatchCsprojCommandBuilder
from CommandBuilders.PatchInfoPlistArrayCommandBuilder import PatchInfoPlistArrayCommandBuilder
from CommandBuilders.PatchInfoplistCommandBuilder import PatchInfoplistCommandBuilder
from CommandBuilders.PatchManifestCommandBuilder import PatchManifestCommandBuilder
from CommandBuilders.RemoveProjectCommandBuilder import RemoveProjectCommandBuilder
from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
from CommandBuilders.ShCommandBuilder import ShCommandBuilder
from CommandBuilders.SignApkBuilder import SignApkCommandBuilder
from CommandBuilders.TestflightCommandBuilder import TestflightCommandBuilder
@ -27,27 +24,22 @@ class StepsRunner:
self.shCommandBuilder = ShCommandBuilder()
self.removeProjectBuilder = RemoveProjectCommandBuilder()
self.createBackupBuilder = CreateBackupCommandBuilder()
self.restoreFromBackupBuilder = RestoreBackupCommandBuilder()
self.deleteBackupBuilder = DeleteBackupCommandBuilder()
self.createDirs = MakeDirsCommandBuilder()
self.patchCsproj = PatchCsprojCommandBuilder()
self.patchInfoPlist = PatchInfoplistCommandBuilder(self.valueProvider)
self.patchInfoPlistArray = PatchInfoPlistArrayCommandBuilder()
self.patchManifest = PatchManifestCommandBuilder()
self.copyBuilder = CopyCommandBuilder()
self.testflightBuilder = TestflightCommandBuilder()
ignoreBackup = config.get('backup_ignore', None)
self.createBackupBuilder = CreateBackupCommandBuilder(ignoreBackup)
self.restoreFromBackupBuilder = RestoreBackupCommandBuilder(ignoreBackup)
self.deleteBackupBuilder = DeleteBackupCommandBuilder(ignoreBackup)
profilePrefix = config['project_name']
self.installProfileBuilder = InstallProfileCommandBuilder(profilePrefix)
buildUtilPath = config['build_tool']
self.cleanBuilder = CleanBuildCommandBuilder(buildUtilPath, 'clean')
self.buildBuilder = CleanBuildCommandBuilder(buildUtilPath, 'build')
self.signAndroid = SignApkCommandBuilder(buildUtilPath)
def run(self, content):
assert content is not None
@ -70,8 +62,6 @@ class StepsRunner:
cmd = self.cleanBuilder.getCommandFor(line)
elif self.buildBuilder.isCleanBuild(line):
cmd = self.buildBuilder.getCommandFor(line)
elif self.signAndroid.isSignApk(line):
cmd = self.signAndroid.getCommandFor(line)
elif self.createBackupBuilder.isCreateBackup(line):
cmd = self.createBackupBuilder.getCommandFor(line)
elif self.createDirs.isMakeDirsCommand(line):
@ -82,8 +72,6 @@ class StepsRunner:
cmd = self.patchInfoPlist.getCommandFor(line)
elif self.patchInfoPlistArray.isPatchInfoPlist(line):
cmd = self.patchInfoPlistArray.getCommandFor(line)
elif self.patchManifest.isManifestCommand(line):
cmd = self.patchManifest.getCommandFor(line)
elif self.copyBuilder.isCopy(line):
cmd =self.copyBuilder.getCommandFor(line)
elif self.restoreFromBackupBuilder.isRestoreBackup(line):

View File

@ -1,8 +1,8 @@
from CommandBuilders.BuilderBackupCommands.CreateBackupCommandBuilder import CreateBackupCommandBuilder
from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder
line = "create backup"
cmdBuilder = CreateBackupCommandBuilder(None)
cmdBuilder = CreateBackupCommandBuilder()
command = cmdBuilder.getCommandFor(line)
command.execute()

View File

@ -1,8 +1,8 @@
from CommandBuilders.BuilderBackupCommands.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
line = "delete backup"
cmdBuilder = DeleteBackupCommandBuilder(None)
cmdBuilder = DeleteBackupCommandBuilder()
command = cmdBuilder.getCommandFor(line)
command.execute()

View File

@ -47,6 +47,6 @@ contentProvider = ContentProviderMock()
buildConfigProvider = BuildConfigProvider()
preprocessor = NullPreprocessor()
taskRunner = TaskRunner(settingsProvider, contentProvider, buildConfigProvider, preprocessor, {})
taskRunner = TaskRunner(settingsProvider, contentProvider, buildConfigProvider, preprocessor)
taskRunner.run()

View File

@ -1,8 +0,0 @@
from CommandBuilders.PatchManifestCommandBuilder import PatchManifestCommandBuilder
line = "inside 'BuildSample/DroidApp/Properties/AndroidManifest.xml' set android:versionCode to '7.7.7'"
builder = PatchManifestCommandBuilder()
command = builder.getCommandFor(line)
command.execute()

View File

@ -40,7 +40,7 @@ resolvedBuildConfigProvider = ResolvedBuildConfigProvider(buildConfigProvider)
contentProvider = ContentProviderMock()
preprocessor = NullPreprocessor()
taskRunner = TaskRunner(settingsProvider, contentProvider, resolvedBuildConfigProvider, preprocessor, {})
taskRunner = TaskRunner(settingsProvider, contentProvider, resolvedBuildConfigProvider, preprocessor)
taskRunner.run()

View File

@ -1,8 +1,8 @@
from CommandBuilders.BuilderBackupCommands.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
line = "restore from backup"
builder = RestoreBackupCommandBuilder(None)
builder = RestoreBackupCommandBuilder()
command = builder.getCommandFor(line)
command.execute()

View File

@ -1 +0,0 @@
__author__ = 'rzaitov'

View File

@ -1,25 +0,0 @@
import unittest
from utils.ManifestPatcher import ManifestPatcher
class TestManifestPatcher(unittest.TestCase):
def setUp(self):
self.patcher = ManifestPatcher('somePath')
def test_parseRawName(self):
nameInfo1 = self.patcher.parseRawName('simpleName')
self.assertEqual(None, nameInfo1['prefix'])
self.assertEqual('simpleName', nameInfo1['original_name'])
nameInfo2 = self.patcher.parseRawName('prefix:originalName')
self.assertEqual('prefix', nameInfo2['prefix'])
self.assertEqual('originalName', nameInfo2['original_name'])
def test_fetchName(self):
nameInfo = {
'prefix': 'android',
'original_name': 'MyName'
}
name = self.patcher.fetchName(nameInfo)
self.assertEqual('{http://schemas.android.com/apk/res/android}MyName', name)

View File

@ -1,11 +0,0 @@
import unittest
from utils.XmlPatcher import XmlPatcher
class TestXmlPatcher(unittest.TestCase):
def setUp(self):
self.patcher = XmlPatcher('somePath')
def test_getNameWithNs(self):
name = self.patcher.getNameWithNs('OriginalName', 'http://namespace')
self.assertEqual('{http://namespace}OriginalName', name)

View File

@ -4,14 +4,8 @@ from commands.CommandBase import CommandBase
class BaseBackupCommand(CommandBase):
def __init__(self, ignoreBackup):
def __init__(self):
CommandBase.__init__(self)
assert ignoreBackup is not None
self.backupIgnore = ['.git', '.gitignore', '.DS_Store', 'backup']
self.backupIgnore.extend(ignoreBackup)
self.folderPath = '.'
# вычислять абсолютные пути надо на этапе создания комманды
@ -19,6 +13,7 @@ class BaseBackupCommand(CommandBase):
self.srcAbsDirPath = self.getAbsSrc()
self.backupDirAbsPath = self.getAbsDst()
self.backupIgnore = ['.git', '.gitignore', '.DS_Store', 'backup']
def getAbsSrc(self):
return self.getAbs(self.folderPath)

View File

@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
class CreateBackupCommand(BaseBackupCommand):
def __init__(self, ignoreBackup):
BaseBackupCommand.__init__(self, ignoreBackup)
def __init__(self):
BaseBackupCommand.__init__(self)
def execute(self):
#if os.path.exists(self.backupDirAbsPath):

View File

@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
class DeleteBackupCommand(BaseBackupCommand):
def __init__(self, ignoreBackup):
BaseBackupCommand.__init__(self, ignoreBackup)
def __init__(self):
BaseBackupCommand.__init__(self)
def execute(self):
if not os.path.exists(self.backupDirAbsPath):

View File

@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
class RestoreBackupCommand(BaseBackupCommand):
def __init__(self, ignoreBackup):
BaseBackupCommand.__init__(self, ignoreBackup)
def __init__(self):
BaseBackupCommand.__init__(self)
def execute(self):
if not os.path.exists(self.backupDirAbsPath):

View File

@ -1,23 +0,0 @@
from commands.ShellCommandBase import ShellCommandBase
class SignApkCommand(ShellCommandBase):
def __init__(self, pathToBuildUtil, slnPath, slnConfig, projectName):
ShellCommandBase.__init__(self)
assert pathToBuildUtil is not None
assert slnPath is not None
assert slnConfig is not None
assert projectName is not None
self.pathToBuildUtil = pathToBuildUtil
self.slnPath = slnPath
self.slnConfig = slnConfig
self.projectName = projectName
self.commandPattern = '{0} -v build "--configuration:{1}" "--project:{2}" /t:SignAndroidPackage "{3}"'
def execute(self):
cmdText = self.commandPattern.format(self.pathToBuildUtil, self.slnConfig, self.projectName, self.slnPath)
print cmdText
self.executeShell(cmdText)

View File

@ -1,20 +0,0 @@
from commands.CommandBase import CommandBase
from utils.ManifestPatcher import ManifestPatcher
class PatchManifestCommand(CommandBase):
def __init__(self, pathToManifest, key, value):
CommandBase.__init__(self)
assert pathToManifest is not None
assert key is not None
assert value is not None
self.pathToManifest = pathToManifest
self.key = key
self.value = value
def execute(self):
patcher = ManifestPatcher(self.pathToManifest)
patcher.AddOrReplaceManifestAtr(self.key, self.value)

View File

@ -19,7 +19,7 @@ class InsideSetParser(InsideParserBase):
def getMatchInfo(self, line):
assert line is not None
keyRegexp = r'(?P<key>\S+)'
keyRegexp = r'(?P<key>[a-zA-Z]+)'
valueRegexp = r"'(?P<value>[^']+)'$"
rb = RegexpBuilder()

View File

@ -1,40 +0,0 @@
import re
from parsers.LineParser import LineParser
from parsers.RegexpBuilder import RegexpBuilder
class SignApkParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None
filePathRegexp = r"'(?P<path>[./ a-zA-Z]+\.sln)'"
slnConfigRegexp = r"'(?P<config>[a-zA-Z|]+)'"
projectRegexp = r"'(?P<project>[.a-zA-Z]+)'$"
rb = RegexpBuilder()
rSrc = rb.startsWith('sign') + rb.than('android') + filePathRegexp + rb.keywordToken('for') + slnConfigRegexp +\
rb.keywordToken('project') + projectRegexp
regexp = re.compile(rSrc, re.UNICODE)
match = regexp.match(line)
self._guardMatch(match, line, rSrc)
path = match.group('path')
slnConfig = match.group('config')
project = match.group('project')
return path, slnConfig, project
def isValidLine(self, line):
assert line is not None
rb = RegexpBuilder()
rSrc = rb.startsWith('sign') + rb.than('android')
regexp = re.compile(rSrc, re.UNICODE)
match = regexp.match(line)
return match is not None

View File

@ -1,13 +1,11 @@
class ValuesStripper:
def __init__(self, separator=':'):
assert separator is not None
self.separator = separator
def __init__(self):
pass
def strip(self, valueStr):
assert valueStr is not None
rawValues = valueStr.split(self.separator)
rawValues = valueStr.split(':')
values = [name.strip() for name in rawValues]
return values

View File

@ -24,6 +24,5 @@ print 'current working dir: {0}'.format(baseDirAbsPath)
#import Tests.ManualTests.install_profile
#import Tests.ManualTests.macros_include_test
#import Tests.ManualTests.resolve_settings
#import Tests.ManualTests.infoPlistMultipleValues_test
import Tests.ManualTests.manifest_test
import Tests.ManualTests.infoPlistMultipleValues_test

View File

@ -1 +0,0 @@
sh echo 'This is default steps file'

View File

@ -26,18 +26,17 @@ scriptDir = os.path.dirname(scriptFilePath)
class TaskRunner:
def __init__(self, settingsProvider, fileContentProvider, buildConfigProvider, linePreprocessor, defaults):
def __init__(self, settingsProvider, fileContentProvider, buildConfigProvider, linePreprocessor):
assert settingsProvider is not None
assert fileContentProvider is not None
assert buildConfigProvider is not None
assert linePreprocessor is not None
assert defaults is not None
self.settingsProvider = settingsProvider
self.fileContentProvider = fileContentProvider
self.configsProvider = buildConfigProvider
self.linePreprocessor = linePreprocessor
self.defaults = defaults
macroProcessor = MacroProcessor()
self.valueProvider = ValueProvider()
@ -69,7 +68,7 @@ class TaskRunner:
stepsRunner.run(content)
def getStepsContent(self, config):
pathToSteps = config.get('steps', self.defaults['steps'])
pathToSteps = config['steps']
content = self.fileContentProvider.fetchContent(pathToSteps)
content = self.textPreprocessor.processText(content, self.textPreprocessor)
@ -78,12 +77,6 @@ class TaskRunner:
if __name__ == "__main__":
defaults = {
'settings': 'settings.txt',
'builder_path': scriptDir,
'steps': os.path.join(scriptDir, 'steps.txt')
}
parser = argparse.ArgumentParser()
parser.add_argument('--settings', required=False)
allArgs = parser.parse_known_args()
@ -99,7 +92,7 @@ if __name__ == "__main__":
linePreprocessor.addProcessor(lineStripper)
# TODO: перенести в корень комапановки
settingsPath = knownArgs.settings or defaults['settings']
settingsPath = knownArgs.settings or 'settings.txt'
fromFileSettingsProvider = FromFileSettingsProvider(settingsPath, linePreprocessor)
overrideWithCmdSetProvider = CmdArgsOverriderSettingsProvider(fromFileSettingsProvider, overrideArgs, linePreprocessor)
@ -107,10 +100,10 @@ if __name__ == "__main__":
buildConfigProvider = BuildConfigProvider()
predefineBuildConfigProvider = PredefinedMacrosBuildConfigProvider(buildConfigProvider)
predefineBuildConfigProvider.addPredefineMacro('builder_path', defaults['builder_path'])
predefineBuildConfigProvider.addPredefineMacro('builder_path', scriptDir)
resolvedBuildConfigProvider = ResolvedBuildConfigProvider(predefineBuildConfigProvider)
runner = TaskRunner(overrideWithCmdSetProvider, fContentProvider, resolvedBuildConfigProvider, linePreprocessor, defaults)
runner = TaskRunner(overrideWithCmdSetProvider, fContentProvider, resolvedBuildConfigProvider, linePreprocessor)
runner.run()

View File

@ -1,55 +0,0 @@
from utils.XmlPatcher import XmlPatcher
class ManifestPatcher(XmlPatcher):
def __init__(self, manifestPath):
assert manifestPath is not None
XmlPatcher.__init__(self, manifestPath)
self.androidNs = "http://schemas.android.com/apk/res/android"
self.androidNsPrefix = 'android'
self.namespaces[self.androidNsPrefix] = self.androidNs
self.regNamespace(self.androidNsPrefix, self.androidNs)
def AddOrReplaceManifestAtr(self, rawAtrName, atrValue):
assert rawAtrName is not None
assert atrValue is not None
tree = self.parse()
manifestElement = tree.getroot()
name = self.fetchNameByRawName(rawAtrName)
manifestElement.set(name, atrValue)
self.write(tree)
def fetchNameByRawName(self, rawName):
nameInfo = self.parseRawName(rawName)
name = self.fetchName(nameInfo)
return name
def parseRawName(self, rawName):
"""rawName=(nsPrefix:)?OriginalName
"""
result = rawName.split(':')
prefixExists = len(result) > 1
nameInfo = {
'prefix': result[0] if prefixExists else None,
'original_name': result[1] if prefixExists else result[0]
}
return nameInfo
def fetchName(self, nameInfo):
assert nameInfo is not None
nsPrefix = nameInfo['prefix']
origName = nameInfo['original_name']
namespace = self.namespaces.get(nsPrefix, None)
name = self.getNameWithNs(origName, namespace) if nsPrefix else origName
return name

View File

@ -1,27 +0,0 @@
import xml.etree.ElementTree as eT
class XmlPatcher:
def __init__(self, path):
assert path is not None
self.path = path
self.namespaces = {}
def parse(self):
return eT.parse(self.path)
def write(self, tree):
tree.write(self.path, xml_declaration=True, encoding="UTF-8", method="xml")
def regNamespace(self, nsKey, nsValue):
assert nsKey is not None
assert nsValue is not None
eT.register_namespace(nsKey, nsValue)
def getNameWithNs(self, originalName, namespace):
assert originalName is not None
assert namespace is not None
# {someNamespace}OriginalName
return '{{{0}}}{1}'.format(namespace, originalName)

View File

@ -1,2 +0,0 @@
build '{@sln_path}' for '{@sln_config}'
sign android '{@sln_path}' for '{@sln_config}' project '{@csproj_name}'

View File

@ -1,9 +0,0 @@
inside '{@csproj_dir}/{@csproj_file_name}' set OutputPath to '{@output_path}' for '{@sln_config}|AnyCPU'
inside '{@csproj_dir}/{@csproj_file_name}' set AssemblyName to '{@project_name}' for ''
inside '{@csproj_dir}/Properties/AndroidManifest.xml' set package to '{@package_name}'
inside '{@csproj_dir}/Properties/AndroidManifest.xml' set android:versionName to '{@version}.{@build}'
inside '{@csproj_dir}/Properties/AndroidManifest.xml' set android:versionCode to '{@version_code}'
inside '{@sln_path}' remove '{@remove_project}' project
clean '{@sln_path}' for '{@sln_config}'

View File

@ -1 +0,0 @@
copy '{@csproj_dir}/{@output_path}/{@package_name}-Signed.apk' to '{@publish_path}/{@output_file_name}'

View File

@ -1,14 +0,0 @@
restore from backup
create backup
<include '{@builder_path}/scripts/common/android prepare.txt'>
<include '{@builder_path}/scripts/common/android build.txt'>
#if {@teamcity_build_id}
create dirs '{@publish_path}'
sh echo '{@teamcity_build_id}' > '{@publish_path}/../{@build}.build_id'
<include '{@builder_path}/scripts/common/android publish.txt'>
#endif
restore from backup
delete backup

View File

@ -1 +0,0 @@
build '{@sln_path}' for '{@sln_config}'

View File

@ -1,15 +0,0 @@
install profile 'scripts/{@provisioning_profile}.mobileprovision'
inside '{@csproj_dir}/{@csproj_file_name}' set CodesignKey to '{@provisioning_account}' for '{@sln_config}'
inside '{@csproj_dir}/{@csproj_file_name}' set CodesignProvision to '{@provisioning_uudid}' for '{@sln_config}'
inside '{@csproj_dir}/{@csproj_file_name}' set OutputPath to '{@output_path}' for '{@sln_config}'
inside '{@csproj_dir}/{@csproj_file_name}' set IpaPackageName to '{@output_file_format}' for '{@sln_config}'
inside '{@csproj_dir}/{@csproj_file_name}' set BuildIpa to 'true' for '{@sln_config}'
inside '{@csproj_dir}/{@csproj_file_name}' set AssemblyName to '{@project_name}' for ''
inside '{@csproj_dir}/Info.plist' set CFBundleIdentifier to '{@bundle_id}'
inside '{@csproj_dir}/Info.plist' set CFBundleVersion to '{@version}.{@build}'
inside '{@csproj_dir}/Info.plist' set CFBundleShortVersionString to '{@version}'
inside '{@sln_path}' remove '{@remove_project}' project
clean '{@sln_path}' for '{@sln_config}'

View File

@ -1 +0,0 @@
copy '{@csproj_dir}/{@output_path}/{@output_file_format}.ipa' to '{@publish_path}/{@output_file_name}'

View File

@ -1,2 +0,0 @@
sh rm -f '{@publish_path}/{@output_file_name}'
sh cd '{@csproj_dir}/{@output_path}' && zip -y -r '{@publish_path}/{@output_file_name}' '{@csproj_name}.app'

View File

@ -1,14 +0,0 @@
restore from backup
create backup
<include '{@builder_path}/scripts/common/ios prepare.txt'>
<include '{@builder_path}/scripts/common/ios build.txt'>
#if {@teamcity_build_id}
create dirs '{@publish_path}'
sh echo '{@teamcity_build_id}' > '{@publish_path}/../{@build}.build_id'
<include '{@builder_path}/scripts/common/ios publish {@publish_step_type}.txt'>
#endif
restore from backup
delete backup

View File

@ -1,67 +0,0 @@
# global settings
teamcity_build_id = '0'
# Обновляйте это поле руками, когда выходит новая версия приложения
version = '0.0'
# Будет переопределено teamcity. например так build=%build.number%
build = '0'
build_tool = '/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool'
project_name = '' # required for build server infastructure
# required!!! обратите внимание на регистр папки builds на некоторых проектах название с большой буквы, а на некоторых с маленькой
publish_path = '/BuildServer/{@project_name}/builds/{@publish_name}'
# добавьте названия папок или файлов которые не надо бэкапить перед сборкой конфигурации
# это может быть папка куда складываются артефакты или служебная папка системы контроля версий
backup_ignore = .git, .gitignore, .DS_Store, backup, Artifacts, scripts, settings.txt, ios.txt
# укажите через запятую конфигурации которые необходимо собрать
configs = 'default_ios, appstore, default_android, googleplay'
# required. Возможно для IOs и Android созданы разные sln файлы, тогда эту настройку
# следует перенести в ios и android конфигурации
sln_path = ''
# dont change
csproj_file_name = '{@csproj_name}.csproj'
# эта настройка нужна для единообразия названий билдов
output_file_format = '{@project_name}-{@version}-{@build}'
# required
ios.csproj_dir = ''
ios.csproj_name = '' # только имя проекта, обычно имя файла без расширения
ios.remove_project = '' #оставить пустым если не надо удалять проекты. Чаще всего указывают проект Android (если он в том же солюшене)
# dont change
ios.sln_config = 'Release|iPhone'
ios.steps = '{@builder_path}/scripts/common/ios.txt'
ios.output_path = 'bin'
ios.publish_name = 'iPhone'
ios.default_ios.provisioning_profile = 'development' # required. Имя файла профиля обеспечения без разширерия (development.mobileprovision)
ios.default_ios.publish_step_type = 'development' # required. Enum (appstore|distribution)
ios.default_ios.bundle_id = '' # required. Обычно это com.touchin.projectname
ios.default_ios.provisioning_account = 'iPhone Developer: Build Server (GZRT3GYURD)' #Билд сервер собирает с помощью разработчика Build Server
ios.default_ios.provisioning_uudid = '' # required. Можно использовать пробел для режима Automatic
ios.default_ios.output_file_name = '{@output_file_format}-Default.ipa'
ios.appstore.provisioning_profile = 'distribution' # required. Имя файла профиля обеспечения без разширерия (distribution.mobileprovision)
ios.appstore.publish_step_type = 'distribution' # required. Enum (appstore|distribution)
ios.appstore.bundle_id = '' # required. Обычно это com.touchin.projectname
ios.appstore.provisioning_account = 'iPhone Distribution' # dont change. На билд сервере всего один distribution сертификат Ltd Touchinstinct он и будет выбран
ios.appstore.provisioning_uudid = '' # required. Можно использовать пробел для режима Automatic
ios.appstore.output_file_name = '{@output_file_format}-AppStore.zip'
# required
android.csproj_dir = ''
android.csproj_name = '' # только имя проекта, обычно имя файла без расширения
android.remove_project = '' #оставить пустым если не надо удалять проекты. Чаще всего указывают проект Android (если он в том же солюшене)
android.output_file_name = '{@output_file_format}-Default.apk'
# dont change
android.sln_config = 'Release' # Нельзя указывать платформу(Release|AnyCPU). Иначе приложение не будет подписано
android.steps = '{@builder_path}/scripts/common/android.txt'
android.output_path = 'bin'
android.publish_name = 'Android'
android.version_code = '{@build}' # Возможно стоит переопределить значения в конкректных конфигурациях
android.default_android.package_name = '' #required
android.googleplay.package_name = '' #required

View File

@ -1,13 +1,12 @@
# global settings
build_tool='/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool'
version=0.0.0 # комментарий в тойже строке
configs = 'appstore'
configs = 'appstore, staging'
project_name = CoolApp
backup_ignore = .git, .gitignore, .DS_Store, backup, Output, scripts
# ios platform settings
ios.steps = scripts/IosSteps.txt
ios.sln_config = Release|iPhone
ios.steps = 'scripts/IosSteps.txt'
ios.setup_steps = 'IosSetupSteps.txt'
ios.assembly_name = 'CoolApp'
@ -15,9 +14,7 @@ ios.tf_api_token = '0e6925075d4fc10fed0e7bbf43fa6894_NjQ0OTI2MjAxMi0wOS0yNSAxMTo
ios.tf_team_token = 'c5c3cf7a6dae2bea4382dfbd181a2075_Mjc4ODkwMjAxMy0wOS0yOSAxNDowOTo1OC40Mzg5MTY'
# android platform settings
android.sln_config = Release|AnyCPU
android.sln_config_build = Release
android.steps = 'scripts/AndroidSteps.txt'
# android.steps = 'scripts/AndroidSteps.txt'
# config settings
ios.appstore.app_name = {@project_name}