Replies: 1 comment
|
Implementado em #280 — target |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Overview
Split the current single, monolithic
RequestDLtarget into two: a newRequestDLInternalstarget hosting everything currently underSources/RequestDL/Internals/(the execution engine wrappingAsyncHTTPClient/SwiftNIO —Client,Session,Buffers,Stream,Secure Connection,Cache,Storage,Logger, perCLAUDE.md's own module description), withRequestDL(Properties/Tasks/Request) depending on it. Files physically move toSources/RequestDLInternals/.Not exposed as a public product.
RequestDLInternalsstays a plain.target, not wrapped in a.library(...)product entry — external consumers ofimport RequestDLare completely unaffected; they can'timport RequestDLInternalsat all (SwiftPM only exposes declared products to external dependents), andRequestDL's own public API surface (Property,DataTask,HTTPHeaders,ResponseHead, etc.) is byte-for-byte unchanged. This is purely a structural refactor, not an API change.Why
Internalsisn't public API" is a documented convention (CLAUDE.md: "Nothing here is public API; it's namespaced under theInternalsenum"), not something the compiler checks — any file anywhere inProperties/Tasks/Requestcan freely reach into anyinternaldetail ofInternals, since it's all one target today. Splitting into a real target makes the actual dependency surface between "the execution engine" and "the declarative API" explicit: anythingProperties/Tasksneeds fromInternalshas to be deliberately markedpubliconRequestDLInternals, auditable at thePackage.swift/access-control level instead of by convention alone.RequestDLtarget (Properties+Internals+Tasks+Request, everything underSources/RequestDL/) is one compilation unit. A change to anyProperties/Tasksfile (the bulk of day-to-day public-API work) currently has no way to avoid touching the same build unit asInternals. Splitting them means Swift's build system only recompilesRequestDLInternalswhen its own files change or whenRequestDLchanges something it depends on — not on every unrelatedProperties/Tasksedit.Mechanics
Package.swiftgains.target(name: "RequestDLInternals", dependencies: [...]), and the existingRequestDLtarget depends on it.Internals-only (NIOSSL,NIOTransportServices,NIOHTTPCompression,SystemPackage, ...) moves toRequestDLInternalsalone. Anything used directly by both sides has to stay declared on both targets —Loggingis the clear example:Internals.Log/Internals.TaskLoggerneed it, but so doesRequestDL's own public surface (Modifiers.LoggerexposesLogging.Loggerdirectly in its public API). A target's dependency list doesn't transitively re-export importability to a target that depends on it, so this has to be explicit on both sides.Internalsthat's implicitlyinternaltoday but actually used fromProperties/Tasks/Requestneeds auditing and markingpublicon the new target. No logic changes — access-modifier changes only, across most of theInternalstree.Test suite consequence — checked, not assumed
@testable import RequestDLcurrently appears in 183 test files, and 69 of those directly referenceInternals.symbols — including a whole dedicatedTests/RequestDLTests/Internals/subtree mirroring the source layout (perCLAUDE.md's "test files mirror theSources/directory layout 1:1" convention). After the split,@testable import RequestDLno longer gives access toRequestDLInternals's non-public details, sinceRequestDLonly depends onRequestDLInternalsrather than absorbing its internal-level symbols. So this needs a newRequestDLInternalsTeststarget,@testable import RequestDLInternals, with the existingTests/RequestDLTests/Internals/subtree moved over to match — mechanical, well-scoped, but real work to account for, not a hidden risk.Out of scope
RequestDL's public API — none intended or expected.RequestDLInternalsas an importable product for other packages — deliberately not part of this proposal.Milestone: 4.1.0
All reactions