210 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
59880160c9 Testsuite: disable Dune's cache
Tests are not supposed to write outside of their working space, so dune
should not use a cache in the home directory: because of this, OCaml
tests currently fail when the Secure Control Plane is enabled. Disable
the Dune Cache to avoid this.
2026-02-11 13:27:05 +00:00
Pierre-Marie de Rodat
b950d445c9 Testsuite: decorrelate Python distribs for e3-testsuite and Langkit
Introduce the testsuite `--with-langkit-python` option so that it is
possible to have:

* one interpreter with the e3 distribution (to run the testsuite),
* one interpreter with Langkit installed (to run lkm and the various
  scripts using Langkit modules),
* one bare interpreter to import Langkit-generated libraries.
2026-02-02 11:25:47 +00:00
Pierre-Marie de Rodat
d5fafd3f76 Testsuite: fix directory separator baseline discrepancies on Windows 2026-01-22 13:10:09 +01:00
Pierre-Marie de Rodat
6cd2a8c3e7 Testsuite: extend lkt_compile.py for multi-dir Lkt sources
The upcoming revamp of Lkt modules will make it impossible to have
multiple Lkt source files share common declarations (`common_*.lkt`)
with bi-directional references: the individual sources can import
entities from the definite `common_*` modules, but the common modules
do not have a specific module for their own imports.

To overcome this, extend the `lkt_compile.py` script so that it
considers `test.lkt` sources in test subdirectories, and arrange for the
Lkt source path to make the top-level directory available: this will
allow test files to all have the same name (they will be in separate
directories), and so the common files will have a specific module name
to use for imports.
2026-01-20 16:03:43 +00:00
Hugo Guerrier
cee9beec1a Don't use the Maven shade plugin anymore
This is a requirement following making Lankit nodes, analysis units and
tokens Truffle objects (and depending at runtime on the 'truffle-api'
module).
Including 'truffle-api' in a shaded JAR breaks its compatibility with
the 'native-image' tool, causing tests to fail. We now package Java
bindings dependencies in the '<build_dir>/java/target/lib' directory.
This solution is currently the one used by the Langkit generic LSP and
LKQL JIT.
2026-01-15 09:40:14 +00:00
Hugo Guerrier
5368a244fc utils.py: Disable the strict code compilation during the native-image process 2025-10-03 14:26:30 +02:00
Hugo Guerrier
565f495544 Adapt Java testing tools to the new GraalVM version 2025-08-22 09:26:09 +00:00
Hugo Guerrier
a0a85d0a81 Don't use 'TruffleString' anymore to decode Langkit's UTF-32 buffers
We now use the standard Java library.
Also exclude the Truffle API from the shaded JAR.
2025-08-22 09:26:09 +00:00
Pierre-Marie de Rodat
6e87e1686d Remove ambient locations for diagnostics 2025-05-26 13:52:53 +00:00
Pierre-Marie de Rodat
b8d7fa75c2 langkit.config: use metaprogramming to implement JSON decoding 2025-04-03 14:41:28 +00:00
Pierre-Marie de Rodat
6cefc74c93 Set up pre-commit checks and reformat the Python sources with black 2025-03-26 14:04:20 +00:00
Pierre-Marie de Rodat
30d4905bbd Remove support to infer DSL location from Python tracebacks
Now that the Python DSL is retired, it no longer makes any sense to call
`langkit.diagnostics.extract_location_from_traceback`, as no traceback
frame will even contain location information that is meaningful for the
DSL. Replace it with explicit `location` constructor arguments instead.
2025-03-24 15:39:29 +00:00
Pierre-Marie de Rodat
06fb6d69f8 lkm: rename the "setenv" command to "printenv" 2025-03-10 16:23:41 +00:00
Pierre-Marie de Rodat
df73d23e3b Stop supporting the Python DSL
Remove the `lexer` and `grammar` arguments for `CompileCtx.__init__` as
well as the `types_from_lkt` config setting, and make the `lkt_spec`
config entry mandatory: all aspects of language specs now have to come
from Lkt source code.
2025-02-17 12:02:08 +01:00
Pierre-Marie de Rodat
708e41a148 Remove langkit.dsl_unparse 2025-02-06 09:31:49 +00:00
Pierre-Marie de Rodat
f749c71c6b langkit.libmanage: always give direct access to C headers
For some commands, like "lkm setenv" or "lkm run", it is not possible to
determine whether direct access to C headers will be needed eventually,
so unconditionally give access to them. Since the only C header present
in the generated sources is the language-specific header, this should
not be a problem in practice.
2025-01-20 15:35:14 +00:00
Pierre-Marie de Rodat
434e426223 langkit.config: enable types_from_lkt by default for LktSpec 2025-01-20 15:18:25 +00:00
Pierre-Marie de Rodat
3fbb1c38b7 langkit.config: rename "lkt" to "lkt_spec" 2025-01-09 19:59:12 +00:00
Pierre-Marie de Rodat
8beccff706 Introduce lkm, the replacement for manage.py scripts
This new command line tool has the same CLI as current manage.py
scripts, but automatically loads "langkit.yaml" files configurations, so
that language specs do not have to write Python code to subclass
ManageScript.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
8bec684f53 langkit.config: keep LibraryConfig.root_directory init. automatic
The root directory is always supposed to be inferred from the context
(where manage.py or langkit.yaml files are located): do not allow the
YAML configuration to initialize it.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
389d78a6e7 langkit.config: introduce JSON deserialization
Also rework lkt_compile and lkt_build_and_run test drivers so that the
language spec configuration bits are stored in the testcase's test.yaml
file directly: no need to add glue code in various places (test driver,
lkt_compile.py/lkt_build_and_run.py scripts) to support a new kind of
language spec configuration.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
109fd493c7 Introduce separate data structure to hold the language spec config
Replace the messy collection of arguments for CompileCtx.__init__ and
CompileCtx.create_all_passes with better organized dataclasses in the
new langkit.config module. Update the codebase to use these data
structures.
2025-01-07 09:54:56 +00:00
Pierre-Marie de Rodat
f9b87d6887 lkt_build_and_run: show subprocess output even for error return codes
When a main fails, we want to have its output included in logs for
debuggability. Previous changes in support code broke that behavior.
2024-12-05 15:26:20 +01:00
Pierre-Marie de Rodat
bdc9fd4c3b Testsuite: fix test output encoding issues on Windows 2024-12-03 14:02:36 +00:00
Pierre-Marie de Rodat
636c6b9bf3 Unparsing: fix the handling of non-UTF-8 sources in the unparse main
Add a --charset argument that the unparse main uses to decode the source
files to reformat, and to encode the reformatted content. Also enhance
the lkt_build_and_run driver so that it can run mains with heterogeneous
encodings (one that outputs UTF-8 and another that outputs ISO-8859-1,
for instance).
2024-11-28 14:47:19 +00:00