11app [main!] {
2- # TODO replace with snake_case_builtins release
3- cli: platform " ../basic-cli/platform/main.roc" ,
4- weaver: " https://github.com/smores56/weaver/releases/download/0.6.0/6WdRio4quZ_3HL8cEY_vyx5mzl1xXrEv2a_c1Bswrq4.tar.br" ,
2+ cli: platform " https://github.com/roc-lang/basic-cli/releases/download/0.19.0/bi5zubJ-_Hva9vxxPq4kNx4WHX6oFs8OP6Ad0tCYlrY.tar.br" ,
3+ weaver: " https://github.com/smores56/weaver/releases/download/0.6.0/4GmRnyE7EFjzv6dDpebJoWWwXV285OMt4ntHIc6qvmY.tar.br" ,
54}
65
76import cli.Cmd
@@ -16,28 +15,30 @@ import weaver.Cli
1615## run with: roc ./build.roc
1716##
1817main ! : _ => Result {} _
19- main ! = \ args ->
18+ main ! = | args|
2019
2120 parsed_args =
2221 Result . on_err !(
2322 Cli . parse_or_display_message (cli_parser , args, Arg . to_os_raw ),
24- \ message -> Err (Exit 1 message),
23+ | message| Err (Exit ( 1 , message) ),
2524 )?
2625
2726 run!(parsed_args)
2827
2928cli_parser =
30- Opt . maybe_str { short: " p" , long: " roc" , help: " Path to the roc executable. Can be just `roc` or a full path." }
31- |> Cli . finish {
32- name: " basic-webserver-builder" ,
33- version: " " ,
34- authors: [" Luke Boswell <https://github.com/lukewilliamboswell>" ],
35- description: " Generates all files needed by Roc to use this basic-cli platform." ,
36- }
29+ Opt . maybe_str ({ short: " p" , long: " roc" , help: " Path to the roc executable. Can be just `roc` or a full path." })
30+ |> Cli . finish (
31+ {
32+ name: " basic-webserver-builder" ,
33+ version: " " ,
34+ authors: [" Luke Boswell <https://github.com/lukewilliamboswell>" ],
35+ description: " Generates all files needed by Roc to use this basic-cli platform." ,
36+ },
37+ )
3738 |> Cli . assert_valid
3839
3940run ! : Result Str err => Result {} _
40- run ! = \ maybe_roc ->
41+ run ! = | maybe_roc|
4142
4243 # roc_cmd may be a path or just roc
4344 roc_cmd = maybe_roc |> Result . with_default ("roc ")
@@ -61,30 +62,30 @@ run! = \maybe_roc ->
6162 info!(" Successfully built platform files!" )
6263
6364roc_version ! : Str => Result {} _
64- roc_version ! = \ roc_cmd ->
65+ roc_version ! = | roc_cmd|
6566
6667 info!(" Checking provided roc; executing `${roc_cmd} version`:" )?
6768
6869 Cmd . exec !(roc_cmd , [" version" ])
6970 |> Result . map_err (RocVersionCheckFailed )
7071
7172get_os_and_arch ! : {} => Result OSAndArch _
72- get_os_and_arch ! = \{} ->
73+ get_os_and_arch ! = |{}|
7374
7475 info!(" Getting the native operating system and architecture..." )?
7576
7677 convert_os_and_arch(Env . platform !({}))
7778
7879build_stub_app_lib ! : Str , Str => Result {} _
79- build_stub_app_lib ! = \ roc_cmd, stub_lib_path ->
80+ build_stub_app_lib ! = | roc_cmd, stub_lib_path|
8081
8182 info!(" Building stubbed app shared library ..." )?
8283
8384 Cmd . exec !(roc_cmd , [" build" , " --lib" , " platform/libapp.roc" , " --output" , stub_lib_path, " --optimize" ])
8485 |> Result . map_err (ErrBuildingAppStub )
8586
8687get_rust_target_folder ! : {} => Result Str _
87- get_rust_target_folder ! = \{} ->
88+ get_rust_target_folder ! = |{}|
8889 when Env . var !("CARGO_BUILD_TARGET ") is
8990 Ok (target_env_var) ->
9091 if Str . is_empty (target_env_var ) then
@@ -98,15 +99,15 @@ get_rust_target_folder! = \{} ->
9899 Ok (" target/release/" )
99100
100101cargo_build_host ! : {} => Result {} _
101- cargo_build_host ! = \{} ->
102+ cargo_build_host ! = |{}|
102103
103104 info!(" Building rust host ..." )?
104105
105106 Cmd . exec !("cargo ", [" build" , " --release" ])
106107 |> Result . map_err (ErrBuildingHostBinaries )
107108
108109copy_host_lib ! : OSAndArch , Str => Result {} _
109- copy_host_lib ! = \ os_and_arch, rust_target_folder ->
110+ copy_host_lib ! = | os_and_arch, rust_target_folder|
110111 host_build_path = " ${rust_target_folder}libhost.a"
111112 host_dest_path = " platform/${prebuilt_static_lib_file(os_and_arch)}"
112113
@@ -125,7 +126,7 @@ OSAndArch : [
125126]
126127
127128convert_os_and_arch : _ -> Result OSAndArch _
128- convert_os_and_arch = \ { os, arch } ->
129+ convert_os_and_arch = | { os, arch }|
129130 when (os, arch) is
130131 (MACOS , AARCH64 ) -> Ok (MacosArm64 )
131132 (MACOS , X64 ) -> Ok (MacosX64 )
@@ -134,14 +135,14 @@ convert_os_and_arch = \{ os, arch } ->
134135 _ -> Err (UnsupportedNative (os, arch))
135136
136137stub_file_extension : OSAndArch -> Str
137- stub_file_extension = \ os_and_arch ->
138+ stub_file_extension = | os_and_arch|
138139 when os_and_arch is
139140 MacosX64 | MacosArm64 -> " dylib"
140141 LinuxArm64 | LinuxX64 -> " so"
141142 WindowsX64 | WindowsArm64 -> " dll"
142143
143144prebuilt_static_lib_file : OSAndArch -> Str
144- prebuilt_static_lib_file = \ os_and_arch ->
145+ prebuilt_static_lib_file = | os_and_arch|
145146 when os_and_arch is
146147 MacosArm64 -> " macos-arm64.a"
147148 MacosX64 -> " macos-x64.a"
@@ -151,7 +152,7 @@ prebuilt_static_lib_file = \os_and_arch ->
151152 WindowsX64 -> " windows-x64.lib"
152153
153154preprocess_host ! : Str , Str , Str => Result {} _
154- preprocess_host ! = \ roc_cmd, stub_lib_path, rust_target_folder ->
155+ preprocess_host ! = | roc_cmd, stub_lib_path, rust_target_folder|
155156
156157 info!(" Preprocessing surgical host ..." )?
157158
@@ -162,5 +163,5 @@ preprocess_host! = \roc_cmd, stub_lib_path, rust_target_folder ->
162163 |> Result . map_err (ErrPreprocessingSurgicalBinary )
163164
164165info ! : Str => Result {} _
165- info ! = \ msg ->
166+ info ! = | msg|
166167 Stdout . line !("\u (001b)[34mINFO:\u (001b)[0m ${msg}" )
0 commit comments