Hi,
I'm working on a library which allows multi-products:
- A core library product with the library main tools
- n additional products with some extra services you may decide or not to use
One of these additional products require an external dependency.
This is my Package.swift manifesto:
import PackageDescription
let package = Package(
name: "Glider",
platforms: [
.iOS(.v12),
.macOS(.v11)
],
products: [
// This is my core library
.library(
name: "GliderCore",
targets: ["GliderCore"]
),
// This is an addition product to the core which also needs of an external dependecy
// when imported.
.library(
name: "GliderSQLite",
targets: ["GliderSQLite"]
)
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(
name: "SQLite.swift",
url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.12.2"
)
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "GliderCore",
dependencies: [],
path: "GliderCore/Sources"
),
.target(
name: "GliderSQLite",
dependencies: [
"GliderCore",
// It should limit the import of the external dependency to this target but
// the lib is always fetched even when - importing the framework - I choose
// to get only the GliderCore, not this extra package.
.product(name: "SQLite", package: "SQLite.swift")
],
path: "GliderSQLite/Sources"
),
.testTarget(
name: "GliderCoreTests",
dependencies: ["GliderCore"]),
]
)
Everything works fine but when I decide to fetch only the Core (GliderCore) from the package I always also get the dependency (SQLite.swift) which should be fetched only for "GliderSQLite" product.
Is this correct? Is there a way to decleare it strictly necessary only for one target? I've tried to set it as target's dependency but it seems not work.
Thanks.