Commit Graph

63 Commits

Author SHA1 Message Date
Paolo Tranquilli
cfcd26cf0d Swift: support markdown TSP diagnostics 2023-05-15 13:48:24 +02:00
Paolo Tranquilli
9a555aea5f Merge branch 'main' into redsun82/swift-diagnostics-locations 2023-05-15 10:01:45 +02:00
Paolo Tranquilli
95cd948f09 Swift: order help links in integration test checks
They are currently a set within the codeql cli.
2023-05-14 22:33:48 +02:00
Paolo Tranquilli
03f4625b5f Swift: go back to explicit DIAGNOSE_ERROR macros 2023-05-12 06:30:58 +02:00
Alexandre Boulgakov
0915d2ad77 Swift: Emit a diagnostic when attempting to use the autobuilder on Linux. 2023-05-11 14:43:13 +01:00
Paolo Tranquilli
8534ba0218 Swift: surface error about unsupported SPM build 2023-05-10 14:31:33 +02:00
Paolo Tranquilli
c507754324 Swift: surface error about no viable swift targets found 2023-05-10 14:31:33 +02:00
Paolo Tranquilli
8f26c7e2d2 Swift: add one more help link to diagnostics 2023-05-09 10:52:26 +02:00
Paolo Tranquilli
e17a8d03ab Swift: add diagnostic for no project found 2023-05-09 10:13:42 +02:00
Paolo Tranquilli
8079af7ed6 Swift: add autobuild failure diagnostics 2023-05-08 12:54:18 +00:00
Mathias Vorreiter Pedersen
1f018d69ab Swift: Accept test changes. 2023-05-03 13:45:17 +01:00
Nora Dimitrijević
91a151ec2a Swift: update tests 2023-04-26 15:47:20 +02:00
AlexDenisov
3cd0af6622 Merge pull request #12700 from github/redsun82/swift-fix-wmo
Swift: extract all source files in WMO mode
2023-03-30 18:01:48 +02:00
Geoffrey White
704e42cf22 Swift: Accept integration test changes (not sure what caused this exactly but it looks OK to me). 2023-03-29 15:49:44 +01:00
Paolo Tranquilli
f3f17791c3 Swift: extract all source files in WMO mode
WMO stands for whole module optimization. It's a compilation mode where
all sources of a module are compiled together, e.g.
```
swift-frontend -emit-module A.swift B.swift -o Module.swiftmodule
```
This is opposed to incremental mode, where one would do something like
```
swift-frontend -emit-module -primary-file A.swift B.swift -module-name Module -o Module~A.swiftmodule
swift-frontend -emit-module A.swift -primary-file B.swift -module-name Module -o Module~B.swiftmodule
swift-frontend -merge-modules Module~A.swiftmodule Module~B.swiftmodule -o Module.swiftmodule
```

In WMO mode we were skipping extraction of all files after the first
one, because we were filtering in only files with an associated output,
and internally swift only assigns the output to the first input file in
WMO mode (which is just an implementation detail).

This patch refines that filter, by getting all input source files in
case there are no primary inputs.
2023-03-29 10:39:58 +02:00
Paolo Tranquilli
91ce88e2d9 Swift: make deduplication test cross-platform 2023-03-14 11:24:03 +01:00
Paolo Tranquilli
fcd14a78ab Swift: add an initial draft for a deduplication test 2023-03-13 15:55:45 +01:00
Paolo Tranquilli
50889b8fa1 Swift: move regex test to integration tests 2023-02-07 10:21:37 +01:00
Paolo Tranquilli
d201c1eadd Swift: support linux-only tests 2023-02-07 09:41:06 +01:00
Paolo Tranquilli
20eaa34485 Swift: failing tests for linkage awareness 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
874fe2b8f9 Swift: introduce an in-memory file hash cache
File hashing is now done internally in `SwiftFileInterception` (and
exported as a `getHashOfRealFile` function for future use in linkage
awareness), and using a per-process in-memory cache. The persistent
caching of paths is removed, so the solution is now robust against input
file changes during the build.

For the same reason, the hash to artifact mapping have the symlinks
reversed now. The artifacts themselves are stored using the hash as
filenames, and the original paths of the artifacts are reacreated in the
scratch dir with symlinks mostly for debugging purposes (to understand
what artifact each hash corresponds to, and to follow what was built by
the extractor).
2023-01-16 12:05:36 +01:00
Paolo Tranquilli
82d9edfabf Merge branch 'main' into redsun82/swift-open-redirection 2023-01-09 08:44:02 +01:00
Nora Dimitrijević
893ec33da0 Swift: update .expected for integration tests 2022-12-15 11:28:02 -05:00
Paolo Tranquilli
3084eda28a Swift: add swiftmodule hash map testing to frontend_invocations 2022-12-15 10:33:47 +01:00
Paolo Tranquilli
14fd89d482 Swift: generalize output redirection code 2022-12-14 18:26:48 +01:00
Paolo Tranquilli
4a41bb4061 Merge branch 'main' into redsun82/swift-open-redirection 2022-12-09 09:59:21 +01:00
Paolo Tranquilli
935e264f24 Swift: add empty directory marker 2022-12-08 17:04:56 +01:00
Paolo Tranquilli
bf1b32f210 Swift: rework file redirection
The hash map mechanism that was already in use for reading swiftmodule
files on macOS is now in use also on Linux. The output replacing
mechanism has been also reworked so that:
* frontend module emission modes have the remapping done directly in
  the internal frontend options instead of painstakingly modifying input
  flags (this requires a patch on the swift headers though)
