From b3655673d464095558e92539ee0d7d52e72c243f Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:15:57 +0400 Subject: [PATCH 1/5] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D1=80=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D1=83=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/parser/InstallProfileParser.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/parser/InstallProfileParser.py diff --git a/scripts/parser/InstallProfileParser.py b/scripts/parser/InstallProfileParser.py new file mode 100644 index 0000000..2075bb3 --- /dev/null +++ b/scripts/parser/InstallProfileParser.py @@ -0,0 +1,34 @@ +import re +import os +from parser.CopyParser.CopyArguments import CopyArguments +from parser.LineParser import LineParser + + +class InstallProfileParser(LineParser): + def __init__(self): + LineParser.__init__(self) + self.__copyArguments = CopyArguments() + self.__profileStorageDir = '~/Library/MobileDevice/Provisioning Profiles/' + + def parseLine(self, line): + assert line is not None + + profilePathRegexp = r"'(?P[^']+)'$" + regexpSource = self.startsWith('install') + self.than('profile') + profilePathRegexp + + regexp = re.compile(regexpSource, re.UNICODE) + + match = regexp.match(line) + self._guardMatch(match, line, regexpSource) + + srcPath = match.group('path') + dstPath = self.getDestinationPath(srcPath) + + self.__copyArguments.setArguments(srcPath, dstPath) + return self.__copyArguments + + def getDestinationPath(self, sourcePath): + profileFileName = os.path.basename(sourcePath) + destination = os.path.join(self.__profileStorageDir, profileFileName) + + return destination \ No newline at end of file From 97c3e2a953d9da3507dc958c1d52965fda3186b2 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:20:55 +0400 Subject: [PATCH 2/5] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D1=81=D0=B5=D1=80=D0=B0=20=D1=83=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Tests/UnitTests/InstallProfile/__init__.py | 1 + .../InstallProfile/test_installProfile.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 scripts/Tests/UnitTests/InstallProfile/__init__.py create mode 100644 scripts/Tests/UnitTests/InstallProfile/test_installProfile.py diff --git a/scripts/Tests/UnitTests/InstallProfile/__init__.py b/scripts/Tests/UnitTests/InstallProfile/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/Tests/UnitTests/InstallProfile/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov' diff --git a/scripts/Tests/UnitTests/InstallProfile/test_installProfile.py b/scripts/Tests/UnitTests/InstallProfile/test_installProfile.py new file mode 100644 index 0000000..56d0631 --- /dev/null +++ b/scripts/Tests/UnitTests/InstallProfile/test_installProfile.py @@ -0,0 +1,14 @@ +import unittest +from parser.InstallProfileParser import InstallProfileParser + + +class TestInstallProfile(unittest.TestCase): + def setUp(self): + self.parser = InstallProfileParser() + + def test_parse(self): + line = "install profile 'Path/To/Profile.mobileprovision'" + copyArgs = self.parser.parseLine(line) + + self.assertEqual('Path/To/Profile.mobileprovision', copyArgs.source) + self.assertEqual('~/Library/MobileDevice/Provisioning Profiles/Profile.mobileprovision', copyArgs.target) \ No newline at end of file From 560274e2207d9561cd88e39a62adafa3d7231d72 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:26:36 +0400 Subject: [PATCH 3/5] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B1=D0=B8=D0=BB=D0=B4=D0=B5=D1=80=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D1=83=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=84?= =?UTF-8?q?=D0=B8=D0=BB=D1=8F=20=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InstallProfileCommandBuilder.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/CommandBuilders/InstallProfileCommandBuilder.py diff --git a/scripts/CommandBuilders/InstallProfileCommandBuilder.py b/scripts/CommandBuilders/InstallProfileCommandBuilder.py new file mode 100644 index 0000000..f477259 --- /dev/null +++ b/scripts/CommandBuilders/InstallProfileCommandBuilder.py @@ -0,0 +1,21 @@ +from commands.CopyCommand import CopyCommand +from parser.InstallProfileParser import InstallProfileParser + + +class InstallProfileCommandBuilder: + def __init__(self): + pass + + def isInstallProfile(self, line): + assert line is not None + + return line.startswith('install profile') + + def getCommandFor(self, line): + assert line is not None + + parser = InstallProfileParser() + cpArgs = parser.parseLine(line) + + command = CopyCommand(cpArgs) + return command From f190a0fc0db2bcf4e5789d0c58ce368e42f17224 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:30:45 +0400 Subject: [PATCH 4/5] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=20=D1=80=D1=83=D1=87=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=84=D0=B8=D0=BB=D1=8F=20=D0=BE=D0=B1=D0=B5=D1=81=D0=BF=D0=B5?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Tests/ManualTests/install_profile.py | 8 ++++++++ scripts/run_manual_tests.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 scripts/Tests/ManualTests/install_profile.py diff --git a/scripts/Tests/ManualTests/install_profile.py b/scripts/Tests/ManualTests/install_profile.py new file mode 100644 index 0000000..1f588f6 --- /dev/null +++ b/scripts/Tests/ManualTests/install_profile.py @@ -0,0 +1,8 @@ +from CommandBuilders.InstallProfileCommandBuilder import InstallProfileCommandBuilder + +line = "install profile 'BuildSample/BuildSample/Profiles/8F606DAE-F9C9-4A19-8EFF-34B990D76C28.mobileprovision'" + +builder = InstallProfileCommandBuilder() +command = builder.getCommandFor(line) + +command.execute() \ No newline at end of file diff --git a/scripts/run_manual_tests.py b/scripts/run_manual_tests.py index e4f2173..48d8410 100644 --- a/scripts/run_manual_tests.py +++ b/scripts/run_manual_tests.py @@ -18,5 +18,6 @@ os.chdir(baseDir) #import ManualTests.remove_project #import ManualTests.infoplist_test #import ManualTests.clean_test -import Tests.ManualTests.testflight_test +#import Tests.ManualTests.testflight_test +import Tests.ManualTests.install_profile From 41be91a094f6ef4274d2fa84141073cacf2f3d5a Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 5 Nov 2013 16:37:15 +0400 Subject: [PATCH 5/5] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20?= =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F=20=D0=BE=D0=B1=D0=B5=D1=81?= =?UTF-8?q?=D0=BF=D0=B5=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Core/StepsRunner.py | 4 ++++ scripts/IosSteps.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/Core/StepsRunner.py b/scripts/Core/StepsRunner.py index 806061f..9643fe4 100644 --- a/scripts/Core/StepsRunner.py +++ b/scripts/Core/StepsRunner.py @@ -2,6 +2,7 @@ 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.PatchInfoplistCommandBuilder import PatchInfoplistCommandBuilder @@ -30,6 +31,7 @@ class StepsRunner: self.patchInfoPlist = PatchInfoplistCommandBuilder(self.valueProvider) self.copyBuilder = CopyCommandBuilder() self.testflightBuilder = TestflightCommandBuilder() + self.installProfileBuilder = InstallProfileCommandBuilder() buildUtilPath = config['build_tool'] self.cleanBuilder = CleanBuildCommandBuilder(buildUtilPath, 'clean') @@ -72,6 +74,8 @@ class StepsRunner: cmd =self.deleteBackupBuilder.getCommandFor(line) elif self.testflightBuilder.isTestflight(line): cmd = self.testflightBuilder.getCommandFor(line) + elif self.installProfileBuilder.isInstallProfile(line): + cmd = self.installProfileBuilder.getCommandFor(line) else: msg = "unrecognised step. Line: '{0}'".format(line) raise Exception(msg) diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index 3e80964..eb5b620 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -10,7 +10,7 @@ inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output' inside 'BuildSample/BuildSample/Info.plist' set CFBundleVersion to '{@version}' inside 'BuildSample/BuildSample/Info.plist' set CFBundleDisplayName to 'CoolApp' -copy 'BuildSample/BuildSample/Profiles/8F606DAE-F9C9-4A19-8EFF-34B990D76C28.mobileprovision' to '~/Library/MobileDevice/Provisioning Profiles/BuildScript.mobileprovision' +install profile 'BuildSample/BuildSample/Profiles/8F606DAE-F9C9-4A19-8EFF-34B990D76C28.mobileprovision' clean 'BuildSample/BuildSample.sln' for '{@sln_config}' build 'BuildSample/BuildSample.sln' for '{@sln_config}'