Commit Graph

45 Commits

Author SHA1 Message Date
Paolo Tranquilli
83b3711973 Swift: update fmt 2025-11-19 14:32:37 +01:00
Cornelius Riemenschneider
53ca5083a9 Upgrade bazel to 8.0.0.
Previously, we were using 8.0.0rc1.
In particular, this upgrade means we need to explicitly
import more rules, as they've been moved out of the core bazel repo.
2024-12-10 12:05:37 +01:00
Paolo Tranquilli
9f5782b67b Bazel: introduce buildifier formatting
This introduces tooling and enforcement for formatting bazel files.

The tooling is provided as a bazel run target from
[keith/buildifier-prebuilt](https://github.com/keith/buildifier-prebuilt).

This is used in a [`pre-commit`](https://pre-commit.com/) hook for those
having that installed. In turn this is used in a CI check. Relying on a
`pre-commit` action gives us easy checking that buildifying did not
change anything in the files and printing the diff, without having to
hand-roll the check ourselves.

This enforcement will make usage of gazelle easier, as gazelle itself
might reformat files, even outside of `go`. Having them properly
formatted will allow gazelle to leave them unchanged, without needing
to configure awkward exclude directives.
2024-04-24 15:49:48 +02:00
Paolo Tranquilli
148033e020 Swift: fix assertion diagnostics test 2024-03-25 12:05:22 +01:00
Paolo Tranquilli
0fa40af131 Swift: fix last references to old integration test location 2024-03-25 11:49:19 +01:00
Paolo Tranquilli
9cfef6e42f Bazel/CMake: auto detect all cc_binary/cc_test targets 2024-02-07 11:11:30 +01:00
Paolo Tranquilli
33b6ce7365 Swift: update formatting to clang-format 17.0.6
Also, added a format check in `swift.yml`.
2024-01-25 13:58:14 +01:00
Calum Grant
d57fc3d7db C++: Remove unneeded includes 2024-01-17 14:34:28 +00:00
Calum Grant
51c5afff8b Create shared/cpp library and move Diagnostics there 2024-01-17 14:23:18 +00:00
Calum Grant
7cadb0a574 Swift extractor: Simplify declarations back 2024-01-16 11:31:15 +00:00
Calum Grant
2cc574dc70 Swift extractor: Use a global variable for the extractor name 2024-01-16 10:56:18 +00:00
Calum Grant
f82c29ee37 Swift extractor: Generalize SwiftDiagnostics 2024-01-15 09:12:26 +00:00
Alexandre Boulgakov
bc48968def Swift: Build incompatible OS diagnostic on all platforms. 2023-06-16 17:22:43 +01:00
Alexandre Boulgakov
9ec09000e5 Swift: Remove no longer needed code. 2023-06-08 14:52:58 +01:00
Alexandre Boulgakov
5450585c1c Swift: Remove SwiftDiagnostic constructor (C++20 todo). 2023-06-08 13:11:14 +01:00
Alexandre Boulgakov
838130ca3a Swift: Fix some C++20 todos. 2023-06-08 13:11:14 +01:00
Paolo Tranquilli
400176f677 Swift: fix cmake generation
The bazel -> cmake generator is currently not capable of handling
separate included generated cmake files making use of common C/C++
dependencies.

To work around this limitation, a single generated cmake is now in
place. Long-term, we should either:
* make the cmake generator handle common dependencies gracefully, or
* make the cmake generation aspect travel up `pkg_` rules `srcs`
  attributes
so to avoid having to list the targets to be generated in the top-level
`BUILD` file.

Other things fixed:
* removed some warning spam about redefined `BAZEL_CURRENT_REPOSITORY`
* fixed the final link step, that was failing because `libswiftCore.so`
  was not being linked.
2023-06-05 11:12:11 +02:00
Alexandre Boulgakov
b3e76d6052 Swift: Drop support for plaintext diagnostics (and helpLinks).
The recommended option is Markdown diagnostics, and we have already migrated everything to emit them. The empty help link we're currently emitting everywhere is a bug.
2023-05-19 15:16:02 +01:00
Alexandre Boulgakov
110b766770 Swift: Add a . to a test message to match the logging API change in this PR. 2023-05-19 14:46:12 +01:00
Alexandre Boulgakov
1e9b849e93 Merge branch 'main' into redsun82/swift-diagnostics-wording 2023-05-19 14:43:01 +01:00
Alexandre Boulgakov
060a48571a Swift: Emit diagnostics on assertion/expectation violations. 2023-05-16 19:40:00 +01:00
Alexandre Boulgakov
7ada125299 Swift: Support fmtlib for assertions/expectations.
Specifically, this adds custom formatters using `path::operator string()` and `error_code::message()` and dereferences a (non-empty) optional. `fmtlib` provides formatters for these standard library types in `fmt/std.h`, but that file also requires RTTI (which we disable) for `std::exception` so we can't use it without either patching `fmtlib` (which they're open to: https://github.com/fmtlib/fmt/issues/3170) or enabling RTTI (which will require some consideration).
2023-05-16 18:33:28 +01:00
Paolo Tranquilli
42d40900d3 Swift: reword TSP diagnostics after doc team review 2023-05-16 17:52:02 +02:00
Paolo Tranquilli
7e61e99e4a Swift: make help links optional argument more explicit 2023-05-16 16:52:22 +02:00
Paolo Tranquilli
8291b2229a Swift: turn internal error into a TSP warning 2023-05-16 15:18:29 +02:00
Paolo Tranquilli
10d084fbbf Swift: update comment 2023-05-15 13:48:24 +02:00
Paolo Tranquilli
cfcd26cf0d Swift: support markdown TSP diagnostics 2023-05-15 13:48:24 +02:00
Paolo Tranquilli
dbff3e4fa4 Swift: remove unneeded SwiftDiagnosticLogWrapper 2023-05-15 10:08:43 +02:00
Paolo Tranquilli
a2cb331ebe Swift: remove hacky binlog interception 2023-05-15 10:02:24 +02:00
Paolo Tranquilli
9ffada31a8 Swift: make internal error telemetry only for the moment 2023-05-12 09:19:44 +02:00
Paolo Tranquilli
cce9352272 Swift: add visibility customization to diagnostics 2023-05-12 09:05:45 +02:00
Paolo Tranquilli
dedbd9ab63 Swift: remove unneeded SwiftDiagnosticsDumper 2023-05-12 08:30:43 +02:00
Paolo Tranquilli
86777fa4c2 Swift: remove obsolete comment 2023-05-12 08:23:14 +02:00
Paolo Tranquilli
03f4625b5f Swift: go back to explicit DIAGNOSE_ERROR macros 2023-05-12 06:30:58 +02:00
Paolo Tranquilli
3f2a059b3b Swift: add location support to TSP diagnostics
This required a bit of an overhaul of the original integration of
JSON diagnostics into binlog.

The problem is that it is quite hard to add a kind of metadata to
binlog entries without changing its code. Another problem is that when
wanting to avoid double evaluation of logging macro arguments one
cannot really add a separate "diagnose" step easily.

The proposed solution consists in two things:
* hook into a binlog plumbing function by providing a better overload
  resolution match, which happens after logging macro expansion,
  bypassing the problem of double evaluation
* in that hook, produce the diagnostic directly, without waiting to
  reconstruct the diagnostics entry from the binlog serialized entry.

This allows to forgo the weird category to diagnostic mapping, and now a
diagnostics emission simply happens when a diagnostic source is given
as the first argument after the log format string. A flavour of
diganostics sources with locations is then added with the same
mechanism, allowing to write something like
```cpp
LOG_ERROR("[{}] ouch!", internalError.withLocation("foo.swift", 32));
```
2023-05-11 17:52:02 +02:00
Paolo Tranquilli
c677c04c0c Swift: fix wrong if (diagnostics) block placement 2023-05-10 07:03:53 +02:00
Paolo Tranquilli
ec3c63a2b3 Swift: replace all usages of std::to_string with absl::StrCat or absl::StrAppend 2023-05-10 07:03:06 +02:00
Paolo Tranquilli
84c017083f Swift: add configuration of diagnostics logs 2023-05-09 14:42:43 +02:00
Paolo Tranquilli
ca94b20284 Swift: auto-flush logs on errors 2023-05-09 14:42:21 +02:00
Paolo Tranquilli
2904aa8439 Revert "Swift: auto-flush logs at exit"
This reverts commit 0d9dcb161f.

This turns out to introduce a subtle bug related to destruction order
between `Log::instance()` and the `Logger` instances.
2023-05-09 13:08:28 +02:00
Paolo Tranquilli
0d9dcb161f Swift: auto-flush logs at exit 2023-05-09 10:08:34 +02:00
Paolo Tranquilli
8079af7ed6 Swift: add autobuild failure diagnostics 2023-05-08 12:54:18 +00:00
Paolo Tranquilli
7ce1189e36 Swift: tweak after review comments 2023-05-04 15:14:46 +02:00
Paolo Tranquilli
d61e366441 Swift: replace assert with CODEQL_ASSERT 2023-05-04 12:15:58 +02:00
Paolo Tranquilli
bce483ddb1 Swift: rename log package to logging 2023-05-04 10:42:39 +02:00