Do Not Create `Derived/InfoPlists` Folder When No InfoPlist Dictionary Specified (#456)

* fix and test case

* make info plist inclusion explicit

* swiftformat and changelog
This commit is contained in:
Adam Khazi 2019-07-24 08:58:37 +01:00 committed by Pedro Piñera Buendía
parent 587948266c
commit bd1897a947
3 changed files with 19 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
- Ensuring transitive SDK dependencies are added correctly https://github.com/tuist/tuist/pull/441 by @adamkhazi
- Ensuring the correct platform SDK dependencies path is set https://github.com/tuist/tuist/pull/419 by @kwridan
- Update manifest target name such that its product has a valid name https://github.com/tuist/tuist/pull/426 by @kwridan
- Do not create `Derived/InfoPlists` folder when no InfoPlist dictionary is specified https://github.com/tuist/tuist/pull/456 by @adamkhazi
### Changed

View File

@ -70,7 +70,7 @@ final class DerivedFileGenerator: DerivedFileGenerating {
}
let toDelete = Set(existing).subtracting(new)
if !fileHandler.exists(infoPlistsPath) {
if !fileHandler.exists(infoPlistsPath), !targetsWithGeneratableInfoPlists.isEmpty {
try fileHandler.createFolder(infoPlistsPath)
}

View File

@ -54,4 +54,21 @@ final class DerivedFileGeneratorTests: XCTestCase {
// Then
XCTAssertFalse(fileHandler.exists(oldPlistPath))
}
func test_generate_checkFolderNotCreated_whenNoGeneratedInfoPlist() throws {
// Given
let sourceRootPath = fileHandler.currentPath
let target = Target.test(name: "Target", infoPlist: .file(path: "/Info.plist"))
let project = Project.test(name: "App", targets: [target])
let infoPlistsPath = DerivedFileGenerator.infoPlistsPath(sourceRootPath: sourceRootPath)
let path = infoPlistsPath.appending(component: "Target.plist")
// When
_ = try subject.generate(project: project,
sourceRootPath: sourceRootPath)
// Then
XCTAssertFalse(fileHandler.exists(path))
XCTAssertFalse(fileHandler.exists(infoPlistsPath))
}
}