Skip to content

Commit b3c4115

Browse files
committed
feat: ✨ setup escript compilation
1 parent f0329dd commit b3c4115

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ erl_crash.dump
2323
fp_lab3-*.tar
2424
# Temporary files, for example, from tests.
2525
/tmp/
26+
# Generated executables
27+
/out/
28+
!/out/.keep
2629

2730
### IntelliJ IDEA ###
2831
.idea/

lib/main.ex

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
defmodule InterpolationApp.Main do
2+
@moduledoc """
3+
Application entry point
4+
"""
5+
6+
@spec main([String.t()]) :: any()
7+
def main(args \\ []) do
8+
args
9+
|> parse_args()
10+
|> IO.puts()
11+
end
12+
13+
defp parse_args(args) do
14+
{opts, word, _} = args |> OptionParser.parse(switches: [upcase: :boolean])
15+
16+
{opts, List.to_string(word)}
17+
end
18+
end

mix.exs

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ defmodule FpLab3.MixProject do
1010
def project do
1111
[
1212
app: :fp_lab3,
13+
escript: escript(),
1314
elixir: "~> 1.17",
1415
elixirc_paths: elixirc_paths(Mix.env()),
1516
preferred_cli_env: [
@@ -37,6 +38,14 @@ defmodule FpLab3.MixProject do
3738
]
3839
end
3940

41+
defp escript do
42+
[
43+
main_module: InterpolationApp.Main,
44+
path: "./out/interpolation-app",
45+
name: "interpolation-app"
46+
]
47+
end
48+
4049
def application do
4150
[
4251
extra_applications: [:logger]

0 commit comments

Comments
 (0)