Skip to content

Commit

Permalink
feat: ✨ setup escript compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbarsukov committed Oct 27, 2024
1 parent f0329dd commit b3c4115
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ erl_crash.dump
fp_lab3-*.tar
# Temporary files, for example, from tests.
/tmp/
# Generated executables
/out/
!/out/.keep

### IntelliJ IDEA ###
.idea/
Expand Down
18 changes: 18 additions & 0 deletions lib/main.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule InterpolationApp.Main do
@moduledoc """
Application entry point
"""

@spec main([String.t()]) :: any()
def main(args \\ []) do
args
|> parse_args()
|> IO.puts()
end

defp parse_args(args) do
{opts, word, _} = args |> OptionParser.parse(switches: [upcase: :boolean])

{opts, List.to_string(word)}
end
end
9 changes: 9 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule FpLab3.MixProject do
def project do
[
app: :fp_lab3,
escript: escript(),
elixir: "~> 1.17",
elixirc_paths: elixirc_paths(Mix.env()),
preferred_cli_env: [
Expand Down Expand Up @@ -37,6 +38,14 @@ defmodule FpLab3.MixProject do
]
end

defp escript do
[
main_module: InterpolationApp.Main,
path: "./out/interpolation-app",
name: "interpolation-app"
]
end

def application do
[
extra_applications: [:logger]
Expand Down

0 comments on commit b3c4115

Please sign in to comment.