diff --git a/BuildSample/BuildSample/CoolApp.csproj b/BuildSample/BuildSample/CoolApp.csproj
index f0a3948..a1f91b8 100644
--- a/BuildSample/BuildSample/CoolApp.csproj
+++ b/BuildSample/BuildSample/CoolApp.csproj
@@ -34,7 +34,7 @@
4
None
false
- MyProvisioningValueMyCodesignValue
+
true
full
diff --git a/scripts/IosSetupSteps.txt b/scripts/IosSetupSteps.txt
index bccee30..58c1abf 100644
--- a/scripts/IosSetupSteps.txt
+++ b/scripts/IosSetupSteps.txt
@@ -1,11 +1,13 @@
-restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными)
-create backup
+# restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными)
+# create backup
sh echo '{@sln_config}'
inside 'BuildSample/BuildSample.sln' remove NotCompileApp project
inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output' for '{@sln_config}'
+inside 'BuildSample/BuildSample/CoolApp.csproj' set AssemblyName to 'CoolApp' for ''
+
inside 'BuildSample/BuildSample/Info.plist' set CFBundleVersion to '{@version}'
inside 'BuildSample/BuildSample/Info.plist' set CFBundleDisplayName to 'CoolApp'
diff --git a/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/__init__.py b/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/__init__.py
new file mode 100644
index 0000000..cc31abc
--- /dev/null
+++ b/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/__init__.py
@@ -0,0 +1 @@
+__author__ = 'rzaitov'
diff --git a/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/test_CsprojPatcher.py b/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/test_CsprojPatcher.py
new file mode 100644
index 0000000..52470b1
--- /dev/null
+++ b/scripts/TouchinBuild/Tests/UnitTests/CsprojPatcher/test_CsprojPatcher.py
@@ -0,0 +1,23 @@
+import unittest
+from utils.CsprojPatcher import CsprojPatcher
+
+
+class TestCsprojPatcher(unittest.TestCase):
+ def setUp(self):
+ self.patcher = CsprojPatcher('NotExists.sln')
+
+ def test_CheckPropertyGroupCondition(self):
+ self.checkFit(" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ", 'Debug|iPhoneSimulator')
+ self.checkFit(" '$(Configuration)|$(Platform)'=='Debug|iPhoneSimulator' ", 'Debug|iPhoneSimulator')
+ self.checkFit("'$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator'", 'Debug|iPhoneSimulator')
+ self.checkFit("'$(Configuration)|$(Platform)'=='Debug|iPhoneSimulator'", 'Debug|iPhoneSimulator')
+
+ self.checkFit(" '$(Configuration)' == '' ", '')
+ self.checkFit(" '$(Configuration)'=='' ", '')
+ self.checkFit("'$(Configuration)' == ''", '')
+ self.checkFit("'$(Configuration)'==''", '')
+
+ def checkFit(self, conditionAttrValue, slnConfig):
+ isFit = self.patcher.IsValueFitFor(slnConfig, conditionAttrValue)
+ self.assertTrue(True, isFit)
+
diff --git a/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py b/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py
index d7f62bc..095e557 100644
--- a/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py
+++ b/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py
@@ -21,7 +21,7 @@ class InsideCsprojSetParser(InsideParserBase):
keyRegexp = r'(?P[a-zA-Z]+)'
valueRegexp = r"'(?P[^']+)'"
- slnConfigRegexp = r"'(?P[a-zA-Z|]+)'$"
+ slnConfigRegexp = r"'(?P[a-zA-Z|]*)'$"
regexpSource = self.startsWith('inside') + self.filePathRegexp + self.keywordToken('set') + keyRegexp + \
self.keywordToken('to') + valueRegexp + self.keywordToken('for') + slnConfigRegexp
diff --git a/scripts/TouchinBuild/utils/CsprojPatcher.py b/scripts/TouchinBuild/utils/CsprojPatcher.py
index 4f25b9d..57fef23 100644
--- a/scripts/TouchinBuild/utils/CsprojPatcher.py
+++ b/scripts/TouchinBuild/utils/CsprojPatcher.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import xml.etree.ElementTree as eT
eT.register_namespace('', "http://schemas.microsoft.com/developer/msbuild/2003")
@@ -8,35 +9,37 @@ class CsprojPatcher:
self._namespaces = {'ns': 'http://schemas.microsoft.com/developer/msbuild/2003'}
- def FetchPropertyGroup(self, sln_config_name):
- self._tree = eT.parse(self._csproj_abs_path)
- project_element = self._tree.getroot()
+ def FetchPropertyGroup(self, slnConfigName):
+ assert slnConfigName is not None
- property_group = self.GetPropertyGroupBy(project_element, sln_config_name)
- return property_group
+ self._tree = eT.parse(self._csproj_abs_path)
+ projectElement = self._tree.getroot()
+
+ property_group = self.GetPropertyGroupBy(projectElement, slnConfigName)
+ return property_group
def WriteTree(self):
self._tree.write(self._csproj_abs_path, xml_declaration=True, encoding='utf-8', method="xml")
def GetPropertyGroupBy(self, project_element, config_name):
+ assert project_element is not None
+ assert config_name is not None
+
property_groups = project_element.findall('ns:PropertyGroup', self._namespaces)
prop_group = None
for pg_elem in property_groups:
+ # atr_value мб None для первого PropertyGroup
atr_value = pg_elem.get('Condition')
-
- if atr_value is None:
- continue
-
is_fit = self.IsValueFitFor(config_name, atr_value)
if is_fit:
prop_group = pg_elem
break
- return prop_group
+ return prop_group
def Remove(self, tag_names, sln_config_name):
@@ -46,13 +49,24 @@ class CsprojPatcher:
def AddOrReplace(self, key_value_dict, sln_config_name):
+ assert key_value_dict is not None
+ assert sln_config_name is not None
+
property_group = self.FetchPropertyGroup(sln_config_name)
self.AddOrReplaceTagsFor(property_group, key_value_dict)
self.WriteTree()
def IsValueFitFor(self, config_name, condition_attr_value):
- result = "'{0}'".format(config_name) in condition_attr_value
+ if condition_attr_value is None:
+ result = config_name == '' or config_name is None
+ else:
+ # '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator'
+ configValue = condition_attr_value.split('==')[1]
+ configValue = configValue.strip()
+
+ result = "'{0}'".format(config_name) == configValue
+
return result
@@ -65,12 +79,19 @@ class CsprojPatcher:
def AddOrReplaceTagsFor(self, property_group_element, key_value_dict):
+ assert property_group_element is not None
+ assert key_value_dict is not None
+
for k in key_value_dict:
v = key_value_dict[k]
self.AppendOrReplaceValueByKey(k, v, property_group_element)
def AppendOrReplaceValueByKey(self, tag_name, value, property_group_element):
+ assert tag_name is not None
+ assert value is not None
+ assert property_group_element is not None
+
tag = property_group_element.find('ns:{0}'.format(tag_name), self._namespaces)
if tag is None: