diff --git a/scripts/AndroidSteps.txt b/scripts/AndroidSteps.txt index 0bbd163..a421d0c 100644 --- a/scripts/AndroidSteps.txt +++ b/scripts/AndroidSteps.txt @@ -1,7 +1,19 @@ +restore from backup +create backup + inside 'BuildSample/BuildSample.sln' remove 'CoolApp:NotCompileApp:Domain' project +inside 'BuildSample/DroidApp/DroidApp.csproj' set OutputPath to 'Output' for '{@sln_config}' + inside 'BuildSample/DroidApp/Properties/AndroidManifest.xml' set android:versionCode to '17' inside 'BuildSample/DroidApp/Properties/AndroidManifest.xml' set android:versionName to '1.2.3' clean 'BuildSample/BuildSample.sln' for '{@sln_config}' -sign android 'BuildSample/BuildSample.sln' for '{@sln_config}' project 'DroidApp' +sign android 'BuildSample/BuildSample.sln' for '{@sln_config_build}' project 'DroidApp' + +create dirs 'Output/GooglePlay/Artifacts' +sh cp BuildSample/DroidApp/Output/*.apk Output/GooglePlay/Artifacts +sh cp -a BuildSample/DroidApp/Output/ Output/GooglePlay/ + +restore from backup +delete backup diff --git a/scripts/IosSetupSteps.txt b/scripts/IosSetupSteps.txt index 08eaf5d..c825961 100644 --- a/scripts/IosSetupSteps.txt +++ b/scripts/IosSetupSteps.txt @@ -1,7 +1,7 @@ -# restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) -# create backup +restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) +create backup -sh echo '{@sln_config}' +sh echo 'Hello from setup.txt' inside 'BuildSample/BuildSample.sln' remove 'NotCompileApp:DroidApp' project diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index 72b4dff..09d6afe 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -7,7 +7,7 @@ create dirs 'Output/Appstore/Artifacts' copy 'BuildSample/BuildSample/Output/{@assembly_name}-{@version}.ipa' to 'Output/Appstore/Artifacts' sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/ -publish 'Output/Appstore/Artifacts/{@assembly_name}-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}' +#publish 'Output/Appstore/Artifacts/{@assembly_name}-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}' -#restore from backup -#delete backup \ No newline at end of file +restore from backup +delete backup \ No newline at end of file diff --git a/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/BaseBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/BaseBackupCommandBuilder.py new file mode 100644 index 0000000..ca2954a --- /dev/null +++ b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/BaseBackupCommandBuilder.py @@ -0,0 +1,12 @@ +from parsers.ValuesStriper import ValuesStripper + + +class BaseBackupCommandBuilder: + def __init__(self, ignoreBackupStr): + + if ignoreBackupStr: + splitter = ValuesStripper(',') + values = splitter.strip(ignoreBackupStr) + self.ignoreBackup = values + else: + self.ignoreBackup = [] \ No newline at end of file diff --git a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/CreateBackupCommandBuilder.py similarity index 57% rename from scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py rename to scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/CreateBackupCommandBuilder.py index 5bd0bd3..1921940 100644 --- a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/CreateBackupCommandBuilder.py @@ -1,10 +1,11 @@ +from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder from commands.BaseBackupCommand.CreateBackupCommand import CreateBackupCommand from parsers.ParserBackup.CreateBackupParser import CreateBackupParser -class CreateBackupCommandBuilder: - def __init__(self): - pass +class CreateBackupCommandBuilder(BaseBackupCommandBuilder): + def __init__(self, ignoreBackupStr): + BaseBackupCommandBuilder.__init__(self, ignoreBackupStr) def isCreateBackup(self, line): assert line is not None @@ -18,5 +19,5 @@ class CreateBackupCommandBuilder: parser = CreateBackupParser() parser.parseLine(line) - command = CreateBackupCommand() + command = CreateBackupCommand(self.ignoreBackup) return command diff --git a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/DeleteBackupCommandBuilder.py similarity index 58% rename from scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py rename to scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/DeleteBackupCommandBuilder.py index 53e9238..2e3ea3a 100644 --- a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/DeleteBackupCommandBuilder.py @@ -1,10 +1,11 @@ +from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder from commands.BaseBackupCommand.DeleteBackupCommand import DeleteBackupCommand from parsers.ParserBackup.DeleteBackupParser import DeleteBackupParser -class DeleteBackupCommandBuilder: - def __init__(self): - pass +class DeleteBackupCommandBuilder(BaseBackupCommandBuilder): + def __init__(self, ignoreBackupStr): + BaseBackupCommandBuilder.__init__(self, ignoreBackupStr) def isDeleteBackup(self, line): assert line is not None @@ -20,5 +21,5 @@ class DeleteBackupCommandBuilder: parser = DeleteBackupParser() parser.parseLine(line) - command = DeleteBackupCommand() + command = DeleteBackupCommand(self.ignoreBackup) return command diff --git a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/RestoreBackupCommandBuilder.py similarity index 58% rename from scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py rename to scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/RestoreBackupCommandBuilder.py index 0f391a1..29c459f 100644 --- a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/RestoreBackupCommandBuilder.py @@ -1,10 +1,11 @@ +from CommandBuilders.BuilderBackupCommands.BaseBackupCommandBuilder import BaseBackupCommandBuilder from commands.BaseBackupCommand.RestoreBackupCommand import RestoreBackupCommand from parsers.ParserBackup.RestoreBackupParser import RestoreBackupParser -class RestoreBackupCommandBuilder: - def __init__(self): - pass +class RestoreBackupCommandBuilder(BaseBackupCommandBuilder): + def __init__(self, ignoreBackupStr): + BaseBackupCommandBuilder.__init__(self, ignoreBackupStr) def isRestoreBackup(self, line): assert line is not None @@ -20,5 +21,5 @@ class RestoreBackupCommandBuilder: parser = RestoreBackupParser() parser.parseLine(line) - command = RestoreBackupCommand() + command = RestoreBackupCommand(self.ignoreBackup) return command diff --git a/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/__init__.py b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/TouchinBuild/CommandBuilders/BuilderBackupCommands/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov' diff --git a/scripts/TouchinBuild/Core/StepsRunner.py b/scripts/TouchinBuild/Core/StepsRunner.py index fefce63..364d5a7 100644 --- a/scripts/TouchinBuild/Core/StepsRunner.py +++ b/scripts/TouchinBuild/Core/StepsRunner.py @@ -1,7 +1,9 @@ +from CommandBuilders.BuilderBackupCommands.CreateBackupCommandBuilder import CreateBackupCommandBuilder +from CommandBuilders.BuilderBackupCommands.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder +from CommandBuilders.BuilderBackupCommands.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder + 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 @@ -9,7 +11,6 @@ from CommandBuilders.PatchInfoPlistArrayCommandBuilder import PatchInfoPlistArra from CommandBuilders.PatchInfoplistCommandBuilder import PatchInfoplistCommandBuilder from CommandBuilders.PatchManifestCommandBuilder import PatchManifestCommandBuilder from CommandBuilders.RemoveProjectCommandBuilder import RemoveProjectCommandBuilder -from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder from CommandBuilders.ShCommandBuilder import ShCommandBuilder from CommandBuilders.SignApkBuilder import SignApkCommandBuilder from CommandBuilders.TestflightCommandBuilder import TestflightCommandBuilder @@ -26,9 +27,6 @@ class StepsRunner: self.shCommandBuilder = ShCommandBuilder() self.removeProjectBuilder = RemoveProjectCommandBuilder() - self.createBackupBuilder = CreateBackupCommandBuilder() - self.restoreFromBackupBuilder = RestoreBackupCommandBuilder() - self.deleteBackupBuilder = DeleteBackupCommandBuilder() self.createDirs = MakeDirsCommandBuilder() self.patchCsproj = PatchCsprojCommandBuilder() self.patchInfoPlist = PatchInfoplistCommandBuilder(self.valueProvider) @@ -37,6 +35,12 @@ class StepsRunner: self.copyBuilder = CopyCommandBuilder() self.testflightBuilder = TestflightCommandBuilder() + ignoreBackup = config.get('backup_ignore', None) + self.createBackupBuilder = CreateBackupCommandBuilder(ignoreBackup) + self.restoreFromBackupBuilder = RestoreBackupCommandBuilder(ignoreBackup) + self.deleteBackupBuilder = DeleteBackupCommandBuilder(ignoreBackup) + + profilePrefix = config['project_name'] self.installProfileBuilder = InstallProfileCommandBuilder(profilePrefix) diff --git a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py index c770259..676da36 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py @@ -1,8 +1,8 @@ -from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder +from CommandBuilders.BuilderBackupCommands.CreateBackupCommandBuilder import CreateBackupCommandBuilder line = "create backup" -cmdBuilder = CreateBackupCommandBuilder() +cmdBuilder = CreateBackupCommandBuilder(None) command = cmdBuilder.getCommandFor(line) command.execute() \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py index 4c312c4..a885c7d 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py @@ -1,8 +1,8 @@ -from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder +from CommandBuilders.BuilderBackupCommands.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder line = "delete backup" -cmdBuilder = DeleteBackupCommandBuilder() +cmdBuilder = DeleteBackupCommandBuilder(None) command = cmdBuilder.getCommandFor(line) command.execute() \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py index a61e390..33d3a6f 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py @@ -1,8 +1,8 @@ -from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder +from CommandBuilders.BuilderBackupCommands.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder line = "restore from backup" -builder = RestoreBackupCommandBuilder() +builder = RestoreBackupCommandBuilder(None) command = builder.getCommandFor(line) command.execute() diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index aba3acc..da0ac3e 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -4,8 +4,14 @@ from commands.CommandBase import CommandBase class BaseBackupCommand(CommandBase): - def __init__(self): + def __init__(self, ignoreBackup): CommandBase.__init__(self) + + assert ignoreBackup is not None + + self.backupIgnore = ['.git', '.gitignore', '.DS_Store', 'backup'] + self.backupIgnore.extend(ignoreBackup) + self.folderPath = '.' # вычислять абсолютные пути надо на этапе создания комманды @@ -13,7 +19,6 @@ class BaseBackupCommand(CommandBase): self.srcAbsDirPath = self.getAbsSrc() self.backupDirAbsPath = self.getAbsDst() - self.backupIgnore = ['.git', '.gitignore', '.DS_Store', 'backup'] def getAbsSrc(self): return self.getAbs(self.folderPath) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index cb559dd..1906257 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class CreateBackupCommand(BaseBackupCommand): - def __init__(self): - BaseBackupCommand.__init__(self) + def __init__(self, ignoreBackup): + BaseBackupCommand.__init__(self, ignoreBackup) def execute(self): #if os.path.exists(self.backupDirAbsPath): diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py index c29f5ce..660240b 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class DeleteBackupCommand(BaseBackupCommand): - def __init__(self): - BaseBackupCommand.__init__(self) + def __init__(self, ignoreBackup): + BaseBackupCommand.__init__(self, ignoreBackup) def execute(self): if not os.path.exists(self.backupDirAbsPath): diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index 403d5f7..15faf3b 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -4,8 +4,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class RestoreBackupCommand(BaseBackupCommand): - def __init__(self): - BaseBackupCommand.__init__(self) + def __init__(self, ignoreBackup): + BaseBackupCommand.__init__(self, ignoreBackup) def execute(self): if not os.path.exists(self.backupDirAbsPath): diff --git a/scripts/TouchinBuild/commands/CleanBuildCommands/SignApkCommand.py b/scripts/TouchinBuild/commands/CleanBuildCommands/SignApkCommand.py index 9914f75..501852a 100644 --- a/scripts/TouchinBuild/commands/CleanBuildCommands/SignApkCommand.py +++ b/scripts/TouchinBuild/commands/CleanBuildCommands/SignApkCommand.py @@ -19,4 +19,5 @@ class SignApkCommand(ShellCommandBase): def execute(self): cmdText = self.commandPattern.format(self.pathToBuildUtil, self.slnConfig, self.projectName, self.slnPath) + print cmdText self.executeShell(cmdText) diff --git a/scripts/TouchinBuild/parsers/ValuesStriper.py b/scripts/TouchinBuild/parsers/ValuesStriper.py index 934cc84..7be6574 100644 --- a/scripts/TouchinBuild/parsers/ValuesStriper.py +++ b/scripts/TouchinBuild/parsers/ValuesStriper.py @@ -1,11 +1,13 @@ class ValuesStripper: - def __init__(self): - pass + def __init__(self, separator=':'): + assert separator is not None + + self.separator = separator def strip(self, valueStr): assert valueStr is not None - rawValues = valueStr.split(':') + rawValues = valueStr.split(self.separator) values = [name.strip() for name in rawValues] return values \ No newline at end of file diff --git a/scripts/settings.txt b/scripts/settings.txt index fe7c0cd..9c52061 100644 --- a/scripts/settings.txt +++ b/scripts/settings.txt @@ -1,12 +1,13 @@ # global settings build_tool='/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool' version=0.0.0 # комментарий в тойже строке -configs = 'appstore, staging, android' +configs = 'appstore' project_name = CoolApp -sln_config = Release|iPhone +backup_ignore = .git, .gitignore, .DS_Store, backup, Output, scripts # ios platform settings -#ios.steps = 'scripts/IosSteps.txt' +ios.steps = scripts/IosSteps.txt +ios.sln_config = Release|iPhone ios.setup_steps = 'IosSetupSteps.txt' ios.assembly_name = 'CoolApp' @@ -14,6 +15,8 @@ ios.tf_api_token = '0e6925075d4fc10fed0e7bbf43fa6894_NjQ0OTI2MjAxMi0wOS0yNSAxMTo ios.tf_team_token = 'c5c3cf7a6dae2bea4382dfbd181a2075_Mjc4ODkwMjAxMy0wOS0yOSAxNDowOTo1OC40Mzg5MTY' # android platform settings +android.sln_config = Release|AnyCPU +android.sln_config_build = Release android.steps = 'scripts/AndroidSteps.txt' # config settings