Skip to content
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

Add swift_library_group tests #904

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 11 additions & 0 deletions tests/ios/swift-library-group/A.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

public class A {
public init() {
print("A")
}

public func doSomething() {
print("A.doSomething")
}
}
27 changes: 27 additions & 0 deletions tests/ios/swift-library-group/App.swift
Original file line number Diff line number Diff line change
@@ -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")
}
}
14 changes: 14 additions & 0 deletions tests/ios/swift-library-group/B.swift
Original file line number Diff line number Diff line change
@@ -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")
}
}
64 changes: 64 additions & 0 deletions tests/ios/swift-library-group/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
],
)
11 changes: 11 additions & 0 deletions tests/ios/swift-library-group/C.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

public class C {
public init() {
print("C")
}

public func doSomething() {
print("C.doSomething")
}
}
17 changes: 17 additions & 0 deletions tests/ios/swift-library-group/Fwk.swift
Original file line number Diff line number Diff line change
@@ -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")
}
}
Loading