Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. [<AllowNullLiteral>]
  2. type BaseiOSSpecificConfiguration() =
  3. member val BundleIdentifier = "" with get,set
  4. member val iTunesAppId = "" with get,set
  5. member val iTunesConnectUsername = "" with get,set
  6. member val iTunesConnectPassword = "" with get,set
  7.  
  8. [<AllowNullLiteral>]
  9. type BaseAndroidSpecificConfiguration() =
  10. member val BundleIdentifier = "" with get,set
  11. member val AndroidKeystorePath = "" with get,set
  12. member val AndroidKeystorePassword = "" with get,set
  13. member val AndroidKeystoreAlias = "" with get,set
  14. member val DropboxFolderPath = "" with get,set
  15.  
  16. type iOSSpecificConfigurations() =
  17. member val DevConfiguration = new BaseiOSSpecificConfiguration() with get,set
  18. member val DemoConfiguration = new BaseiOSSpecificConfiguration() with get,set
  19. member val ReleaseConfiguration = new BaseiOSSpecificConfiguration() with get,set
  20.  
  21. type AndroidSpecificConfigurations() =
  22. member val DevConfiguration = new BaseAndroidSpecificConfiguration() with get,set
  23. member val DemoConfiguration = new BaseAndroidSpecificConfiguration() with get,set
  24. member val ReleaseConfiguration = new BaseAndroidSpecificConfiguration() with get,set
  25.  
  26. [<AllowNullLiteral>]
  27. type Configuration() =
  28. member val SolutionFileName = "" with get,set
  29. member val ProjectFolderPath = "" with get,set
  30. member val ProjectFileName = "" with get,set
  31. member val CoreProjectFolderPath = "" with get,set
  32. member val CoreProjectFileName = "" with get,set
  33. member val iOSSpecificConfigurations = new iOSSpecificConfigurations() with get,set
  34. member val AndroidSpecificConfigurations = new AndroidSpecificConfigurations() with get,set
  35.  
  36. let ParseBuildConfigurations filePath : Configuration =
  37. let file = new FileStream(filePath, FileMode.Open, FileAccess.Read)
  38. let stream = new StreamReader(file)
  39. let deserializer = new Deserializer(namingConvention = new CamelCaseNamingConvention())
  40. let configuration = deserializer.Deserialize<Configuration>(stream)
  41. stream.Close()
  42. file.Close()
  43. configuration
  44.  
  45. let DetermineAndroidSpecificConfiguration (buildConfigurationName : string) (configuration : Configuration) : BaseAndroidSpecificConfiguration =
  46. match buildConfigurationName.ToLowerInvariant() with
  47. | "dev" -> configuration.AndroidSpecificConfigurations.DevConfiguration
  48. | "demo" -> configuration.AndroidSpecificConfigurations.DemoConfiguration
  49. | "release" -> configuration.AndroidSpecificConfigurations.ReleaseConfiguration
  50. | _ -> null
  51.  
  52.  
  53. let DetermineiOSSpecificConfiguration (buildConfigurationName : string) (configuration : Configuration) : BaseiOSSpecificConfiguration =
  54. match buildConfigurationName.ToLowerInvariant() with
  55. | "dev" -> configuration.iOSSpecificConfigurations.DevConfiguration
  56. | "demo" -> configuration.iOSSpecificConfigurations.DemoConfiguration
  57. | "release" -> configuration.iOSSpecificConfigurations.ReleaseConfiguration
  58. | _ -> null
  59.  
  60. let DetermineBuildConfigurationName (buildBranch : string) : string =
  61. let lowered = buildBranch.ToLowerInvariant()
  62. match lowered with
  63. | "development" -> "Dev"
  64. | "master" -> "Release"
  65. | lowered when lowered.StartsWith("release/") -> "Demo"
  66. | lowered when lowered.StartsWith("feature/") -> "Dev"
  67. | lowered when lowered.StartsWith("hotfix/") -> "Dev"
  68. | _ -> ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement