You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow sources anywhere in ./Sources when only one target is present (#6294)
After getting some feedback about the added `path` argument for executable
packages generated with `swift package init` (#6144), this change allows a
target's sources to occupy the entire "predefined sources directory" (e.g.
`Sources`, `Tests`, or `Plugins`) when there is only one target of a specific
kind occupying one of those directories in the package. All package types can
benefit from this.
For example, if there is only one library target and one test target, one can
put sources directly in `./Sources` and `./Tests`. Adding another library means
that one has to put the sources for TargetA in `./Sources/TargetA` and the
sources for TargetB in `./Sources/TargetB`, and so on.
When there is more than one target of a type in a package, the existing
requirements for target sources still apply.
This change should be compatible with existing layouts as well. If there is
only a single target in a package, then sources can of course continue to exist
exclusively in `./Sources/<target>`, or `./Tests/<testTarget>`, etc.
Amend the `executable` and `tool` template's generated manifest to not include
the `path` argument anymore as it is no longer needed.
With this change, the `library` template type can also put its sources and tests
directly in the `./Sources` and `./Tests` directories respectively.
All of the above only takes place when the tools version is set to 5.9 or
higher in the manifest.
rdar://106829666
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,10 @@ Swift Next
24
24
Swift 5.9
25
25
-----------
26
26
27
+
*[#6294]
28
+
29
+
When a package contains a single target, sources may be distributed anywhere within the `./Sources` directory. If sources are placed in a subdirectory under `./Sources/<target>`, or there is more than one target, the existing expectation for sources apply.
30
+
27
31
*[#6114]
28
32
29
33
Added a new `allowNetworkConnections(scope:reason:)` for giving a command plugin permissions to access the network. Permissions can be scoped to Unix domain sockets in general or specifically for Docker, as well as local or remote IP connections which can be limited by port. For non-interactive use cases, there is also a `--allow-network-connections` commandline flag to allow network connections for a particular scope.
return"Source files for target \(target) should be located under '\(folderName)/\(target)', or a custom sources path can be set with the 'path' property in Package.swift"
92
+
varclauses=["Source files for target \(target) should be located under '\(folderName)/\(target)'"]
93
+
if shouldSuggestRelaxedSourceDir {
94
+
clauses.append("'\(folderName)'")
95
+
}
96
+
clauses.append("or a custom sources path can be set with the 'path' property in Package.swift")
0 commit comments