Merge pull request #312 from tuist/fix-309

Check to see if contents.xcworkspacedata exists before writing
This commit is contained in:
Oliver Atkinson 2019-03-30 12:05:27 +00:00 committed by GitHub
commit 14f99d2f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -27,6 +27,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
- Fix Header & Framework search paths override project or xcconfig settings https://github.com/tuist/tuist/pull/301 by @ollieatkinson
- Unit tests bundle for an app target compile & run https://github.com/tuist/tuist/pull/300 by @ollieatkinson
- `LIBRARY_SEARCH_PATHS` and `SWIFT_INCLUDE_PATHS` are now set https://github.com/tuist/tuist/pull/308 by @kwridan
- Fix Generation fails in the event an empty .xcworkspace directory exists https://github.com/tuist/tuist/pull/312 by @ollieatkinson
## 0.12.0

View File

@ -118,7 +118,7 @@ final class WorkspaceGenerator: WorkspaceGenerating {
private func write(xcworkspace: XCWorkspace, to: AbsolutePath) throws {
// If the workspace doesn't exist we can write it because there isn't any
// Xcode instance that might depend on it.
if !fileHandler.exists(to) {
if !fileHandler.exists(to.appending(component: "contents.xcworkspacedata")) {
try xcworkspace.write(path: to.path)
return
}

View File

@ -69,6 +69,24 @@ final class WorkspaceGeneratorTests: XCTestCase {
])
}
func test_generate_workspaceStructure_noWorkspaceData() throws {
let name = "test"
// Given
try fileHandler.createFolder(fileHandler.currentPath.appending(component: "\(name).xcworkspace"))
let graph = Graph.test(entryPath: path)
let workspace = Workspace.test(name: name)
// When
XCTAssertNoThrow(
try subject.generate(workspace: workspace,
path: path,
graph: graph,
options: GenerationOptions())
)
}
func test_generate_workspaceStructureWithProjects() throws {
// Given
let target = anyTarget()