Merge branch 'BS-19'
This commit is contained in:
commit
43b881d736
|
|
@ -1,6 +1,6 @@
|
|||
from commands.CleanBuildCommands.BuildCommand import BuildCommand
|
||||
from commands.CleanBuildCommands.CleanCommand import CleanCommand
|
||||
from parser.CleanBuildParser.CleanBuildParser import CleanBuildParser
|
||||
from parser.CleanBuildParser import CleanBuildParser
|
||||
|
||||
|
||||
class CleanBuildCommandBuilder:
|
||||
|
|
@ -32,8 +32,6 @@ class CleanBuildCommandBuilder:
|
|||
return command
|
||||
|
||||
def __getCommandByToken(self, slnPath, slnConfig):
|
||||
command = None
|
||||
|
||||
if self.__commandToken == 'clean':
|
||||
command = CleanCommand(self.__pathToBuildUtil, slnPath, slnConfig)
|
||||
elif self.__commandToken == 'build':
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.CopyParser.CopyLineParser import CopyLineParser
|
|||
|
||||
|
||||
class CopyCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isCopy(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.BackupParser.CreateBackupParser import CreateBackupParser
|
|||
|
||||
|
||||
class CreateBackupCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isCreateBackup(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.BackupParser.DeleteBackupParser import DeleteBackupParser
|
|||
|
||||
|
||||
class DeleteBackupCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isDeleteBackup(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.MakeDirsParser import MakeDirsParser
|
|||
|
||||
|
||||
class MakeDirsCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isMakeDirsCommand(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.InsideParser.InsideRemoveParser import InsideRemoveParser
|
|||
|
||||
|
||||
class RemoveProjectCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isRemoveProject(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.BackupParser.RestoreBackupParser import RestoreBackupParser
|
|||
|
||||
|
||||
class RestoreBackupCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isRestoreBackup(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ from parser.ShParser import ShParser
|
|||
|
||||
|
||||
class ShCommandBuilder:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def isShCommand(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder
|
||||
from ManualTests.path_provider import PathProvider
|
||||
|
||||
line = "create backup for 'BuildSample'"
|
||||
|
||||
baseDir = '../'
|
||||
path_provider = PathProvider(baseDir)
|
||||
|
||||
cmdBuilder = CreateBackupCommandBuilder(path_provider)
|
||||
command = cmdBuilder.getCommandFor(line)
|
||||
|
||||
command.execute()
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
|
||||
from ManualTests.path_provider import PathProvider
|
||||
|
||||
line = "delete backup"
|
||||
|
||||
baseDir = '../'
|
||||
path_provider = PathProvider(baseDir)
|
||||
|
||||
cmdBuilder = DeleteBackupCommandBuilder(path_provider)
|
||||
command = cmdBuilder.getCommandFor(line)
|
||||
|
||||
command.execute()
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
from CommandBuilders.CopyCommandBuilder import CopyCommandBuilder
|
||||
from ManualTests.path_provider import PathProvider
|
||||
|
||||
line1 = "copy 'BuildSample/BuildSample.sln' to 'BuildSample/BuildSample.txt'"
|
||||
line2 = "copy 'BuildSample/BuildSample/Profiles/8F606DAE-F9C9-4A19-8EFF-34B990D76C28.mobileprovision' to '~/Library/MobileDevice/Provisioning Profiles/BuildScript.mobileprovision'"
|
||||
|
||||
baseDir = '../'
|
||||
path_provider = PathProvider(baseDir)
|
||||
|
||||
copyCmdBuilder = CopyCommandBuilder(path_provider)
|
||||
copyCmdBuilder = CopyCommandBuilder()
|
||||
|
||||
#copyCmdToRel = copyCmdBuilder.getCommandFor(line1)
|
||||
#copyCmdToRel.execute()
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder
|
||||
|
||||
line = "create backup for 'BuildSample'"
|
||||
|
||||
cmdBuilder = CreateBackupCommandBuilder()
|
||||
command = cmdBuilder.getCommandFor(line)
|
||||
|
||||
command.execute()
|
||||
|
|
@ -1,14 +1,11 @@
|
|||
from CommandBuilders.PatchCsprojCommandBuilder import PatchCsprojCommandBuilder
|
||||
from ManualTests.path_provider import PathProvider
|
||||
from commands.ValueProvider import ValueProvider
|
||||
|
||||
config = {'sln_config' : 'Release|iPhone'}
|
||||
line = "inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output'"
|
||||
|
||||
base_dir = '../'
|
||||
path_provider = PathProvider(base_dir)
|
||||
value_provider = ValueProvider(config)
|
||||
|
||||
builder = PatchCsprojCommandBuilder(config, path_provider, value_provider)
|
||||
builder = PatchCsprojCommandBuilder(config, value_provider)
|
||||
command = builder.getCommandFor(line)
|
||||
command.execute()
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
|
||||
|
||||
line = "delete backup"
|
||||
|
||||
cmdBuilder = DeleteBackupCommandBuilder()
|
||||
command = cmdBuilder.getCommandFor(line)
|
||||
|
||||
command.execute()
|
||||
|
|
@ -1,12 +1,8 @@
|
|||
from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
|
||||
from ManualTests.path_provider import PathProvider
|
||||
|
||||
line = "restore from backup"
|
||||
|
||||
baseDir = '../'
|
||||
path_provider = PathProvider(baseDir)
|
||||
|
||||
builder = RestoreBackupCommandBuilder(path_provider)
|
||||
builder = RestoreBackupCommandBuilder()
|
||||
command = builder.getCommandFor(line)
|
||||
|
||||
command.execute()
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import unittest
|
||||
from utils.configs.BuildConfigProvider import BuildConfigProvider
|
||||
from utils.BuildConfigProvider import BuildConfigProvider
|
||||
|
||||
|
||||
class TestBuildConfigProvider(unittest.TestCase):
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import unittest
|
||||
from parser.CleanBuildParser.CleanBuildParser import CleanBuildParser
|
||||
from parser.CleanBuildParser import CleanBuildParser
|
||||
|
||||
|
||||
class TestCleanBuildParser(unittest.TestCase):
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import unittest
|
||||
from UnitTests.ProjectParser.ValueProvider import ValueProvider
|
||||
from commands.ValueProvider import ValueProvider
|
||||
from parser.InsideParser.InsideSetParser import InsideSetParser
|
||||
|
||||
|
||||
class TestCsprojParser(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
value_provider = ValueProvider()
|
||||
value_provider = ValueProvider({})
|
||||
self.parser = InsideSetParser(value_provider, 'csproj')
|
||||
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ class TestCsprojParser(unittest.TestCase):
|
|||
|
||||
def test_parse(self):
|
||||
line = "inside 'Dir/../Some Folder/CoolApp.csproj' set OutputPath to 'Output'"
|
||||
tuple = self.parser.parseLine(line)
|
||||
result = self.parser.parseLine(line)
|
||||
|
||||
self.assertEqual('Dir/../Some Folder/CoolApp.csproj', tuple[0])
|
||||
self.assertEqual('OutputPath', tuple[1])
|
||||
self.assertEqual('Output', tuple[2])
|
||||
self.assertEqual('Dir/../Some Folder/CoolApp.csproj', result[0])
|
||||
self.assertEqual('OutputPath', result[1])
|
||||
self.assertEqual('Output', result[2])
|
||||
|
|
@ -7,23 +7,6 @@ class TestSettingsParser(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.parser = SettingsParser()
|
||||
|
||||
def test_getSettingsDictByPath(self):
|
||||
|
||||
len0 = len(self.parser.settings)
|
||||
self.assertEqual(0, len0)
|
||||
|
||||
self.parser.getSettingsDictByPath(['one'])
|
||||
len1 = len(self.parser.settings)
|
||||
self.assertEqual(1, len1)
|
||||
|
||||
self.parser.getSettingsDictByPath(['one', 'two'])
|
||||
len1 = len(self.parser.settings)
|
||||
self.assertEqual(1, len1)
|
||||
|
||||
self.parser.getSettingsDictByPath(['another', 'two'])
|
||||
len2 = len(self.parser.settings)
|
||||
self.assertEqual(2, len2)
|
||||
|
||||
def test_processLine(self):
|
||||
line1 = "x.y.name1 = 'value1'"
|
||||
line2 = "x.y.name2 = 'value2'"
|
||||
|
|
@ -57,6 +40,7 @@ class TestSettingsParser(unittest.TestCase):
|
|||
def test_emptyLinesAndComments(self):
|
||||
class PartialSettingsParser(SettingsParser):
|
||||
def __init__(self):
|
||||
SettingsParser.__init__(self)
|
||||
self.processLineCall = 0
|
||||
|
||||
def processLine(self, line):
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Запуск всех тестов
|
||||
python -m unittest discover -s Tests/UnitTests/
|
||||
|
||||
Запуск части тестов
|
||||
python -m unittest discover -s Tests/UnitTests/CopyParser/
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import unittest
|
||||
from parser.BackupParser.CreateBackupParser import CreateBackupParser
|
||||
|
||||
|
||||
class TestCreateBackupParser(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.__parser = CreateBackupParser()
|
||||
|
||||
def test_validInput(self):
|
||||
line = "create backup for 'SomeFolder'"
|
||||
createBackupArgs = self.__parser.parseLine(line)
|
||||
|
||||
self.assertEqual('SomeFolder', createBackupArgs.folderName)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import unittest
|
||||
from parser.BackupParser.DeleteBackupParser import DeleteBackupParser
|
||||
|
||||
|
||||
class TestDeleteBackupParser(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.__parser = DeleteBackupParser()
|
||||
|
||||
def test_isValid(self):
|
||||
line = 'delete backup'
|
||||
isValid = self.__parser.isValidLine(line)
|
||||
|
||||
self.assertEqual(True, isValid)
|
||||
|
||||
def test_isNotValid(self):
|
||||
line = 'bla backup'
|
||||
isValid = self.__parser.isValidLine(line)
|
||||
|
||||
self.assertEqual(False, isValid)
|
||||
|
||||
def test_validInput(self):
|
||||
line = 'delete backup'
|
||||
self.__parser.parseLine(line)
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import unittest
|
||||
from parser.BackupParser.RestoreBackupParser import RestoreBackupParser
|
||||
|
||||
|
||||
class TestRestoreBackupParser(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.__parser = RestoreBackupParser()
|
||||
|
||||
def test_ValidInput(self):
|
||||
line = 'restore from backup'
|
||||
self.__parser.parseLine(line)
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
class ValueProvider:
|
||||
def getValueFor(self, link):
|
||||
return link
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
import unittest
|
||||
from utils.sln import sln_toolkit_base as sln
|
||||
|
||||
|
||||
class TestRemoveProjectSections(unittest.TestCase):
|
||||
|
||||
def test_RemoveProjectSections(self):
|
||||
toolkit = sln.SolutionToolkitBase()
|
||||
patched_content = toolkit.RemoveProjectSectionsFrom(TestRemoveProjectSections.sln_content_original, ['NotCompileApp'])
|
||||
self.assertEqual(TestRemoveProjectSections.sln_content_patched, patched_content)
|
||||
|
||||
sln_content_original = r"""
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoolApp", "BuildSample\CoolApp.csproj", "{E7393DD4-5E5F-456A-89AB-000EC63BD901}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotCompileApp", "NotCompileApp\NotCompileApp.csproj", "{3DE4FDFA-1502-44CF-9B73-78B6D730C59F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Release|iPhone = Release|iPhone
|
||||
EndGlobalSection
|
||||
"""
|
||||
|
||||
sln_content_patched = r"""
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoolApp", "BuildSample\CoolApp.csproj", "{E7393DD4-5E5F-456A-89AB-000EC63BD901}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Release|iPhone = Release|iPhone
|
||||
EndGlobalSection
|
||||
"""
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Запуск всех тестов
|
||||
python -m unittest discover -s UnitTests/
|
||||
|
||||
Запуск части тестов
|
||||
python -m unittest discover -s UnitTests/CopyParser/
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
import os
|
||||
import imp
|
||||
|
||||
import settings
|
||||
import instruments
|
||||
import argparse
|
||||
|
||||
keys = instruments.GetConfigKeys(settings.build_ready_configs)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
for key in keys:
|
||||
arg = "--{0}".format(key)
|
||||
parser.add_argument(arg)
|
||||
|
||||
args = parser.parse_args()
|
||||
cmd_args = vars(args)
|
||||
|
||||
# remove unset key-values pairs
|
||||
for k in cmd_args.keys():
|
||||
if cmd_args[k] is None:
|
||||
del cmd_args[k]
|
||||
|
||||
print cmd_args
|
||||
|
||||
build_ready_configs = instruments.GetUnionConfigs(settings.build_ready_configs, cmd_args)
|
||||
|
||||
for bc in build_ready_configs:
|
||||
print bc['name']
|
||||
|
||||
sln_path = bc['sln_path']
|
||||
sln_dir = os.path.dirname(sln_path)
|
||||
|
||||
instruments.CreateOrRestoreFromBackup(sln_dir, bc['files_for_backup'])
|
||||
instruments.RemoveProjectFromSolution(sln_path, bc['projects_to_exclude'])
|
||||
|
||||
# try patch source code files
|
||||
path_function = bc['patch']
|
||||
if path_function is not None:
|
||||
path_function(bc)
|
||||
|
||||
if bc['action'] == 'build':
|
||||
instruments.CleanSolution(bc['mdtool'], sln_path, bc['sln_config'])
|
||||
instruments.BuildSolution(bc['mdtool'], sln_path, bc['sln_config'])
|
||||
|
||||
instruments.CreateOrRestoreFromBackup(sln_dir, bc['files_for_backup'])
|
||||
instruments.DeleteBackups(sln_dir, bc['files_for_backup'])
|
||||
|
||||
if 'post_build_file' in bc and 'post_build_actions' in bc:
|
||||
path_to_script = bc['post_build_file']
|
||||
module_name = os.path.splitext(os.path.basename(path_to_script))[0]
|
||||
post_build = imp.load_source(module_name, path_to_script)
|
||||
|
||||
for func_name in bc['post_build_actions']:
|
||||
func = getattr(post_build, func_name)
|
||||
func(bc)
|
||||
|
|
@ -15,4 +15,4 @@ class CleanBuildCommandBase:
|
|||
|
||||
def execute(self):
|
||||
cmdText = self.__commandPattern.format(self.__pathToBuildUtil, self.__slnConfig, self.__slnPath)
|
||||
returnCode = call(cmdText, shell=True)
|
||||
call(cmdText, shell=True)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ import os
|
|||
import shutil
|
||||
|
||||
class DeleteBackupCommand:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def execute(self):
|
||||
dirs = [name for name in os.listdir('.') if os.path.isdir(os.path.join('.', name)) & name.startswith('backup.')]
|
||||
for dir in dirs:
|
||||
shutil.rmtree(dir)
|
||||
for d in dirs:
|
||||
shutil.rmtree(d)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import utils.csproj.patcher as csproj
|
||||
import utils.CsprojPatcher as csproj
|
||||
|
||||
class PatchCsprojCommand():
|
||||
def __init__(self, csprojAbsPath, key, value, slnConfig):
|
||||
|
|
@ -13,7 +13,7 @@ class PatchCsprojCommand():
|
|||
self.__slnConfig = slnConfig
|
||||
|
||||
def execute(self):
|
||||
patcher = csproj.Patcher(self.__csprojAbsPath)
|
||||
patcher = csproj.CsprojPatcher(self.__csprojAbsPath)
|
||||
|
||||
dict = { self.__key : self.__value }
|
||||
patcher.AddOrReplace(dict, self.__slnConfig)
|
||||
dictionary = { self.__key : self.__value }
|
||||
patcher.AddOrReplace(dictionary, self.__slnConfig)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from utils.infoplist.patcher import Patcher
|
||||
from utils.InfoPlistPatcher import InfoPlistPatcher
|
||||
|
||||
|
||||
class PatchInfoPlistCommand():
|
||||
|
|
@ -12,7 +12,7 @@ class PatchInfoPlistCommand():
|
|||
self.__value = value
|
||||
|
||||
def execute(self):
|
||||
patcher = Patcher(self.__pathToPlist)
|
||||
patcher = InfoPlistPatcher(self.__pathToPlist)
|
||||
|
||||
dict = { self.__key : self.__value }
|
||||
patcher.AddOrReplace(dict)
|
||||
dictionary = { self.__key : self.__value }
|
||||
patcher.AddOrReplace(dictionary)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from utils.sln.patcher import Patcher
|
||||
from utils.SlnPatcher import SlnPatcher
|
||||
|
||||
|
||||
class RemoveProjectCommand:
|
||||
|
|
@ -10,5 +10,5 @@ class RemoveProjectCommand:
|
|||
self.__projectName = projectName
|
||||
|
||||
def execute(self):
|
||||
patcher = Patcher(self.__slnPath)
|
||||
patcher = SlnPatcher(self.__slnPath)
|
||||
patcher.removeProjects([self.__projectName])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ import shutil
|
|||
|
||||
|
||||
class RestoreBackupCommand:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def execute(self):
|
||||
dirPairs = [(name, "backup.{0}".format(name)) for name in os.listdir('.') if os.path.isdir(name) and not name.startswith('backup.')]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
from utils.TestflightPublisher import TestFlightPublisher
|
||||
|
||||
|
||||
class PublishToTestFlightCommand:
|
||||
def __init__(self, pathToFile, api_token, team_token, notes):
|
||||
assert pathToFile is not None
|
||||
|
||||
self.__pathToFile = pathToFile
|
||||
self.__publisher = TestFlightPublisher(api_token, team_token, notes)
|
||||
|
||||
def execute(self):
|
||||
self.__publisher.Publish(self.__pathToFile)
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
|
||||
|
||||
class BuildCommand:
|
||||
def SetCommandPrefix(self, value):
|
||||
self._command_prefix = value
|
||||
self._cmd_prefix_len = len(self._command_prefix)
|
||||
|
||||
self._prefix_name= 'prefix'
|
||||
self._app_name= 'app'
|
||||
self._key_name = 'key'
|
||||
|
||||
def __init__(self, config, cmd_prefix, separator=' '):
|
||||
self._separator = separator
|
||||
self._config = config
|
||||
self.SetCommandPrefix(cmd_prefix)
|
||||
|
||||
|
||||
def _parseConfig(self):
|
||||
return None
|
||||
|
||||
|
||||
def FetchAllKeysFromConfig(self):
|
||||
all_keys = []
|
||||
|
||||
for k in self._config:
|
||||
if k.startswith(self._command_prefix):
|
||||
all_keys.append(k)
|
||||
|
||||
print all_keys
|
||||
return all_keys
|
||||
|
||||
|
||||
def ParseValueFromToken(self, value_token):
|
||||
value = value_token
|
||||
|
||||
if value_token.startswith('@'):
|
||||
key = value_token[1:]
|
||||
value = self._config[key]
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def execute(self):
|
||||
return None
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import commands.build_command as bcmd
|
||||
import utils.testflight.testflight_publisher as tf
|
||||
|
||||
|
||||
class PublishToTestFlightCommand(bcmd.BuildCommand):
|
||||
def __init__(self, api_token, team_token, notes):
|
||||
self._publisher = tf.TestFlightPublisherBase(api_token, team_token, notes)
|
||||
|
||||
def execute(self):
|
||||
self._publisher.Publish()
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
from subprocess import call
|
||||
import shutil
|
||||
import os
|
||||
from utils.sln import patcher as sln
|
||||
|
||||
|
||||
def MapToBackupName(origin_path):
|
||||
|
||||
backup_path = "{0}.build_backup".format(origin_path)
|
||||
return backup_path
|
||||
|
||||
def FetchAbsOriginBackupInfo(base_dir, rel_path_to_origin_files):
|
||||
|
||||
abs_path_to_origin_files = [os.path.join(base_dir, rel) for rel in rel_path_to_origin_files]
|
||||
abs_origin_backup_infos = [{'origin': p, 'backup': MapToBackupName(p)} for p in abs_path_to_origin_files]
|
||||
|
||||
return abs_origin_backup_infos
|
||||
|
||||
def CreateOrRestoreFromBackup(base_dir, relative_path_to_files):
|
||||
|
||||
abs_origin_backup_infos = FetchAbsOriginBackupInfo(base_dir, relative_path_to_files)
|
||||
|
||||
for aobi in abs_origin_backup_infos:
|
||||
|
||||
abs_original = aobi['origin']
|
||||
abs_backup = aobi['backup']
|
||||
|
||||
if os.path.exists(abs_backup):
|
||||
# restore from backup
|
||||
shutil.copyfile(abs_backup, abs_original)
|
||||
else:
|
||||
# create backup
|
||||
shutil.copyfile(abs_original, abs_backup)
|
||||
|
||||
return None
|
||||
|
||||
def DeleteBackups(base_dir, relative_path_to_files):
|
||||
|
||||
abs_origin_backup_infos = FetchAbsOriginBackupInfo(base_dir, relative_path_to_files)
|
||||
|
||||
for aobi in abs_origin_backup_infos:
|
||||
|
||||
abs_backup = aobi['backup']
|
||||
|
||||
if os.path.exists(abs_backup):
|
||||
os.remove(abs_backup)
|
||||
|
||||
return None
|
||||
|
||||
def ResetDirectory(base_dir, relative_path_to_files):
|
||||
|
||||
CreateOrRestoreFromBackup(base_dir, relative_path_to_files)
|
||||
DeleteBackups(base_dir, relative_path_to_files)
|
||||
|
||||
return None
|
||||
|
||||
def RemoveProjectFromSolution(abs_path_to_sln, project_names):
|
||||
toolkit = sln.Patcher(abs_path_to_sln)
|
||||
toolkit.removeProjects(project_names)
|
||||
|
||||
def CleanSolution(mdtool, abs_path_to_sln, config):
|
||||
|
||||
clean_cmd_pattern = '{0} -v build "--configuration:{1}" "--target:Clean" {2}'
|
||||
clean_cmd_text = clean_cmd_pattern.format(mdtool, config, abs_path_to_sln)
|
||||
|
||||
print(clean_cmd_text)
|
||||
ret_code = call(clean_cmd_text, shell=True)
|
||||
print('finished with return code: {0}'.format(ret_code))
|
||||
|
||||
def BuildSolution(mdtool, abs_path_to_sln, config):
|
||||
|
||||
build_cmd_pattern = '{0} -v build "--configuration:{1}" "--target:Build" {2}'
|
||||
build_cmd_text = build_cmd_pattern.format(mdtool, config, abs_path_to_sln)
|
||||
|
||||
print(build_cmd_text)
|
||||
ret_code = call(build_cmd_text, shell=True)
|
||||
print('finished with return code: {0}'.format(ret_code))
|
||||
|
||||
def GetUnionConfigs(configs_lst, cmd_args=None):
|
||||
|
||||
union_configs = []
|
||||
for c_dict in configs_lst:
|
||||
|
||||
ancestors = GetAncestorsFromRootTo(c_dict)
|
||||
if cmd_args is not None:
|
||||
ancestors.append(cmd_args)
|
||||
|
||||
union_config = {}
|
||||
for a in ancestors:
|
||||
union_config.update(a)
|
||||
|
||||
union_configs.append(union_config)
|
||||
|
||||
return union_configs
|
||||
|
||||
def GetConfigKeys(configs_lst):
|
||||
union_configs = GetUnionConfigs(configs_lst)
|
||||
|
||||
keys = [];
|
||||
for config in union_configs:
|
||||
for key in config.keys():
|
||||
keys.append(key)
|
||||
|
||||
# remove duplicates
|
||||
keys = list(set(keys))
|
||||
|
||||
return keys
|
||||
|
||||
def GetAncestorsFromRootTo(config):
|
||||
|
||||
ancestors = []
|
||||
c = config
|
||||
|
||||
while c is not None:
|
||||
ancestors.append(c)
|
||||
c = c['parent']
|
||||
|
||||
ancestors.reverse()
|
||||
return ancestors
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import parser.StringValueParser as parser
|
||||
|
||||
class AttributeNameParser(parser.StringValueParser):
|
||||
def __init__(self, attribute_name, model):
|
||||
parser.StringValueParser.__init__(self, attribute_name, model)
|
||||
|
||||
def ProcessToken(self, token):
|
||||
self._model.rel_path = ''
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
import re
|
||||
|
||||
from parser.BackupParser.CreateBackupArguments import CreateBackupArguments
|
||||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
|
||||
class CreateBackupParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
self.__createBackupArguments = CreateBackupArguments()
|
||||
|
||||
def parseLine(self, line):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class DeleteBackupParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class RestoreBackupParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class CleanBuildParser(LineParser):
|
||||
def __init__(self, commandToken):
|
||||
LineParser.__init__(self)
|
||||
assert commandToken is not None
|
||||
|
||||
self.__commandToken = commandToken
|
||||
|
|
@ -22,7 +25,7 @@ class CleanBuildParser(LineParser):
|
|||
path = match.group('path')
|
||||
slnConfig = match.group('config')
|
||||
|
||||
return (path, slnConfig)
|
||||
return path, slnConfig
|
||||
|
||||
def isValidLine(self, line):
|
||||
assert line is not None
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
import re
|
||||
|
||||
from parser.CopyParser.CopyArguments import CopyArguments
|
||||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
|
||||
class CopyLineParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
self.__copyArguments = CopyArguments()
|
||||
|
||||
def parseLine(self, line):
|
||||
|
|
@ -27,5 +30,5 @@ class CopyLineParser(LineParser):
|
|||
def isValidLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
isValid = line.startswith("copy");
|
||||
isValid = line.startswith("copy")
|
||||
return isValid
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class InsideRemoveParser(LineParser):
|
||||
def __init__(self, fileExt):
|
||||
LineParser.__init__(self)
|
||||
assert fileExt is not None
|
||||
|
||||
self.__extension = fileExt
|
||||
|
|
@ -23,7 +25,7 @@ class InsideRemoveParser(LineParser):
|
|||
filePath = match.group('file')
|
||||
projectName = match.group('project')
|
||||
|
||||
return (filePath, projectName)
|
||||
return filePath, projectName
|
||||
|
||||
def isValidLine(self, line):
|
||||
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+remove".format(self.__extension)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class InsideSetParser(LineParser):
|
||||
def __init__(self, value_provider, fileExt):
|
||||
LineParser.__init__(self)
|
||||
assert value_provider is not None
|
||||
|
||||
self.__value_provider = value_provider
|
||||
|
|
@ -25,11 +28,10 @@ class InsideSetParser(LineParser):
|
|||
key = match.group('key')
|
||||
value = match.group('value')
|
||||
|
||||
return (filePath, key, value)
|
||||
return filePath, key, value
|
||||
|
||||
def isValidLine(self, line):
|
||||
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+set".format(self.__extension)
|
||||
print regexpSrc
|
||||
regexp = re.compile(regexpSrc, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
class LineParser:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class MakeDirsParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
|
||||
def parseLine(self, line):
|
||||
pathRegexp = r"'(?P<path>[^']+)'$"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
class PathParser:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def parse(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
from parser.SettingsParser.PathParser import PathParser
|
||||
|
||||
|
||||
class SettingsLineParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
|
|
@ -36,4 +40,4 @@ class SettingsLineParser(LineParser):
|
|||
propPath = match.group('prop_path')
|
||||
value = match.group('value')
|
||||
|
||||
return (propPath, value)
|
||||
return propPath, value
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
class SettingsMerger:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def merge(self, globalSettings, settingDescription):
|
||||
value = settingDescription['value']
|
||||
segments = settingDescription['segments']
|
||||
|
|
@ -23,10 +26,10 @@ class SettingsMerger:
|
|||
|
||||
return settingsDict
|
||||
|
||||
def overrideGuard(self, dict, key, path):
|
||||
if key in dict:
|
||||
pathStr = '.'.joun(path)
|
||||
msg = 'settings with name {0} by path {1} already exists with value {3}'.format(key, dict[key], pathStr)
|
||||
def overrideGuard(self, dictionary, key, path):
|
||||
if key in dictionary:
|
||||
pathStr = '.'.join(path)
|
||||
msg = 'settings with name {0} by path {1} already exists with value {3}'.format(key, dictionary[key], pathStr)
|
||||
raise Exception(msg)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
from parser.LineParser import LineParser
|
||||
|
||||
|
||||
class ShParser(LineParser):
|
||||
def __init__(self):
|
||||
LineParser.__init__(self)
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line
|
||||
|
||||
|
|
@ -19,4 +24,4 @@ class ShParser(LineParser):
|
|||
def isValidLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
return line.startswith('sh ')
|
||||
return line.startswith('sh ')
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
class StringValueParser:
|
||||
def __init__(self, valid_string, model):
|
||||
self._valid_string = valid_string
|
||||
self._model = model
|
||||
|
||||
def IsTokenValid(self, token):
|
||||
return token == self._valid_string
|
||||
|
||||
def ProcessToken(self, token):
|
||||
pass
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
class Token():
|
||||
def __init__(self, content, type):
|
||||
self.content = content
|
||||
self.type = type
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
import re
|
||||
import os
|
||||
import utils.infoplist.patcher as plist
|
||||
|
||||
def RewriteFile(file_to_rewrite, content):
|
||||
file_to_rewrite.seek(0)
|
||||
file_to_rewrite.write(content)
|
||||
file_to_rewrite.truncate()
|
||||
file_to_rewrite.close()
|
||||
|
||||
|
||||
def PatchSlnForIos(build_config):
|
||||
|
||||
sln_file = open(build_config['sln_path'], 'r+')
|
||||
content = sln_file.read()
|
||||
|
||||
condesign_key_patt = r'<CodesignKey>.*?</CodesignKey>'
|
||||
condesign_key_node = r'<CodesignKey>{0}</CodesignKey>'.format(build_config['codesign_key'])
|
||||
content = re.sub(condesign_key_patt, condesign_key_node, content)
|
||||
|
||||
RewriteFile(sln_file, content)
|
||||
|
||||
def PatchInfoPlist(build_config):
|
||||
|
||||
sln_dir = os.path.dirname(build_config['sln_path'])
|
||||
abs_info_plist_path = os.path.join(sln_dir, build_config['info_plist_rel_path'])
|
||||
|
||||
key_values = {'CFBundleVersion' : build_config['version']}
|
||||
patcher = plist.Patcher(abs_info_plist_path)
|
||||
patcher.AddOrReplace(key_values)
|
||||
|
||||
def PathcIos(build_config):
|
||||
|
||||
PatchSlnForIos(build_config)
|
||||
PatchInfoPlist(build_config)
|
||||
|
||||
def PathcAndroid(build_config):
|
||||
print('start patch ios')
|
||||
|
||||
|
|
@ -19,4 +19,3 @@ os.chdir(baseDir)
|
|||
#import ManualTests.infoplist_test
|
||||
#import ManualTests.clean_test
|
||||
|
||||
import ManualTests.build_test
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import patch
|
||||
|
||||
build_root = {
|
||||
'mdtool': '/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool',
|
||||
'version': '0.0.0',
|
||||
|
|
@ -58,7 +56,6 @@ ios_development_root = {
|
|||
'std_cmd.py testflight',
|
||||
],
|
||||
|
||||
'patch': patch.PathcIos,
|
||||
'parent': ios_root
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import os
|
||||
from utils.BuildConfigProvider import BuildConfigProvider
|
||||
from utils.FromFileSettingsProvider import FromFileSettingsProvider
|
||||
|
||||
scriptFilePath = os.path.abspath(__file__)
|
||||
|
||||
scriptDir = os.path.dirname(scriptFilePath)
|
||||
|
|
@ -6,11 +9,13 @@ baseDir = os.path.join(scriptDir, os.pardir)
|
|||
|
||||
os.chdir(baseDir)
|
||||
|
||||
from SettingsProvider.FromFileSettingsProvider import FromFileSettingsProvider
|
||||
from StepRunner.StepsRunner import StepsRunner
|
||||
from utils.configs.BuildConfigProvider import BuildConfigProvider
|
||||
|
||||
|
||||
class TaskRunner:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
settingsProvider = FromFileSettingsProvider()
|
||||
settings = settingsProvider.fetchSettings()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
class BuildConfigProvider:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def getConfigs(self, rootConfig):
|
||||
leafs = []
|
||||
self.traverseDict(None, rootConfig, leafs)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import xml.etree.ElementTree as eT
|
||||
eT.register_namespace('', "http://schemas.microsoft.com/developer/msbuild/2003")
|
||||
|
||||
class Patcher:
|
||||
class CsprojPatcher:
|
||||
def __init__(self, csproj_abs_path):
|
||||
self._csproj_abs_path = csproj_abs_path
|
||||
self._tree = None
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import os
|
||||
from parser.SettingsParser.SettingsParser import SettingsParser
|
||||
|
||||
|
||||
class FromFileSettingsProvider:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def fetchSettings(self):
|
||||
settingsFile = open('scripts/settings.txt')
|
||||
content = settingsFile.read()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import xml.etree.ElementTree as eT
|
||||
|
||||
|
||||
class Patcher():
|
||||
class InfoPlistPatcher():
|
||||
def __init__(self, infoPlistPath):
|
||||
self.__infoPlistPath = infoPlistPath
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
|
||||
class ConverterBase:
|
||||
|
||||
def Convert(self, rel_path):
|
||||
return None
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import utils.PathConverter.converter_base as cB
|
||||
import os
|
||||
|
||||
|
||||
class PathConverter(cB.ConverterBase):
|
||||
def __init__(self, sln_path):
|
||||
self._sln_dir = os.path.dirname(sln_path)
|
||||
|
||||
def Convert(self, rel_path):
|
||||
return os.path.join(self._sln_dir, rel_path)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
|
||||
|
||||
class Patcher:
|
||||
class SlnPatcher:
|
||||
def __init__(self, pathToSlnFile):
|
||||
self._sln_path = pathToSlnFile
|
||||
self._sln_file = None
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from subprocess import call
|
||||
|
||||
|
||||
class TestFlightPublisherBase:
|
||||
class TestFlightPublisher:
|
||||
DefaultNotes = 'This build was uploaded via the upload API'
|
||||
|
||||
def __init__(self, api_token, team_token, notes=DefaultNotes):
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'rzaitov'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue