Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
chore: update gradle file
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Umer committed Aug 16, 2023
1 parent bce8e4d commit eeaa300
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Test/SnapshotTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SnapshotTestCase : FBSnapshotTestCase {
// Standardize on a size so we don't have to worry about different simulators
// etc.
// Pick a non standard width so we can catch width assumptions.
return CGSize(width: 375, height: 667)
return CGSize(width: 390, height: 844)
}

fileprivate var majorVersion : Int {
Expand Down
34 changes: 30 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import com.dd.plist.*
import org.edx.builder.TaskHelper

Expand Down Expand Up @@ -256,11 +257,36 @@ wrapper {
gradleVersion = '6.3'
}

def getSimulatorUDID(deviceName, osVersion) {
def output = ["xcrun", "simctl", "list", "devices"].execute().text
println output
def lines = output.split('\n')
def osFound = false

for (line in lines) {
if (line.contains("-- iOS $osVersion --")) {
osFound = true
} else if (osFound && line.contains(deviceName)) {
def match = line =~ /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/
if (match) {
return match[0][0]
}
}
}

return null
}

def testBuildArguments(workspace, scheme, OS, record) {
def deviceName = OS.startsWith("16") ? "iPhone 14 Pro" : "iPhone 13 Pro"
def udid = getSimulatorUDID(deviceName, OS)

def args = [
'xcodebuild', '-workspace', workspace, '-scheme', scheme, '-sdk', 'iphonesimulator', '-destination', 'platform=iOS Simulator,name=iPhone 8,OS=' + OS, 'test'
'xcodebuild', '-workspace', workspace, '-scheme', scheme, '-sdk', 'iphonesimulator',
'-destination', "id=$udid", 'test'
]
if(record) {

if (record) {
args += ["OTHER_SWIFT_FLAGS=\$(OTHER_SWIFT_FLAGS) -D RECORD_SNAPSHOTS"]
}
return args
Expand All @@ -270,7 +296,7 @@ def RTLSchemeForScheme(scheme) {
return scheme + '-RTL'
}

def operatingSystems = ["currentOS": "15.2", "previousOS": "14.4"]
def operatingSystems = ["currentOS": "16.4", "previousOS": "15.5"]
def directions = ["LTR": scheme, "RTL": RTLSchemeForScheme(scheme)]
def commands = ["test" : ["record" : false], "recordSnapshots": ["record" : true]]

Expand All @@ -287,4 +313,4 @@ for(OS in operatingSystems) {


task test(dependsOn: tasks.findAll { task -> task.name.startsWith('test')}) {}
task recordSnapshots(dependsOn: tasks.findAll { task -> task.name.startsWith('recordSnapshots')}) {}
task recordSnapshots(dependsOn: tasks.findAll { task -> task.name.startsWith('recordSnapshots')}) {}

0 comments on commit eeaa300

Please sign in to comment.