Skip to content

Conversation

@Caellian
Copy link
Collaborator

ArgumentList is now used for passing a collection of arguments around. It's better than [AsRef<OsStr>] because it can accept a lot of different argument specifications:

  • All AsRef<OsStr> types directly, without slices,
  • [AsRef<OsStr>] same as before,
  • Vec<OsStr>,
  • Tuples of Into<ArgumentList> (all of the above and self), which get chained,
  • Unit, i.e. empty tuples.

Basically, this makes it very easy to call commands - instead of having to convert all types into the same type and pack them into a slice, one can simply list all parameters in a tuple and it will be converted into a slice using the shortest conversion route.

So calls that previously looked like:
cmd(&command,
&[
    file.as_os_str(),
    OsStr::new("-O3"),
    OsStr::new("--enable-bulk-memory"),
    OsStr::new("-o"),
    output.as_os_str(),
])
, now look like:
cmd(&command,
(
    file,
    "-O3",
    "--enable-bulk-memory",
    "-o",
    output,
))

That's a small example, there's cases where this visual noise has been significantly reduced as well as several intermediate variables removed.

Other changes:

  • Restructured xtask code into modules.
  • Moved distributables from typst-package into dist folder.
    • typst-package now only contains actual package sources (and manual).
  • Made manual build reproducible by specifying last change time as build time instead of using current system time.
  • Simplified code that handles configuration by using a trait that coalesces input types instead of previous macros.
  • Improved cross-platform support for strings in Configure.

ArgumentList is now used for passing a collection of arguments around.
It's better than `[AsRef<OsStr>]` because it can accept a lot of
different argument specifications:
- All `AsRef<OsStr>` types directly, without slices,
- `[AsRef<OsStr>]` same as before,
- `Vec<OsStr>`,
- Tuples of `Into<ArgumentList>` (all of the above and self), which get chained,
- Unit, i.e. empty tuples.

Basically, this makes it very easy to call commands - instead of having
to convert all types into the same type and pack them into a slice, one
can simply list all parameters in a tuple and it will be converted into
a slice using the shortest conversion route.

Other changes:
- Restructured xtask code into modules.
- Moved distributables from typst-package into dist folder.
  - typst-package now only contains actual package sources (and manual).
- Made manual build reproducible by specifying last change time as build
  time instead of using current system time.
- Simplified code that handles configuration by using a trait that
  coalesces input types instead of previous macros.
- Improved cross-platform support for strings in Configure.

Signed-off-by: Tin Švagelj <[email protected]>
- Use variables in ci.yaml

Signed-off-by: Tin Švagelj <[email protected]>
Signed-off-by: Tin Švagelj <[email protected]>
@Caellian Caellian marked this pull request as draft December 24, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants