mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
Have RustGlue bundle roc_std
This commit is contained in:
parent
74e28efeff
commit
416d8e21b0
3 changed files with 39 additions and 5 deletions
|
@ -1,6 +1,17 @@
|
|||
app "rust-glue"
|
||||
packages { pf: "../platform/main.roc" }
|
||||
imports [pf.Types.{ Types }, pf.Shape.{ Shape, RocFn }, pf.File.{ File }, pf.TypeId.{ TypeId }]
|
||||
imports [
|
||||
pf.Types.{ Types }, pf.Shape.{ Shape, RocFn }, pf.File.{ File }, pf.TypeId.{ TypeId },
|
||||
"../static/Cargo.toml" as rocAppCargoToml : Str,
|
||||
"../../roc_std/Cargo.toml" as rocStdCargoToml : Str,
|
||||
"../../roc_std/src/lib.rs" as rocStdLib : Str,
|
||||
"../../roc_std/src/roc_box.rs" as rocStdBox : Str,
|
||||
"../../roc_std/src/roc_list.rs" as rocStdList : Str,
|
||||
"../../roc_std/src/roc_dict.rs" as rocStdDict : Str,
|
||||
"../../roc_std/src/roc_set.rs" as rocStdSet : Str,
|
||||
"../../roc_std/src/roc_str.rs" as rocStdStr : Str,
|
||||
"../../roc_std/src/storage.rs" as rocStdStorage : Str,
|
||||
]
|
||||
provides [makeGlue] to pf
|
||||
|
||||
makeGlue : List Types -> Result (List File) Str
|
||||
|
@ -22,9 +33,25 @@ makeGlue = \typesByArch ->
|
|||
|
||||
typesByArch
|
||||
|> List.map convertTypesToFile
|
||||
|> List.append { name: "mod.rs", content: modFileContent }
|
||||
|> List.append { name: "roc_app/src/lib.rs", content: modFileContent }
|
||||
|> List.concat staticFiles
|
||||
|> Ok
|
||||
|
||||
## These are always included, and don't depend on the specifices of the app.
|
||||
staticFiles : List File
|
||||
staticFiles =
|
||||
[
|
||||
{ name: "roc_app/Cargo.toml", content: rocAppCargoToml },
|
||||
{ name: "roc_std/Cargo.toml", content: rocStdCargoToml },
|
||||
{ name: "roc_std/src/lib.rs", content: rocStdLib },
|
||||
{ name: "roc_std/src/roc_box.rs", content: rocStdBox },
|
||||
{ name: "roc_std/src/roc_list.rs", content: rocStdList },
|
||||
{ name: "roc_std/src/roc_dict.rs", content: rocStdDict },
|
||||
{ name: "roc_std/src/roc_set.rs", content: rocStdSet },
|
||||
{ name: "roc_std/src/roc_str.rs", content: rocStdStr },
|
||||
{ name: "roc_std/src/storage.rs", content: rocStdStorage },
|
||||
]
|
||||
|
||||
convertTypesToFile : Types -> File
|
||||
convertTypesToFile = \types ->
|
||||
content =
|
||||
|
@ -94,7 +121,7 @@ convertTypesToFile = \types ->
|
|||
archStr = archName arch
|
||||
|
||||
{
|
||||
name: "\(archStr).rs",
|
||||
name: "roc_app/src/\(archStr).rs",
|
||||
content: content |> generateEntryPoints types,
|
||||
}
|
||||
|
||||
|
|
8
crates/glue/static/Cargo.toml
Normal file
8
crates/glue/static/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "roc_app"
|
||||
description = "This was generated by `roc glue`. It provides glue between a specific Roc platform and a Rust host."
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
roc_std = { path = "../roc_std" }
|
|
@ -1,7 +1,6 @@
|
|||
[package]
|
||||
name = "roc_std"
|
||||
description = "Rust representations of Roc data structures"
|
||||
readme = "README.md"
|
||||
|
||||
authors = ["The Roc Contributors"]
|
||||
edition = "2021"
|
||||
|
@ -26,4 +25,4 @@ serde = ["dep:serde"]
|
|||
std = []
|
||||
|
||||
[package.metadata.cargo-udeps.ignore]
|
||||
development = ["quickcheck_macros", "serde_json"]
|
||||
development = ["quickcheck_macros", "serde_json"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue