From ed1e7cdeb9950a0341028c044186f6ac681b5ca3 Mon Sep 17 00:00:00 2001 From: Brad Fol Date: Tue, 9 Jan 2024 16:04:13 -0800 Subject: [PATCH 1/2] Rename module target to Knit This allows both SPM and Cocoapods can use `import Knit` --- Example/KnitExample/KnitExampleUserAssembly.swift | 2 +- Package.swift | 8 ++++---- Sources/{KnitLib => Knit}/Exports.swift | 0 .../Module/Container+AbstractRegistration.swift | 0 Sources/{KnitLib => Knit}/Module/DependencyBuilder.swift | 0 Sources/{KnitLib => Knit}/Module/ModuleAssembler.swift | 0 Sources/{KnitLib => Knit}/Module/ModuleAssembly.swift | 0 .../{KnitLib => Knit}/Module/ScopedModuleAssembler.swift | 0 .../ServiceCollection/Container+ServiceCollection.erb | 0 .../ServiceCollection/Container+ServiceCollection.swift | 0 .../ServiceCollection/Resolver+ServiceCollection.swift | 0 .../ServiceCollection/ServiceCollection.swift | 0 .../ServiceCollection/ServiceCollector.swift | 0 Sources/{KnitLib => Knit}/WeakResolver.swift | 0 .../AbstractRegistrationTests.swift | 2 +- .../ComplexDependencyTests.swift | 2 +- .../DependencyBuilderTests.swift | 2 +- .../GeneratedModuleAssemblyTests.swift | 2 +- .../ModuleAssemblerTests.swift | 2 +- .../ModuleAssemblyOverrideTests.swift | 2 +- .../ModuleAssemblyScopingTests.swift | 2 +- Tests/{KnitLibTests => KnitTests}/ModuleCycleTests.swift | 2 +- .../ScopedModuleAssemblerTests.swift | 2 +- .../ServiceCollectorTests.swift | 2 +- .../SynchronizationTests.swift | 2 +- Tests/{KnitLibTests => KnitTests}/TestResolver.swift | 2 +- Tests/{KnitLibTests => KnitTests}/WeakResolverTests.swift | 2 +- 27 files changed, 18 insertions(+), 18 deletions(-) rename Sources/{KnitLib => Knit}/Exports.swift (100%) rename Sources/{KnitLib => Knit}/Module/Container+AbstractRegistration.swift (100%) rename Sources/{KnitLib => Knit}/Module/DependencyBuilder.swift (100%) rename Sources/{KnitLib => Knit}/Module/ModuleAssembler.swift (100%) rename Sources/{KnitLib => Knit}/Module/ModuleAssembly.swift (100%) rename Sources/{KnitLib => Knit}/Module/ScopedModuleAssembler.swift (100%) rename Sources/{KnitLib => Knit}/ServiceCollection/Container+ServiceCollection.erb (100%) rename Sources/{KnitLib => Knit}/ServiceCollection/Container+ServiceCollection.swift (100%) rename Sources/{KnitLib => Knit}/ServiceCollection/Resolver+ServiceCollection.swift (100%) rename Sources/{KnitLib => Knit}/ServiceCollection/ServiceCollection.swift (100%) rename Sources/{KnitLib => Knit}/ServiceCollection/ServiceCollector.swift (100%) rename Sources/{KnitLib => Knit}/WeakResolver.swift (100%) rename Tests/{KnitLibTests => KnitTests}/AbstractRegistrationTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/ComplexDependencyTests.swift (98%) rename Tests/{KnitLibTests => KnitTests}/DependencyBuilderTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/GeneratedModuleAssemblyTests.swift (98%) rename Tests/{KnitLibTests => KnitTests}/ModuleAssemblerTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/ModuleAssemblyOverrideTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/ModuleAssemblyScopingTests.swift (98%) rename Tests/{KnitLibTests => KnitTests}/ModuleCycleTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/ScopedModuleAssemblerTests.swift (98%) rename Tests/{KnitLibTests => KnitTests}/ServiceCollectorTests.swift (99%) rename Tests/{KnitLibTests => KnitTests}/SynchronizationTests.swift (98%) rename Tests/{KnitLibTests => KnitTests}/TestResolver.swift (92%) rename Tests/{KnitLibTests => KnitTests}/WeakResolverTests.swift (99%) diff --git a/Example/KnitExample/KnitExampleUserAssembly.swift b/Example/KnitExample/KnitExampleUserAssembly.swift index 7c8aac5..b7caff1 100644 --- a/Example/KnitExample/KnitExampleUserAssembly.swift +++ b/Example/KnitExample/KnitExampleUserAssembly.swift @@ -1,7 +1,7 @@ // Copyright © Square, Inc. All rights reserved. import Foundation -import KnitLib +import Knit // @knit internal getter-named /// An assembly expected to be registered at the user level rather than at the app level diff --git a/Package.swift b/Package.swift index 066b78c..2c7ffda 100644 --- a/Package.swift +++ b/Package.swift @@ -9,7 +9,7 @@ let package = Package( .macOS(.v12), ], products: [ - .library(name: "Knit", targets: ["KnitLib"]), + .library(name: "Knit", targets: ["Knit"]), .executable(name: "knit-cli", targets: ["KnitCommand"]) ], dependencies: [ @@ -20,7 +20,7 @@ let package = Package( ], targets: [ .target( - name: "KnitLib", + name: "Knit", dependencies: [ .product(name: "Swinject", package: "Swinject"), .product(name: "SwinjectAutoregistration", package: "SwinjectAutoregistration"), @@ -43,9 +43,9 @@ let package = Package( ] ), .testTarget( - name: "KnitLibTests", + name: "KnitTests", dependencies: [ - "KnitLib", + "Knit", ] ), .testTarget( diff --git a/Sources/KnitLib/Exports.swift b/Sources/Knit/Exports.swift similarity index 100% rename from Sources/KnitLib/Exports.swift rename to Sources/Knit/Exports.swift diff --git a/Sources/KnitLib/Module/Container+AbstractRegistration.swift b/Sources/Knit/Module/Container+AbstractRegistration.swift similarity index 100% rename from Sources/KnitLib/Module/Container+AbstractRegistration.swift rename to Sources/Knit/Module/Container+AbstractRegistration.swift diff --git a/Sources/KnitLib/Module/DependencyBuilder.swift b/Sources/Knit/Module/DependencyBuilder.swift similarity index 100% rename from Sources/KnitLib/Module/DependencyBuilder.swift rename to Sources/Knit/Module/DependencyBuilder.swift diff --git a/Sources/KnitLib/Module/ModuleAssembler.swift b/Sources/Knit/Module/ModuleAssembler.swift similarity index 100% rename from Sources/KnitLib/Module/ModuleAssembler.swift rename to Sources/Knit/Module/ModuleAssembler.swift diff --git a/Sources/KnitLib/Module/ModuleAssembly.swift b/Sources/Knit/Module/ModuleAssembly.swift similarity index 100% rename from Sources/KnitLib/Module/ModuleAssembly.swift rename to Sources/Knit/Module/ModuleAssembly.swift diff --git a/Sources/KnitLib/Module/ScopedModuleAssembler.swift b/Sources/Knit/Module/ScopedModuleAssembler.swift similarity index 100% rename from Sources/KnitLib/Module/ScopedModuleAssembler.swift rename to Sources/Knit/Module/ScopedModuleAssembler.swift diff --git a/Sources/KnitLib/ServiceCollection/Container+ServiceCollection.erb b/Sources/Knit/ServiceCollection/Container+ServiceCollection.erb similarity index 100% rename from Sources/KnitLib/ServiceCollection/Container+ServiceCollection.erb rename to Sources/Knit/ServiceCollection/Container+ServiceCollection.erb diff --git a/Sources/KnitLib/ServiceCollection/Container+ServiceCollection.swift b/Sources/Knit/ServiceCollection/Container+ServiceCollection.swift similarity index 100% rename from Sources/KnitLib/ServiceCollection/Container+ServiceCollection.swift rename to Sources/Knit/ServiceCollection/Container+ServiceCollection.swift diff --git a/Sources/KnitLib/ServiceCollection/Resolver+ServiceCollection.swift b/Sources/Knit/ServiceCollection/Resolver+ServiceCollection.swift similarity index 100% rename from Sources/KnitLib/ServiceCollection/Resolver+ServiceCollection.swift rename to Sources/Knit/ServiceCollection/Resolver+ServiceCollection.swift diff --git a/Sources/KnitLib/ServiceCollection/ServiceCollection.swift b/Sources/Knit/ServiceCollection/ServiceCollection.swift similarity index 100% rename from Sources/KnitLib/ServiceCollection/ServiceCollection.swift rename to Sources/Knit/ServiceCollection/ServiceCollection.swift diff --git a/Sources/KnitLib/ServiceCollection/ServiceCollector.swift b/Sources/Knit/ServiceCollection/ServiceCollector.swift similarity index 100% rename from Sources/KnitLib/ServiceCollection/ServiceCollector.swift rename to Sources/Knit/ServiceCollection/ServiceCollector.swift diff --git a/Sources/KnitLib/WeakResolver.swift b/Sources/Knit/WeakResolver.swift similarity index 100% rename from Sources/KnitLib/WeakResolver.swift rename to Sources/Knit/WeakResolver.swift diff --git a/Tests/KnitLibTests/AbstractRegistrationTests.swift b/Tests/KnitTests/AbstractRegistrationTests.swift similarity index 99% rename from Tests/KnitLibTests/AbstractRegistrationTests.swift rename to Tests/KnitTests/AbstractRegistrationTests.swift index e4dd189..15e2d62 100644 --- a/Tests/KnitLibTests/AbstractRegistrationTests.swift +++ b/Tests/KnitTests/AbstractRegistrationTests.swift @@ -2,7 +2,7 @@ // Copyright © Block, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class AbstractRegistrationTests: XCTestCase { diff --git a/Tests/KnitLibTests/ComplexDependencyTests.swift b/Tests/KnitTests/ComplexDependencyTests.swift similarity index 98% rename from Tests/KnitLibTests/ComplexDependencyTests.swift rename to Tests/KnitTests/ComplexDependencyTests.swift index aea7a1a..052397c 100644 --- a/Tests/KnitLibTests/ComplexDependencyTests.swift +++ b/Tests/KnitTests/ComplexDependencyTests.swift @@ -2,7 +2,7 @@ // Copyright © Block, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class ComplexDependencyTests: XCTestCase { diff --git a/Tests/KnitLibTests/DependencyBuilderTests.swift b/Tests/KnitTests/DependencyBuilderTests.swift similarity index 99% rename from Tests/KnitLibTests/DependencyBuilderTests.swift rename to Tests/KnitTests/DependencyBuilderTests.swift index a26b33a..9f19731 100644 --- a/Tests/KnitLibTests/DependencyBuilderTests.swift +++ b/Tests/KnitTests/DependencyBuilderTests.swift @@ -2,7 +2,7 @@ // Copyright © Square, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class DependencyBuilderTests: XCTestCase { diff --git a/Tests/KnitLibTests/GeneratedModuleAssemblyTests.swift b/Tests/KnitTests/GeneratedModuleAssemblyTests.swift similarity index 98% rename from Tests/KnitLibTests/GeneratedModuleAssemblyTests.swift rename to Tests/KnitTests/GeneratedModuleAssemblyTests.swift index 2e75e59..01d63b1 100644 --- a/Tests/KnitLibTests/GeneratedModuleAssemblyTests.swift +++ b/Tests/KnitTests/GeneratedModuleAssemblyTests.swift @@ -3,7 +3,7 @@ // import Foundation -@testable import KnitLib +@testable import Knit import XCTest final class GeneratedModuleAssemblyTests: XCTestCase { diff --git a/Tests/KnitLibTests/ModuleAssemblerTests.swift b/Tests/KnitTests/ModuleAssemblerTests.swift similarity index 99% rename from Tests/KnitLibTests/ModuleAssemblerTests.swift rename to Tests/KnitTests/ModuleAssemblerTests.swift index be8480c..08fabb2 100644 --- a/Tests/KnitLibTests/ModuleAssemblerTests.swift +++ b/Tests/KnitTests/ModuleAssemblerTests.swift @@ -2,7 +2,7 @@ // Copyright © Square, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class ModuleAssemblerTests: XCTestCase { diff --git a/Tests/KnitLibTests/ModuleAssemblyOverrideTests.swift b/Tests/KnitTests/ModuleAssemblyOverrideTests.swift similarity index 99% rename from Tests/KnitLibTests/ModuleAssemblyOverrideTests.swift rename to Tests/KnitTests/ModuleAssemblyOverrideTests.swift index 7131489..f593e98 100644 --- a/Tests/KnitLibTests/ModuleAssemblyOverrideTests.swift +++ b/Tests/KnitTests/ModuleAssemblyOverrideTests.swift @@ -2,7 +2,7 @@ // Copyright © Square, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class ModuleAssemblyOverrideTests: XCTestCase { diff --git a/Tests/KnitLibTests/ModuleAssemblyScopingTests.swift b/Tests/KnitTests/ModuleAssemblyScopingTests.swift similarity index 98% rename from Tests/KnitLibTests/ModuleAssemblyScopingTests.swift rename to Tests/KnitTests/ModuleAssemblyScopingTests.swift index c0fa398..689e5de 100644 --- a/Tests/KnitLibTests/ModuleAssemblyScopingTests.swift +++ b/Tests/KnitTests/ModuleAssemblyScopingTests.swift @@ -2,7 +2,7 @@ // Copyright © Block, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class ModuleAssemblyScopingTests: XCTestCase { diff --git a/Tests/KnitLibTests/ModuleCycleTests.swift b/Tests/KnitTests/ModuleCycleTests.swift similarity index 99% rename from Tests/KnitLibTests/ModuleCycleTests.swift rename to Tests/KnitTests/ModuleCycleTests.swift index 9742c79..dc2c87c 100644 --- a/Tests/KnitLibTests/ModuleCycleTests.swift +++ b/Tests/KnitTests/ModuleCycleTests.swift @@ -2,7 +2,7 @@ // Copyright © Block, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import XCTest final class ModuleCycleTests: XCTestCase { diff --git a/Tests/KnitLibTests/ScopedModuleAssemblerTests.swift b/Tests/KnitTests/ScopedModuleAssemblerTests.swift similarity index 98% rename from Tests/KnitLibTests/ScopedModuleAssemblerTests.swift rename to Tests/KnitTests/ScopedModuleAssemblerTests.swift index cd003e5..1392f3a 100644 --- a/Tests/KnitLibTests/ScopedModuleAssemblerTests.swift +++ b/Tests/KnitTests/ScopedModuleAssemblerTests.swift @@ -3,7 +3,7 @@ // import Foundation -@testable import KnitLib +@testable import Knit import XCTest final class ScopedModuleAssemblerTests: XCTestCase { diff --git a/Tests/KnitLibTests/ServiceCollectorTests.swift b/Tests/KnitTests/ServiceCollectorTests.swift similarity index 99% rename from Tests/KnitLibTests/ServiceCollectorTests.swift rename to Tests/KnitTests/ServiceCollectorTests.swift index 78a9eb4..3a1f5ed 100644 --- a/Tests/KnitLibTests/ServiceCollectorTests.swift +++ b/Tests/KnitTests/ServiceCollectorTests.swift @@ -1,4 +1,4 @@ -import KnitLib +import Knit import XCTest protocol ServiceProtocol {} diff --git a/Tests/KnitLibTests/SynchronizationTests.swift b/Tests/KnitTests/SynchronizationTests.swift similarity index 98% rename from Tests/KnitLibTests/SynchronizationTests.swift rename to Tests/KnitTests/SynchronizationTests.swift index c386645..da3a93e 100644 --- a/Tests/KnitLibTests/SynchronizationTests.swift +++ b/Tests/KnitTests/SynchronizationTests.swift @@ -3,7 +3,7 @@ // import Foundation -@testable import KnitLib +@testable import Knit import XCTest final class SynchronizationTests: XCTestCase { diff --git a/Tests/KnitLibTests/TestResolver.swift b/Tests/KnitTests/TestResolver.swift similarity index 92% rename from Tests/KnitLibTests/TestResolver.swift rename to Tests/KnitTests/TestResolver.swift index ff43512..94aeb26 100644 --- a/Tests/KnitLibTests/TestResolver.swift +++ b/Tests/KnitTests/TestResolver.swift @@ -2,7 +2,7 @@ // Copyright © Square, Inc. All rights reserved. // -@testable import KnitLib +@testable import Knit import Swinject protocol TestResolver: Resolver { } diff --git a/Tests/KnitLibTests/WeakResolverTests.swift b/Tests/KnitTests/WeakResolverTests.swift similarity index 99% rename from Tests/KnitLibTests/WeakResolverTests.swift rename to Tests/KnitTests/WeakResolverTests.swift index c1e3f2b..df4dc13 100644 --- a/Tests/KnitLibTests/WeakResolverTests.swift +++ b/Tests/KnitTests/WeakResolverTests.swift @@ -2,7 +2,7 @@ // Copyright © Square, Inc. All rights reserved. // -import KnitLib +import Knit import XCTest final class WeakResolverTests: XCTestCase { From 8250ac58e62935e82dc69a942420df748ce780d1 Mon Sep 17 00:00:00 2001 From: Brad Fol Date: Tue, 9 Jan 2024 16:09:14 -0800 Subject: [PATCH 2/2] Fix example project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I am now adding Knit as an SPM package dependency, and I removed the previous reference that pulled in all of Knit’s files into the project. Also added a readme and a bootstrap script that creates the CLI executable. --- .gitignore | 11 +++++-- Example/KnitExample.xcodeproj/project.pbxproj | 33 ++++++++++++++----- Example/README.md | 17 ++++++++++ Example/bootstrap | 4 +++ 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 Example/README.md create mode 100755 Example/bootstrap diff --git a/.gitignore b/.gitignore index 9c1b123..bdb0c81 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,12 @@ DerivedData/ .swiftpm/config/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc -KnitDIRegistrationTests.swift -KnitDITypeSafety.swift + +# Example project + +# Files generated by knit-cli +Example/KnitExample/KnitDITypeSafety.swift +Example/KnitExampleTests/KnitDIRegistrationTests.swift + +# Example's bootstrap script creates a binary from local sources +Example/knit-cli diff --git a/Example/KnitExample.xcodeproj/project.pbxproj b/Example/KnitExample.xcodeproj/project.pbxproj index e2958ef..aacb2c8 100644 --- a/Example/KnitExample.xcodeproj/project.pbxproj +++ b/Example/KnitExample.xcodeproj/project.pbxproj @@ -3,17 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ + 2C360AEA2B4E1A2C00C88B99 /* Knit in Frameworks */ = {isa = PBXBuildFile; productRef = 2C360AE92B4E1A2C00C88B99 /* Knit */; }; C40D0D1F2A838D140095AC59 /* KnitExampleUserAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40D0D1E2A838D140095AC59 /* KnitExampleUserAssembly.swift */; }; C43334F32A3FDD43003BA9E3 /* KnitExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C43334F22A3FDD43003BA9E3 /* KnitExampleApp.swift */; }; C43334F52A3FDD43003BA9E3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C43334F42A3FDD43003BA9E3 /* ContentView.swift */; }; C43334F72A3FDD44003BA9E3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C43334F62A3FDD44003BA9E3 /* Assets.xcassets */; }; C43334FA2A3FDD44003BA9E3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C43334F92A3FDD44003BA9E3 /* Preview Assets.xcassets */; }; C43335062A3FDDD3003BA9E3 /* KnitExampleAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = C43335052A3FDDD3003BA9E3 /* KnitExampleAssembly.swift */; }; - C433350A2A3FDF68003BA9E3 /* Knit in Frameworks */ = {isa = PBXBuildFile; productRef = C43335092A3FDF68003BA9E3 /* Knit */; }; C44754F72A3FE7570072333A /* KnitDITypeSafety.swift in Sources */ = {isa = PBXBuildFile; fileRef = C44754F62A3FE7570072333A /* KnitDITypeSafety.swift */; }; C44755172A3FEA5E0072333A /* KnitDIRegistrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C44755162A3FEA5E0072333A /* KnitDIRegistrationTests.swift */; }; C44755192A3FEA740072333A /* TestModuleAssembler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C44755182A3FEA740072333A /* TestModuleAssembler.swift */; }; @@ -36,7 +36,6 @@ C43334F42A3FDD43003BA9E3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; C43334F62A3FDD44003BA9E3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C43334F92A3FDD44003BA9E3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - C43335042A3FDD78003BA9E3 /* knit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = knit; path = ..; sourceTree = ""; }; C43335052A3FDDD3003BA9E3 /* KnitExampleAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnitExampleAssembly.swift; sourceTree = ""; }; C44754F62A3FE7570072333A /* KnitDITypeSafety.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KnitDITypeSafety.swift; sourceTree = ""; }; C447550D2A3FEA120072333A /* KnitExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KnitExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -49,7 +48,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C433350A2A3FDF68003BA9E3 /* Knit in Frameworks */, + 2C360AEA2B4E1A2C00C88B99 /* Knit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -66,7 +65,6 @@ C43334E62A3FDD43003BA9E3 = { isa = PBXGroup; children = ( - C43335042A3FDD78003BA9E3 /* knit */, C43334F12A3FDD43003BA9E3 /* KnitExample */, C447550E2A3FEA120072333A /* KnitExampleTests */, C43334F02A3FDD43003BA9E3 /* Products */, @@ -139,7 +137,7 @@ ); name = KnitExample; packageProductDependencies = ( - C43335092A3FDF68003BA9E3 /* Knit */, + 2C360AE92B4E1A2C00C88B99 /* Knit */, ); productName = KnitExample; productReference = C43334EF2A3FDD43003BA9E3 /* KnitExample.app */; @@ -159,6 +157,8 @@ C44755122A3FEA120072333A /* PBXTargetDependency */, ); name = KnitExampleTests; + packageProductDependencies = ( + ); productName = KnitExampleTests; productReference = C447550D2A3FEA120072333A /* KnitExampleTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -171,7 +171,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1430; - LastUpgradeCheck = 1420; + LastUpgradeCheck = 1520; TargetAttributes = { C43334EE2A3FDD43003BA9E3 = { CreatedOnToolsVersion = 14.2; @@ -191,6 +191,9 @@ Base, ); mainGroup = C43334E62A3FDD43003BA9E3; + packageReferences = ( + 2C360AE82B4E1A2B00C88B99 /* XCLocalSwiftPackageReference ".." */, + ); productRefGroup = C43334F02A3FDD43003BA9E3 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -230,6 +233,7 @@ ); inputPaths = ( "$(SRCROOT)/KnitExample/KnitExampleAssembly.swift", + "$(SRCROOT)/KnitExample/KnitExampleUserAssembly.swift", ); outputFileListPaths = ( ); @@ -239,7 +243,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/usr/bin/xcrun --sdk macosx swift run knit-cli gen \\\n--assembly-input-path KnitExample/KnitExampleAssembly.swift \\\n--assembly-input-path KnitExample/KnitExampleUserAssembly.swift \\\n--type-safety-extensions-output-path KnitExample/KnitDITypeSafety.swift \\\n--unit-test-output-path KnitExampleTests/KnitDIRegistrationTests.swift\n"; + shellScript = "./knit-cli gen \\\n--assembly-input-path KnitExample/KnitExampleAssembly.swift \\\n--assembly-input-path KnitExample/KnitExampleUserAssembly.swift \\\n--type-safety-extensions-output-path KnitExample/KnitDITypeSafety.swift \\\n--unit-test-output-path KnitExampleTests/KnitDIRegistrationTests.swift\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -280,6 +284,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -312,6 +317,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -340,6 +346,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -372,6 +379,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -516,8 +524,15 @@ }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 2C360AE82B4E1A2B00C88B99 /* XCLocalSwiftPackageReference ".." */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ..; + }; +/* End XCLocalSwiftPackageReference section */ + /* Begin XCSwiftPackageProductDependency section */ - C43335092A3FDF68003BA9E3 /* Knit */ = { + 2C360AE92B4E1A2C00C88B99 /* Knit */ = { isa = XCSwiftPackageProductDependency; productName = Knit; }; diff --git a/Example/README.md b/Example/README.md new file mode 100644 index 0000000..4bd65ed --- /dev/null +++ b/Example/README.md @@ -0,0 +1,17 @@ +# Example Project + +An example Xcode project that uses Knit. + +## Setup + +1. Run `./bootstrap` from the Example folder +1. Open the `KnitExample.xcodeproj` project + +### Bootstrap Script + +The bootstrap script compiles the Knit CLI tool from local source and moves the resulting executable to the Example directory. + + +For normal apps, the project should use the pre-complied executable binaries that are +included in the GitHub release zips (per release version). +(You are also free to download any of the released binary executables and place it in the Example directory to use it.) diff --git a/Example/bootstrap b/Example/bootstrap new file mode 100755 index 0000000..6d3836a --- /dev/null +++ b/Example/bootstrap @@ -0,0 +1,4 @@ +#!/bin/sh +cd .. +swift build --arch x86_64 --arch arm64 --product knit-cli +mv .build/apple/Products/Debug/knit-cli Example/