mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
check fixtures using git diff
This commit is contained in:
+13
-7
@@ -12,11 +12,14 @@ jobs:
|
||||
name: Test
|
||||
command: swift test 2>&1 | xcpretty
|
||||
- run:
|
||||
name: Build release
|
||||
command: make build
|
||||
name: Check Project Diff
|
||||
command: ./diff-fixtures.sh
|
||||
- run:
|
||||
name: Build Test Project
|
||||
command: ./build-fixtures.sh
|
||||
- run:
|
||||
name: Build release
|
||||
command: make build
|
||||
macOS_swift_4.2:
|
||||
macos:
|
||||
xcode: "10.0.0"
|
||||
@@ -25,16 +28,19 @@ jobs:
|
||||
- run:
|
||||
name: Build
|
||||
command: swift build
|
||||
- run:
|
||||
name: Test
|
||||
command: swift test 2>&1 | xcpretty
|
||||
# disabled till UUID's are stable
|
||||
# - run:
|
||||
# name: Test
|
||||
# command: swift test 2>&1 | xcpretty
|
||||
- run:
|
||||
name: Build release
|
||||
command: make build
|
||||
# name: Check Project Diff
|
||||
# command: ./diff-fixtures.sh
|
||||
- run:
|
||||
name: Build Test Project
|
||||
command: ./build-fixtures.sh
|
||||
- run:
|
||||
name: Build release
|
||||
command: make build
|
||||
workflows:
|
||||
version: 2
|
||||
workflow:
|
||||
|
||||
@@ -62,21 +62,7 @@ fileprivate func generateXcodeProject(specPath: Path, projectPath: Path, file: S
|
||||
let project = try Project(path: specPath)
|
||||
let generator = ProjectGenerator(project: project)
|
||||
let xcodeProject = try generator.generateXcodeProject()
|
||||
let oldProject = try XcodeProj(path: projectPath)
|
||||
let pbxProjPath = projectPath + XcodeProj.pbxprojPath(projectPath)
|
||||
let oldProjectString: String = try pbxProjPath.read()
|
||||
try xcodeProject.write(path: projectPath, override: true)
|
||||
let newProjectString: String = try pbxProjPath.read()
|
||||
|
||||
let newProject = try XcodeProj(path: projectPath)
|
||||
let stringDiff = newProjectString != oldProjectString
|
||||
if newProject != oldProject || stringDiff {
|
||||
var message = "\(projectPath.string) has changed. If change is legitimate commit the change and run test again"
|
||||
if stringDiff {
|
||||
message += ":\n\n\(pbxProjPath):\n\(prettyFirstDifferenceBetweenStrings(oldProjectString, newProjectString))"
|
||||
}
|
||||
throw failure(message, file: file, line: line)
|
||||
}
|
||||
|
||||
return newProject
|
||||
return xcodeProject
|
||||
}
|
||||
|
||||
@@ -733,15 +733,14 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
}
|
||||
let buildPhases = nativeTarget.buildPhases
|
||||
|
||||
let scripts = pbxProject.objects.shellScriptBuildPhases.objectReferences
|
||||
let script1 = scripts[0]
|
||||
let script2 = scripts[1]
|
||||
try expect(scripts.count) == 2
|
||||
try expect(buildPhases.first) == script1.reference
|
||||
try expect(buildPhases.last) == script2.reference
|
||||
let scripts = pbxProject.objects.shellScriptBuildPhases
|
||||
let script1 = scripts.first { $0.value.shellScript == "script1" }
|
||||
let script2 = scripts.first { $0.value.shellScript == "script2" }
|
||||
|
||||
try expect(script1.object.shellScript) == "script1"
|
||||
try expect(script2.object.shellScript) == "script2"
|
||||
try expect(scripts.count) == 2
|
||||
|
||||
try expect(buildPhases.first) == script1?.key
|
||||
try expect(buildPhases.last) == script2?.key
|
||||
}
|
||||
|
||||
$0.it("generates targets with cylical dependencies") {
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [[ `git status --porcelain Tests/Fixtures/TestProject` ]]; then
|
||||
echo ""
|
||||
echo "⚠️ Generated TestProject has changed."
|
||||
echo "⚠️ If this is a valid change please run the tests and commit the updated TestProject."
|
||||
echo ""
|
||||
git --no-pager diff --color=always Tests/Fixtures/TestProject
|
||||
exit 1
|
||||
else
|
||||
echo "✅ Generated TestProject has not changed."
|
||||
fi
|
||||
Reference in New Issue
Block a user