Skip to content

Commit

Permalink
Create ExamplePackageIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Dec 9, 2023
1 parent eebd2b3 commit 543d743
Show file tree
Hide file tree
Showing 12 changed files with 460 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ jobs:
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v3

spm-integration-15:
name: Build and Test Package Integration on Xcode 15
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
run: xcrun swift build -c release --package-path Examples/ExamplePackageIntegration
59 changes: 59 additions & 0 deletions Examples/ExamplePackageIntegration/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"pins" : [
{
"identity" : "jjliso8601dateformatter",
"kind" : "remoteSourceControl",
"location" : "https://github.com/michaeleisel/JJLISO8601DateFormatter",
"state" : {
"revision" : "de422afd9a47b72703c30a81423c478337191390",
"version" : "0.1.6"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307",
"version" : "1.0.5"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "zippyjson",
"kind" : "remoteSourceControl",
"location" : "https://github.com/michaeleisel/ZippyJSON.git",
"state" : {
"revision" : "c4ab804780b64979f19268619dfa563b6be58f7d",
"version" : "1.2.10"
}
},
{
"identity" : "zippyjsoncfamily",
"kind" : "remoteSourceControl",
"location" : "https://github.com/michaeleisel/ZippyJSONCFamily",
"state" : {
"revision" : "8abdd7a5e943afe68e7b03fdaa63b21c042a3893",
"version" : "1.2.9"
}
}
],
"version" : 2
}
91 changes: 91 additions & 0 deletions Examples/ExamplePackageIntegration/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ExamplePackageIntegration",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.macCatalyst(.v13)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "ExamplePackageIntegration",
targets: ["RootModule"]),
],
dependencies: [
.package(path: "../../")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.rootTarget(
name: "RootModule",
dependencies: [
"SharedModule",
"ChildAModule",
"ChildBModule",
"ChildCModule",
]
),
.nonRootTarget(
name: "ChildAModule",
dependencies: [
"SharedModule",
"GrandchildrenModule",
]
),
.nonRootTarget(
name: "ChildBModule",
dependencies: [
"SharedModule",
"GrandchildrenModule",
]
),
.nonRootTarget(
name: "ChildCModule",
dependencies: [
"SharedModule",
"GrandchildrenModule",
]
),
.nonRootTarget(
name: "GrandchildrenModule",
dependencies: [
"SharedModule"
]
),
.nonRootTarget(name: "SharedModule"),
]
)

extension Target {
static func rootTarget(name: String, dependencies: [Target.Dependency] = []) -> Target {
.target(
name: name,
dependencies: [
"SafeDI",
] + dependencies,
plugins: [
.plugin(name: "SafeDIGenerateDependencyTree", package: "SafeDI"),
]
)
}

static func nonRootTarget(name: String, dependencies: [Target.Dependency] = []) -> Target {
.target(
name: name,
dependencies: [
"SafeDI",
] + dependencies,
plugins: [
.plugin(name: "SafeDICollectInstantiables", package: "SafeDI"),
]
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import GrandchildrenModule
import SafeDI
import SharedModule

@Instantiable
public final class ChildA {

public init(shared: SharedThing, grandchildA: GrandchildA) {
self.shared = shared
self.grandchildA = grandchildA
}

@Received
let shared: SharedThing

@Instantiated
let grandchildA: GrandchildA

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import GrandchildrenModule
import SafeDI
import SharedModule

@Instantiable
public final class ChildB {

public init(shared: SharedThing, grandchildB: GrandchildB) {
self.shared = shared
self.grandchildB = grandchildB
}

@Received
let shared: SharedThing

@Instantiated
let grandchildB: GrandchildB

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import GrandchildrenModule
import SafeDI
import SharedModule

@Instantiable
public final class ChildC {

public init(shared: SharedThing, grandchildC: GrandchildC) {
self.shared = shared
self.grandchildC = grandchildC
}

@Received
let shared: SharedThing

@Instantiated
let grandchildC: GrandchildC

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import SafeDI
import SharedModule

@Instantiable
public final class GrandchildA {

public init(shared: SharedThing) {
self.shared = shared
}

@Received
let shared: SharedThing

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import SafeDI
import SharedModule

@Instantiable
public actor GrandchildB {

public init(shared: SharedThing) {
self.shared = shared
}

@Received
let shared: SharedThing

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Distributed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import SafeDI
import SharedModule

@Instantiable
public struct GrandchildC {

public init(shared: SharedThing) {
self.shared = shared
}

@Received
let shared: SharedThing

}
Loading

0 comments on commit 543d743

Please sign in to comment.