Commit a0b25d3
authored
Support macros when cross-compiling (#7118)
### Motivation:
Not supporting macros in cross-compilation is a major limitation,
especially for libraries like https://github.com/apple/swift-mmio.
### Modifications:
Added `enum BuildTriple { case tools, destination }` and `var
buildTriple: BuildTriple` on `ResolvedTarget` and `ResolvedProduct`.
We're not using "host" and "target" triple terminology in this enum, as
that clashes with build system "targets" and can lead to confusion in
this context.
Corresponding value is assigned to this property depending on target and
product type: `tools` for macros, plugins, and their dependencies,
`destination` for everything else (the default). Based on this property
we can choose between `buildParameters.hostTriple` and
`buildParameters.targetTriple` during build plan construction.
Additionally, the resolved products and resolved targets graph is now
constructed in a way that allows certain targets and products to be
built twice: once for host triple, once for target triple if needed.
This required modifying build description and build manifest generation
to distinguish these products and targets from each other that are built
twice.
Artifacts built for the host now have `-tools` suffix appended to their
names. This cascaded into making changes throughout the code base for
build tool plugins and package plugins handling, which constructed their
paths in an ad-hoc manner without accounting for possible changes to
these names.
Also added `CrossCompilationPackageGraphTests` and
`CrossCompilationBuildPlanTests` to verify the changes made are applied
correctly.
### Result:
Resolves #6950
Resolves rdar://1059913721 parent 2fae93c commit a0b25d3
File tree
45 files changed
+1080
-356
lines changed- Sources
- Basics/Collections
- Build
- BuildDescription
- BuildManifest
- BuildPlan
- Commands
- PackageTools
- Utilities
- PackageGraph
- Resolution
- PackageModel/Target
- SPMBuildCore
- BuildParameters
- BuildSystem
- Plugins
- SPMTestSupport
- Tests
- BuildTests
- CommandsTests
- PackageGraphTests
- SPMBuildCoreTests
- SourceKitLSPAPITests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
45 files changed
+1080
-356
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
11 | 22 | | |
12 | 23 | | |
13 | 24 | | |
14 | 25 | | |
15 | | - | |
| 26 | + | |
16 | 27 | | |
17 | 28 | | |
18 | 29 | | |
| |||
387 | 398 | | |
388 | 399 | | |
389 | 400 | | |
| 401 | + | |
390 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
130 | | - | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| |||
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
222 | | - | |
| 225 | + | |
223 | 226 | | |
224 | 227 | | |
225 | 228 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments