Commit graph

69 commits

Author SHA1 Message Date
Olivier Goffart
5a7fa5bf11 Add an option to generate dependency file
For issue #135
2020-12-15 18:13:16 +01:00
Simon Hausmann
87e0cc7d85 Fix resource embedding doing a wasm build of a project using the sixtyfps! macro
We need to embed resources in wasm builds. Unfortunately we can't detect
that we're called by say wasm-pack and "TARGET"/"HOST" only works inside
build.rs. So instead, to keep things simple, this change always embeds
the image resources when targeting Rust.

The `SIXTYFPS_EMBED_RESOURCES` environment variable can be used to
override this anywhere for any language.

Fixes #130
2020-12-10 15:09:32 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Olivier Goffart
65ec7e9b7d Fix panic on parse error
Properly report the errors instead.

The later passes panic if the AST is not well formed
2020-10-19 19:43:13 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00
Simon Hausmann
ff9c118e07 Propagate warnings to the end of the compilation step and print them 2020-09-04 20:34:20 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
09cae799d3 Fix return type of compile_syntax_node
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Simon Hausmann
2f0718bffa Add include path options to the viewer and compiler
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
2020-07-17 15:26:35 +02:00
Simon Hausmann
732a56259f Simplify compilation call sites further
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
Simon Hausmann
c3aae7648a Further simplify compilation call sites
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +02:00
Simon Hausmann
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00
Simon Hausmann
8e047d3761 Simplify compiler diagnostics API
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.

There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Simon Hausmann
5b43962bb2 Split up TypeRegistry
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
2020-07-15 13:09:43 +02:00
Simon Hausmann
ba15a768d6 Add the ability to output rust code to the compiler cli 2020-06-29 09:00:35 +02:00
Olivier Goffart
e95d7da888 Parser: typed syntax node accessor 2020-06-11 17:50:28 +02:00
Simon Hausmann
1404cb73ae Add support for embedding resources in the rust generator
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).

What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.
2020-06-09 22:54:29 +02:00
Olivier Goffart
3651885d87 Move the compiler binary in tools/
And rename sixtyfps_compiler to sixtyfps_compilerlib
2020-06-05 09:23:38 +02:00
Renamed from sixtyfps_compiler/main.rs (Browse further)