Merge branch 'BS-27'
This commit is contained in:
commit
24a90c3cfd
|
|
@ -53,7 +53,7 @@
|
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<OutputPath>Output</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer: Рустам Заитов (CTL85FZX6K)</CodesignKey>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ create backup for 'BuildSample'
|
|||
|
||||
inside 'BuildSample/BuildSample.sln' remove NotCompileApp project
|
||||
|
||||
inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output'
|
||||
inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output' for '{@sln_config}'
|
||||
inside 'BuildSample/BuildSample/Info.plist' set CFBundleVersion to '{@version}'
|
||||
inside 'BuildSample/BuildSample/Info.plist' set CFBundleDisplayName to 'CoolApp'
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ TouchinBuild/parsers/__init__.py
|
|||
TouchinBuild/parsers/CopyParser/CopyArguments.py
|
||||
TouchinBuild/parsers/CopyParser/CopyLineParser.py
|
||||
TouchinBuild/parsers/CopyParser/__init__.py
|
||||
TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py
|
||||
TouchinBuild/parsers/InsideParser/InsideRemoveParser.py
|
||||
TouchinBuild/parsers/InsideParser/InsideSetParser.py
|
||||
TouchinBuild/parsers/InsideParser/__init__.py
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
from commands.PatchCsprojCommand import PatchCsprojCommand
|
||||
from parsers.InsideParser.InsideSetParser import InsideSetParser
|
||||
from parsers.InsideParser.InsideCsprojSetParser import InsideCsprojSetParser
|
||||
|
||||
|
||||
class PatchCsprojCommandBuilder:
|
||||
def __init__(self, config, valueProvider):
|
||||
assert config is not None
|
||||
assert valueProvider is not None
|
||||
|
||||
self.__config = config
|
||||
self.__valueProvider = valueProvider
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def getCommandFor(self, line):
|
||||
assert line is not None
|
||||
|
||||
parser = InsideSetParser(self.__valueProvider, 'csproj')
|
||||
parser = self.getParser()
|
||||
result = parser.parseLine(line)
|
||||
|
||||
csprojPath = result[0]
|
||||
key = result[1]
|
||||
value = self.__valueProvider.getValueFor(result[2])
|
||||
|
||||
slnConfig = self.__config['sln_config']
|
||||
value = result[2]
|
||||
slnConfig = result[3]
|
||||
|
||||
command = PatchCsprojCommand(csprojPath, key, value, slnConfig)
|
||||
return command
|
||||
|
|
@ -28,8 +23,10 @@ class PatchCsprojCommandBuilder:
|
|||
def isPatchCsproj(self, line):
|
||||
assert line is not None
|
||||
|
||||
parser = InsideSetParser(self.__valueProvider, 'csproj')
|
||||
parser = self.getParser()
|
||||
isValid = parser.isValidLine(line)
|
||||
|
||||
return isValid
|
||||
|
||||
def getParser(self):
|
||||
return InsideCsprojSetParser('csproj')
|
||||
|
|
@ -28,6 +28,6 @@ class PatchInfoplistCommandBuilder:
|
|||
return command
|
||||
|
||||
def __createParser(self):
|
||||
parser = InsideSetParser(self.__valueProvider, 'plist')
|
||||
parser = InsideSetParser('plist')
|
||||
return parser
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class StepsRunner:
|
|||
self.restoreFromBackupBuilder = RestoreBackupCommandBuilder()
|
||||
self.deleteBackupBuilder = DeleteBackupCommandBuilder()
|
||||
self.createDirs = MakeDirsCommandBuilder()
|
||||
self.patchCsproj = PatchCsprojCommandBuilder(config, self.valueProvider)
|
||||
self.patchCsproj = PatchCsprojCommandBuilder()
|
||||
self.patchInfoPlist = PatchInfoplistCommandBuilder(self.valueProvider)
|
||||
self.copyBuilder = CopyCommandBuilder()
|
||||
self.testflightBuilder = TestflightCommandBuilder()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
from CommandBuilders.PatchCsprojCommandBuilder import PatchCsprojCommandBuilder
|
||||
from commands.ValueProvider import ValueProvider
|
||||
|
||||
config = {'sln_config' : 'Release|iPhone'}
|
||||
line = "inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output'"
|
||||
line = "inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output' for 'Release|iPhone'"
|
||||
|
||||
value_provider = ValueProvider(config)
|
||||
|
||||
builder = PatchCsprojCommandBuilder(config, value_provider)
|
||||
builder = PatchCsprojCommandBuilder()
|
||||
command = builder.getCommandFor(line)
|
||||
command.execute()
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import unittest
|
||||
from commands.ValueProvider import ValueProvider
|
||||
from parsers.InsideParser.InsideSetParser import InsideSetParser
|
||||
from parsers.InsideParser.InsideCsprojSetParser import InsideCsprojSetParser
|
||||
|
||||
|
||||
class TestCsprojParser(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
value_provider = ValueProvider()
|
||||
self.parser = InsideSetParser(value_provider, 'csproj')
|
||||
self.parser = InsideCsprojSetParser('csproj')
|
||||
|
||||
|
||||
def test_isValid(self):
|
||||
line = "inside 'CoolApp.csproj' set KEY to 'VALUE'"
|
||||
line = "inside 'CoolApp.csproj' set KEY to 'VALUE' for 'Sln|Config'"
|
||||
isValid = self.parser.isValidLine(line)
|
||||
|
||||
self.assertEqual(True, isValid)
|
||||
|
|
@ -24,9 +22,10 @@ class TestCsprojParser(unittest.TestCase):
|
|||
self.assertEqual(False, isValid)
|
||||
|
||||
def test_parse(self):
|
||||
line = "inside 'Dir/../Some Folder/CoolApp.csproj' set OutputPath to 'Output'"
|
||||
line = "inside 'Dir/../Some Folder/CoolApp.csproj' set OutputPath to 'Output' for 'Release|iPhone'"
|
||||
result = self.parser.parseLine(line)
|
||||
|
||||
self.assertEqual('Dir/../Some Folder/CoolApp.csproj', result[0])
|
||||
self.assertEqual('OutputPath', result[1])
|
||||
self.assertEqual('Output', result[2])
|
||||
self.assertEqual('Output', result[2])
|
||||
self.assertEqual('Release|iPhone', result[3])
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
тесты нужно запускать из папки TouchinBuild
|
||||
|
||||
Запуск всех тестов
|
||||
python -m unittest discover -s Tests/UnitTests/
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
import re
|
||||
|
||||
from parsers.LineParser import LineParser
|
||||
|
||||
|
||||
class InsideCsprojSetParser(LineParser):
|
||||
def __init__(self, fileExt):
|
||||
LineParser.__init__(self)
|
||||
|
||||
self.__extension = fileExt
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
matchInfo = self.getMatchInfo(line)
|
||||
match = matchInfo[0]
|
||||
regexpSource = matchInfo[1]
|
||||
self._guardMatch(match, line, regexpSource)
|
||||
|
||||
filePath = match.group('file')
|
||||
key = match.group('key')
|
||||
value = match.group('value')
|
||||
slnConfig = match.group('config')
|
||||
|
||||
return filePath, key, value, slnConfig
|
||||
|
||||
def getMatchInfo(self, line):
|
||||
assert line is not None
|
||||
|
||||
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.__extension)
|
||||
keyRegexp = r'(?P<key>[a-zA-Z]+)'
|
||||
valueRegexp = r"'(?P<value>[^']+)'"
|
||||
slnConfigRegexp = r"'(?P<config>[a-zA-Z|]+)'$"
|
||||
|
||||
regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + \
|
||||
self.keywordToken('to') + valueRegexp + self.keywordToken('for') + slnConfigRegexp
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
return match, regexpSource
|
||||
|
||||
def isValidLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
matchInfo = self.getMatchInfo(line)
|
||||
match = matchInfo[0]
|
||||
|
||||
return match is not None
|
||||
|
|
@ -4,24 +4,16 @@ from parsers.LineParser import LineParser
|
|||
|
||||
|
||||
class InsideSetParser(LineParser):
|
||||
def __init__(self, value_provider, fileExt):
|
||||
def __init__(self, fileExt):
|
||||
LineParser.__init__(self)
|
||||
assert value_provider is not None
|
||||
|
||||
self.__value_provider = value_provider
|
||||
self.__extension = fileExt
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.__extension)
|
||||
keyRegexp = r'(?P<key>[a-zA-Z]+)'
|
||||
valueRegexp = r"'(?P<value>[^']+)'"
|
||||
|
||||
regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + self.keywordToken('to') + valueRegexp
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
matchInfo = self.getMatchInfo(line)
|
||||
match = matchInfo[0]
|
||||
regexpSource = matchInfo[1]
|
||||
self._guardMatch(match, line, regexpSource)
|
||||
|
||||
filePath = match.group('file')
|
||||
|
|
@ -30,9 +22,24 @@ class InsideSetParser(LineParser):
|
|||
|
||||
return filePath, key, value
|
||||
|
||||
def isValidLine(self, line):
|
||||
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+set".format(self.__extension)
|
||||
regexp = re.compile(regexpSrc, re.UNICODE)
|
||||
def getMatchInfo(self, line):
|
||||
assert line is not None
|
||||
|
||||
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.__extension)
|
||||
keyRegexp = r'(?P<key>[a-zA-Z]+)'
|
||||
valueRegexp = r"'(?P<value>[^']+)'$"
|
||||
|
||||
regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + \
|
||||
self.keywordToken('to') + valueRegexp
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
|
||||
return match, regexpSource
|
||||
|
||||
def isValidLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
matchInfo = self.getMatchInfo(line)
|
||||
match = matchInfo[0]
|
||||
return match is not None
|
||||
|
|
@ -2,11 +2,11 @@ import os
|
|||
scriptFilePath = os.path.abspath(__file__)
|
||||
|
||||
scriptDir = os.path.dirname(scriptFilePath)
|
||||
baseDir = os.path.join(scriptDir, os.pardir)
|
||||
baseDir = os.path.join(scriptDir, os.pardir, os.pardir)
|
||||
|
||||
os.chdir(baseDir)
|
||||
|
||||
#import ManualTests.csproj_test
|
||||
import Tests.ManualTests.csproj_test
|
||||
#import ManualTests.info_plist_test
|
||||
#import ManualTests.copy_test
|
||||
#import ManualTests.create_backup_test
|
||||
|
|
@ -19,5 +19,4 @@ os.chdir(baseDir)
|
|||
#import ManualTests.infoplist_test
|
||||
#import ManualTests.clean_test
|
||||
#import Tests.ManualTests.testflight_test
|
||||
|
||||
import Tests.ManualTests.install_profile
|
||||
#import Tests.ManualTests.install_profile
|
||||
|
|
|
|||
Loading…
Reference in New Issue