* object emission mode is silenced to be just a type checking pass,
  thus producing no output files
* all other passes but some debugging and version related ones become
  noops

The open file read redirection uses a global weak pointer instance to
maximize robustness in the face of possibly multi-threaded calls to open
happening while `main` is exiting. Possibly overkill, but better safe
than sorry.
2022-12-08 16:10:44 +01:00
Paolo Tranquilli
1ba8b6d35a Swift: fix extraction of sources from .. 2022-12-08 15:57:57 +01:00
Alex Denisov
f5ddbd6abb Swift: add a test case showing case canonicalization 2022-12-02 14:06:21 +01:00
AlexDenisov
691188bc48 Merge pull request #11523 from github/alexdenisov/preserve-symlinks
Swift: resolve symlinks conditionally
2022-12-02 14:05:13 +01:00
Alex Denisov
7a3beac494 Swift: resolve symlinks conditionally 2022-12-02 10:07:10 +01:00
Alex Denisov
e7a48b4c98 Swift: add a test case for symlinks 2022-12-02 10:02:45 +01:00
Paolo Tranquilli
cd6d00e760 Swift: add xcode integration test 2022-12-01 17:25:34 +01:00
Paolo Tranquilli
4e29ff1d6e Swift: add -merge-modules to frontend-invocations test
Also, moved from Makefile to a bash source.
2022-11-30 17:46:47 +01:00
Paolo Tranquilli
28bf0c9e03 Merge pull request #11365 from github/redsun82/swift-integration-test-pack
Swift: fix extractor tests pack
2022-11-28 17:02:54 +01:00
Paolo Tranquilli
8df7d465cb Swift: cache more aggressively in CI
* the QL compilation cache action is used for ql and integration tests
* all caches (Bazel and QL) are populated on push
2022-11-25 08:52:46 +01:00
Paolo Tranquilli
414f18fc97 Swift: fix extractor tests pack
This allows `codeql query compile` to run on integration test queries.
2022-11-22 10:58:57 +01:00
Paolo Tranquilli
635391eae8 Swift: autopep8 integration tests 2022-11-15 15:43:05 +01:00
Chris Smowton
5ad5cdce47 Swift integration-test runner: use --additional-packs 2022-10-28 16:07:38 +01:00
Chris Smowton
ee63e60bb7 qlpacks: libraryPathDependencies -> dependencies 2022-10-28 16:07:36 +01:00
Paolo Tranquilli
6651c9447e Swift: failing test for extracting function bodies 2022-10-24 17:10:38 +02:00
dependabot[bot]
c3693f1a20 Swift: bump actions/setup-python from 3 to 4
Also fixes python version with a `.pythonversion` file.

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-19 18:10:42 +02:00
Paolo Tranquilli
57b8830972 Swift: fix integration tests 2022-08-30 11:46:27 +02:00
Paolo Tranquilli
7887f669c1 Merge pull request #10175 from github/redsun82/swift-missing-extractions
Swift: fix missing extractions
2022-08-26 14:09:09 +02:00
Paolo Tranquilli
ced36ffc61 Swift: run swift instead of swift-frontend on Linux 2022-08-26 12:12:21 +02:00
Paolo Tranquilli
c7c42acbf5 Swift: port frontend-invocations test to linux
`swift-frontend` will be in `$PATH` on Linux, and apparently it does
not require the `-sdk` option.
2022-08-26 12:03:18 +02:00
Paolo Tranquilli
df3dc9677f Swift: fix missing extractions from Builtin
There were missing extractions from the Builtin (and other) modules.

This was actually caused by two issues:
* we did not visit all required modules, as for example the `Builtin`
  module does not appear as being imported by anybody (together with
  another mysterious `__Objc` module)
* moreover the `Builtin` module works internally by only creating
  declarations on demand, and does not provide a list of its top level
  declarations.

The first problem was solved by moving module collection to the actual
visiting. This may mean we extract less modules, as we only extract the
modules we actually use something from (recursively). This change can
be reverted if we feel we need it.

The second one was solved by explicitly listing the builtin symbols
encountered during a normal extraction. This does mean this list needs
to be kept up to date.
2022-08-25 15:18:24 +02:00
Mathias Vorreiter Pedersen
de03fbdc49 Swift: Accept test changes. 2022-08-24 10:03:21 +01:00
Paolo Tranquilli
065fecc57e Swift: extract precompiled swiftmodule files
Previously we were not extracting any `swiftmodule` file that was not
a system or a built-in one. This was done to avoid re-extracting
`swiftmodule` files that were built previously in the same build, but it
turned out to be too eager, as there are legitimate cases where a
non-system, non-built-in precompiled swift module can be used. An
example of that is the `PackageDescription` module used in Swift
Package Manager manifest files (`Package.swift`).

We now relax the test and trigger module extraction on all loaded
modules that do not have source files (we trigger source file extraction
for those). The catch, is that we also create empty trap files for
current output `swiftmodule` files (including possible alias locations
set up by XCode).

This means that if a following extractor run loads a previously built
`swiftmodule` file, although it will trigger module extraction, this
will however be skipped as it will find its target file already present
(this is done via the `TargetFile` semantics).
2022-07-29 11:10:03 +02:00