Skip to content

Commit a933f7a

Browse files
committed
Enable package-name setting for v5.9+
Support Target Grouping - Allow opting out of package boundary - Allow subgrouping within a package - Default set to package boundary
1 parent 96d8497 commit a933f7a

File tree

30 files changed

+580
-19
lines changed

30 files changed

+580
-19
lines changed

Fixtures/Miscellaneous/PackageNameFlag/appPkg/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:999.0
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(

Fixtures/Miscellaneous/PackageNameFlag/fooPkg/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:999.0
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// swift-tools-version:5.9
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "libPkg",
6+
products: [
7+
.executable(name: "ExampleApp", targets: ["ExampleApp"]),
8+
.library(name: "MainLib", targets: ["MainLib"]),
9+
],
10+
targets: [
11+
.executableTarget(name: "ExampleApp", group: .excluded, dependencies: ["MainLib"]),
12+
.target(name: "MainLib", group: .package, dependencies: ["Core"]),
13+
.target(name: "Core", group: .package, dependencies: ["DataManager"]),
14+
.target(name: "DataManager", group: .named("DataGroup"), dependencies: ["DataModel"]),
15+
.target(name: "DataModel", group: .named("DataGroup")),
16+
.testTarget(name: "MainLibTests", group: .package, dependencies: ["MainLib"]),
17+
.testTarget(name: "BlackBoxTests", group: .excluded, dependencies: ["MainLib"])
18+
]
19+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import DataManager
2+
3+
public struct PublicCore {
4+
public let publicVar: Int
5+
public init(publicVar: Int) {
6+
self.publicVar = publicVar
7+
}
8+
public func publicCoreFunc() {
9+
managePublicFunc()
10+
}
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import DataModel
2+
3+
public func managePublicFunc() -> PublicData? {
4+
return nil
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public class PublicData {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import MainLib
2+
3+
publicFunc()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Core
2+
3+
public func publicFunc() -> Int {
4+
print("public decl")
5+
return PublicCore(publicVar: 10).publicVar
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import MainLib
2+
import XCTest
3+
4+
class BlackBoxTests: XCTestCase {
5+
func testBlackBox() {
6+
let x = publicFunc()
7+
XCTAssertTrue(x > 0)
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import MainLib
2+
import XCTest
3+
4+
class TestMainLib: XCTestCase {
5+
func testMainLib() {
6+
let x = publicFunc()
7+
XCTAssertTrue(x > 0)
8+
}
9+
}

0 commit comments

Comments
 (0)