Skip to content

Fix bug that causes ignored 'exclude' directive #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/PackageDescription/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ extension Package: TOMLConvertible {
}
result += "]\n"

for target in targets {
result += "\n" + "exclude = \(exclude)" + "\n"

for target in targets {
result += "[[package.targets]]\n"
result += target.toTOML()
}
result += "\n" + "exclude = \(exclude)"

return result
}
Expand Down
3 changes: 1 addition & 2 deletions Tests/dep/Fixtures/29_exclude_directory/Package.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import PackageDescription

let package = Package(

name: "29_exclude_directory",
exclude: ["FooLib"]
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Bar {
var bar: Int = 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class FooBar{
var bar: Int = 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Foo {
var bar: Int = 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PackageDescription

let package = Package(
name: "32_exclude_directory_with_targets",
targets: [Target(name: "FooLib")],
exclude: ["FooLib"]
)
13 changes: 13 additions & 0 deletions Tests/dep/FunctionalBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
("testExecDeps", testExecDeps),
("testMultDeps", testMultDeps),
("testExcludeDirs", testExcludeDirs),
("testExcludeWithTarget", testExcludeWithTarget),
("test_exdeps", test_exdeps),
("test_exdeps_canRunBuildTwice", test_exdeps_canRunBuildTwice),
("test_get_ExternalDeps", test_get_ExternalDeps),
Expand Down Expand Up @@ -391,6 +392,18 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
}
}

// 32 exclude directories (with targets)
// (see https://github.com/apple/swift-package-manager/pull/83)
func testExcludeWithTarget() {
let filesToVerify = ["BarLib.a", "FooBarLib.a"]
let filesShouldNotExist = ["FooLib.a"]
fixture(name: "32_exclude_directory_with_targets") { prefix in
XCTAssertNotNil(try? executeSwiftBuild(prefix))
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
XCTAssertFalse(self.verifyFilesExist(filesShouldNotExist, fixturePath: prefix))
}
}

func test_exdeps() {
fixture(name: "102_mattts_dealer") { prefix in
let prefix = Path.join(prefix, "app")
Expand Down