diff --git a/tests/ios/swift-library-group/A.swift b/tests/ios/swift-library-group/A.swift new file mode 100644 index 00000000..09261eec --- /dev/null +++ b/tests/ios/swift-library-group/A.swift @@ -0,0 +1,11 @@ +import Foundation + +public class A { + public init() { + print("A") + } + + public func doSomething() { + print("A.doSomething") + } +} diff --git a/tests/ios/swift-library-group/App.swift b/tests/ios/swift-library-group/App.swift new file mode 100644 index 00000000..d3dbde25 --- /dev/null +++ b/tests/ios/swift-library-group/App.swift @@ -0,0 +1,27 @@ +import A +import B +import C +import Fwk +import Foundation +import SwiftUI + +@main +struct App: App { + var body: some Scene { + WindowGroup { + Text("App") + } + } + + func doSomething() { + let a = A() + a.doSomething() + let b = B() + b.doSomething() + let c = C() + c.doSomething() + let fwk = Fwk() + fwk.doSomething() + print("App.doSomething") + } +} diff --git a/tests/ios/swift-library-group/B.swift b/tests/ios/swift-library-group/B.swift new file mode 100644 index 00000000..85a5313b --- /dev/null +++ b/tests/ios/swift-library-group/B.swift @@ -0,0 +1,14 @@ +import A +import Foundation + +public class B { + public init() { + print("B") + } + + public func doSomething() { + let a = A() + a.doSomething() + print("B.doSomething") + } +} diff --git a/tests/ios/swift-library-group/BUILD.bazel b/tests/ios/swift-library-group/BUILD.bazel new file mode 100644 index 00000000..84306047 --- /dev/null +++ b/tests/ios/swift-library-group/BUILD.bazel @@ -0,0 +1,64 @@ +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library", "swift_library_group") +load("//rules:app.bzl", "ios_application") +load("//rules:framework.bzl", "apple_framework") + +swift_library( + name = "A_SwiftLib", + srcs = ["A.swift"], + module_name = "A", + tags = ["manual"], +) + +swift_library( + name = "B_SwiftLib", + srcs = ["B.swift"], + module_name = "B", + tags = ["manual"], + deps = [":A_SwiftLib"], +) + +swift_library( + name = "C_SwiftLib", + srcs = ["C.swift"], + module_name = "C", + tags = ["manual"], +) + +swift_library_group( + name = "B_SwiftLibGroup", + tags = ["manual"], + deps = [":B_SwiftLib"], +) + +swift_library_group( + name = "A_C_SwiftLibGroup", + tags = ["manual"], + deps = [ + ":A_SwiftLib", + ":C_SwiftLib", + ], +) + +apple_framework( + name = "Framework", + srcs = ["Fwk.swift"], + module_name = "Fwk", + platforms = {"ios": "15.0"}, + deps = [ + ":A_SwiftLib", + ":B_SwiftLibGroup", + ], +) + +ios_application( + name = "App", + srcs = ["App.swift"], + bundle_id = "com.example.app", + families = ["iphone"], + minimum_os_version = "15.0", + deps = [ + ":A_C_SwiftLibGroup", + ":B_SwiftLibGroup", + ":Framework", + ], +) diff --git a/tests/ios/swift-library-group/C.swift b/tests/ios/swift-library-group/C.swift new file mode 100644 index 00000000..6338836f --- /dev/null +++ b/tests/ios/swift-library-group/C.swift @@ -0,0 +1,11 @@ +import Foundation + +public class C { + public init() { + print("C") + } + + public func doSomething() { + print("C.doSomething") + } +} diff --git a/tests/ios/swift-library-group/Fwk.swift b/tests/ios/swift-library-group/Fwk.swift new file mode 100644 index 00000000..eb6210d7 --- /dev/null +++ b/tests/ios/swift-library-group/Fwk.swift @@ -0,0 +1,17 @@ +import A +import B +import Foundation + +public class Fwk { + public init() { + print("Fwk") + } + + public func doSomething() { + let a = A() + a.doSomething() + let b = B() + b.doSomething() + print("Fwk.doSomething") + } +}