From 3d47ebcaad3c12405de1c4a310626fab0bf0f6b0 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Thu, 14 Nov 2013 15:46:49 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C=D0=BA=D0=B8=D1=85=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=BE=D0=B2=20=D0=B8=D0=B7?= =?UTF-8?q?=20sln=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RemoveProjectCommandBuilder.py | 6 ++--- .../InsideParsers/test_insideRemoveParser.py | 21 ++++++++++++++++ .../commands/RemoveProjectCommand.py | 8 +++---- .../InsideParser/InsideRemoveParser.py | 24 +++++++++++++++---- .../InsideParser/InsideSetArrayParser.py | 5 +++- scripts/TouchinBuild/parsers/ValuesStriper.py | 11 +++++++++ 6 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 scripts/TouchinBuild/Tests/UnitTests/InsideParsers/test_insideRemoveParser.py create mode 100644 scripts/TouchinBuild/parsers/ValuesStriper.py diff --git a/scripts/TouchinBuild/CommandBuilders/RemoveProjectCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/RemoveProjectCommandBuilder.py index b81482f..b8dc34f 100644 --- a/scripts/TouchinBuild/CommandBuilders/RemoveProjectCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/RemoveProjectCommandBuilder.py @@ -20,8 +20,8 @@ class RemoveProjectCommandBuilder: parser = InsideRemoveParser('sln') result = parser.parseLine(line) - slnPath = result[0] - projectName = result[1] + slnPath = result['file_path'] + projectNames = result['names'] - command = RemoveProjectCommand(slnPath, projectName) + command = RemoveProjectCommand(slnPath, projectNames) return command \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/UnitTests/InsideParsers/test_insideRemoveParser.py b/scripts/TouchinBuild/Tests/UnitTests/InsideParsers/test_insideRemoveParser.py new file mode 100644 index 0000000..a397091 --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/InsideParsers/test_insideRemoveParser.py @@ -0,0 +1,21 @@ +import unittest +from parsers.InsideParser.InsideRemoveParser import InsideRemoveParser + + +class TestInsideRemoveParser(unittest.TestCase): + def setUp(self): + self.parser = InsideRemoveParser('ext') + + def test_parse(self): + self.check("inside 'Some/Path/file.ext' remove 'PROGECT' project", 'Some/Path/file.ext', ['PROGECT']) + + self.check("inside 'file.ext' remove 'PR' projects", 'file.ext', ['PR']) + self.check("inside 'file.ext' remove 'PR' projects", 'file.ext', ['PR']) + + self.check("inside 'file.ext' remove 'pr1:pr2:pr3' projects", 'file.ext', ['pr1', 'pr2', 'pr3']) + + def check(self, line, filePath, expectedNames): + result = self.parser.parseLine(line) + + self.assertEqual(filePath, result['file_path']) + self.assertListEqual(expectedNames, result['names']) diff --git a/scripts/TouchinBuild/commands/RemoveProjectCommand.py b/scripts/TouchinBuild/commands/RemoveProjectCommand.py index 61ae1df..b09985d 100644 --- a/scripts/TouchinBuild/commands/RemoveProjectCommand.py +++ b/scripts/TouchinBuild/commands/RemoveProjectCommand.py @@ -3,15 +3,15 @@ from utils.SlnPatcher import SlnPatcher class RemoveProjectCommand(CommandBase): - def __init__(self, slnPath, projectName): + def __init__(self, slnPath, projectNames): CommandBase.__init__(self) assert slnPath is not None - assert projectName is not None + assert projectNames is not None self.__slnPath = slnPath - self.__projectName = projectName + self.projectNames = projectNames def execute(self): patcher = SlnPatcher(self.__slnPath) - patcher.removeProjects([self.__projectName]) + patcher.removeProjects(self.projectNames) diff --git a/scripts/TouchinBuild/parsers/InsideParser/InsideRemoveParser.py b/scripts/TouchinBuild/parsers/InsideParser/InsideRemoveParser.py index 3ec570e..a3fce6e 100644 --- a/scripts/TouchinBuild/parsers/InsideParser/InsideRemoveParser.py +++ b/scripts/TouchinBuild/parsers/InsideParser/InsideRemoveParser.py @@ -1,6 +1,7 @@ import re from parsers.InsideParser.InsideParserBase import InsideParserBase from parsers.RegexpBuilder import RegexpBuilder +from parsers.ValuesStriper import ValuesStripper class InsideRemoveParser(InsideParserBase): @@ -11,20 +12,33 @@ class InsideRemoveParser(InsideParserBase): match = self.fetchMatchFor(line) filePath = match.group('file') - projectName = match.group('project') + projectNames = match.group('projects') - return filePath, projectName + names = self.parseNames(projectNames) + result = { + 'file_path': filePath, + 'names': names + } + + return result def getMatchInfo(self, line): assert line is not None filePathRegexp = r"'(?P[./ a-zA-Z]+\.{0})'".format(self.fileExt) - projectNameRegexp = r'(?P[.a-zA-Z]+)' + projectNameRegexp = r"'(?P[^']+)'" rb = RegexpBuilder() regexpSource = rb.startsWith('inside') + filePathRegexp + rb.keywordToken('remove') + projectNameRegexp + \ - rb.spaceEndsWith('project') + rb.spaceEndsWith('project(s)?') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) - return match, regexpSource \ No newline at end of file + return match, regexpSource + + def parseNames(self, namesStr): + + vs = ValuesStripper() + names = vs.strip(namesStr) + + return names \ No newline at end of file diff --git a/scripts/TouchinBuild/parsers/InsideParser/InsideSetArrayParser.py b/scripts/TouchinBuild/parsers/InsideParser/InsideSetArrayParser.py index e133719..60ee509 100644 --- a/scripts/TouchinBuild/parsers/InsideParser/InsideSetArrayParser.py +++ b/scripts/TouchinBuild/parsers/InsideParser/InsideSetArrayParser.py @@ -1,6 +1,7 @@ import re from parsers.InsideParser.InsideParserBase import InsideParserBase from parsers.RegexpBuilder import RegexpBuilder +from parsers.ValuesStriper import ValuesStripper class InsideSetArrayParser(InsideParserBase): @@ -39,5 +40,7 @@ class InsideSetArrayParser(InsideParserBase): assert valuesStr is not None assert len(valuesStr) > 0 - values = valuesStr.split(':') + vs = ValuesStripper() + values = vs.strip(valuesStr) + return values \ No newline at end of file diff --git a/scripts/TouchinBuild/parsers/ValuesStriper.py b/scripts/TouchinBuild/parsers/ValuesStriper.py new file mode 100644 index 0000000..934cc84 --- /dev/null +++ b/scripts/TouchinBuild/parsers/ValuesStriper.py @@ -0,0 +1,11 @@ +class ValuesStripper: + def __init__(self): + pass + + def strip(self, valueStr): + assert valueStr is not None + + rawValues = valueStr.split(':') + values = [name.strip() for name in rawValues] + + return values \ No newline at end of file From 2b15ca40fbe37e709ce3b626f60ad6206c2fb612 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Thu, 14 Nov 2013 15:49:52 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B8=D0=B4=D0=BD=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildSample/BuildSample.sln | 10 ++ BuildSample/BuildSample/CoolApp.csproj | 14 ++- BuildSample/DroidApp/Assets/AboutAssets.txt | 19 +++ BuildSample/DroidApp/DroidApp.csproj | 62 ++++++++++ BuildSample/DroidApp/MainActivity.cs | 35 ++++++ .../DroidApp/Properties/AssemblyInfo.cs | 23 ++++ .../DroidApp/Resources/AboutResources.txt | 44 +++++++ .../DroidApp/Resources/Resource.designer.cs | 112 ++++++++++++++++++ .../DroidApp/Resources/drawable/Icon.png | Bin 0 -> 2574 bytes .../DroidApp/Resources/layout/Main.axml | 14 +++ .../DroidApp/Resources/values/Strings.xml | 5 + 11 files changed, 333 insertions(+), 5 deletions(-) create mode 100644 BuildSample/DroidApp/Assets/AboutAssets.txt create mode 100644 BuildSample/DroidApp/DroidApp.csproj create mode 100644 BuildSample/DroidApp/MainActivity.cs create mode 100644 BuildSample/DroidApp/Properties/AssemblyInfo.cs create mode 100644 BuildSample/DroidApp/Resources/AboutResources.txt create mode 100644 BuildSample/DroidApp/Resources/Resource.designer.cs create mode 100644 BuildSample/DroidApp/Resources/drawable/Icon.png create mode 100644 BuildSample/DroidApp/Resources/layout/Main.axml create mode 100644 BuildSample/DroidApp/Resources/values/Strings.xml diff --git a/BuildSample/BuildSample.sln b/BuildSample/BuildSample.sln index fd8c3bd..53a176c 100644 --- a/BuildSample/BuildSample.sln +++ b/BuildSample/BuildSample.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotCompileApp", "NotCompile EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csproj", "{BD5EC0A1-EDC9-4D90-BACF-AE54F26148C1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DroidApp", "DroidApp\DroidApp.csproj", "{10AA179F-818F-4E3F-947E-DE1C0C87BB76}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|iPhoneSimulator = Debug|iPhoneSimulator @@ -15,6 +17,14 @@ Global Release|iPhone = Release|iPhone 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|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 {3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhone.Build.0 = Debug|iPhone {3DE4FDFA-1502-44CF-9B73-78B6D730C59F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator diff --git a/BuildSample/BuildSample/CoolApp.csproj b/BuildSample/BuildSample/CoolApp.csproj index a1f91b8..e54c379 100644 --- a/BuildSample/BuildSample/CoolApp.csproj +++ b/BuildSample/BuildSample/CoolApp.csproj @@ -1,4 +1,4 @@ - + Debug @@ -23,7 +23,8 @@ None false true - + + ARMv7 @@ -46,7 +47,8 @@ true false iPhone Developer - + + F82B1481-F3D0-4CB5-AA6E-8B8D8E3A9DC1 true @@ -59,8 +61,10 @@ iPhone Developer: Рустам Заитов (CTL85FZX6K) false 8F606DAE-F9C9-4A19-8EFF-34B990D76C28 - - + + + + ARMv7 true diff --git a/BuildSample/DroidApp/Assets/AboutAssets.txt b/BuildSample/DroidApp/Assets/AboutAssets.txt new file mode 100644 index 0000000..a9b0638 --- /dev/null +++ b/BuildSample/DroidApp/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/BuildSample/DroidApp/DroidApp.csproj b/BuildSample/DroidApp/DroidApp.csproj new file mode 100644 index 0000000..3ec5268 --- /dev/null +++ b/BuildSample/DroidApp/DroidApp.csproj @@ -0,0 +1,62 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {10AA179F-818F-4E3F-947E-DE1C0C87BB76} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + DroidApp + True + Resources\Resource.designer.cs + Resource + Resources + Assets + True + DroidApp + v4.1 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BuildSample/DroidApp/MainActivity.cs b/BuildSample/DroidApp/MainActivity.cs new file mode 100644 index 0000000..7f30f6a --- /dev/null +++ b/BuildSample/DroidApp/MainActivity.cs @@ -0,0 +1,35 @@ +using System; +using Android.App; +using Android.Content; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; + +namespace DroidApp +{ + [Activity(Label = "DroidApp", MainLauncher = true)] + public class MainActivity : Activity + { + int count = 1; + + protected override void OnCreate(Bundle bundle) + { + base.OnCreate(bundle); + + // Set our view from the "main" layout resource + SetContentView(Resource.Layout.Main); + + // Get our button from the layout resource, + // and attach an event to it + Button button = FindViewById