summaryrefslogtreecommitdiff
path: root/render-test/ios/codesigning/generate-entitlements.swift
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2020-01-21 23:23:35 +0200
committerGitHub <noreply@github.com>2020-01-21 23:23:35 +0200
commit1ade6c77849aec2c8486a568720258547aa1d670 (patch)
tree4c2dc4cf31f24aa6df15716265858cc6e1859fdc /render-test/ios/codesigning/generate-entitlements.swift
parent6dc435f66465eff76e730053d80efae90fa249c5 (diff)
downloadqtlocation-mapboxgl-1ade6c77849aec2c8486a568720258547aa1d670.tar.gz
[test-runner] Enable IOS RenderTestRunner and run it on Firebase (#16111)
* [test-runner] Setup iOS RenderTestRunner * [test-runner] Make app runnable on firebase * Add iOS platform dependent expectation and ignores; Run prepare script via cmake * Make RenderTestRunner report test status
Diffstat (limited to 'render-test/ios/codesigning/generate-entitlements.swift')
-rwxr-xr-xrender-test/ios/codesigning/generate-entitlements.swift40
1 files changed, 40 insertions, 0 deletions
diff --git a/render-test/ios/codesigning/generate-entitlements.swift b/render-test/ios/codesigning/generate-entitlements.swift
new file mode 100755
index 0000000000..83834483bf
--- /dev/null
+++ b/render-test/ios/codesigning/generate-entitlements.swift
@@ -0,0 +1,40 @@
+#!/usr/bin/swift
+
+/// Generates Entitlement files .xcent for codesigning, containing the correct team id
+import Swift
+import Foundation
+
+let fileManager = FileManager.default
+
+let contentsOfCurrentWorkingDirectory = try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "./codesigning/"), includingPropertiesForKeys: nil, options: [])
+
+guard let rawTeamIdEnv = getenv("IOS_DEVELOPMENT_TEAM") else {
+ print("Please add a IOS_DEVELOPMENT_TEAM environment variable.")
+ exit(1)
+}
+
+let teamId2 = String(utf8String: rawTeamIdEnv)
+
+for file in contentsOfCurrentWorkingDirectory {
+ if (file.pathExtension == "template") {
+ var content = ""
+ do {
+ content = try String(contentsOf: file, encoding: .utf8)
+ }
+ catch {
+ print("Error reading xcent file: \(error).")
+ }
+
+ content = content.replacingOccurrences(of: "$TEAM_ID", with: teamId2!)
+
+ var targetFile = file
+ targetFile.deletePathExtension()
+ do {
+ try content.write(to: targetFile, atomically: false, encoding: .utf8)
+ print("Entitlement " + targetFile.absoluteString + " generated.")
+ }
+ catch {
+ print("Error writing xcent file: \(error).")
+ }
+ }
+} \ No newline at end of file