2022-01-18 00:34:38 +08:00
|
|
|
defmodule AppBuilder do
|
2022-06-02 04:29:54 +08:00
|
|
|
def bundle(release) do
|
|
|
|
os = os()
|
2022-01-18 00:34:38 +08:00
|
|
|
|
2022-06-02 04:29:54 +08:00
|
|
|
allowed_options = [
|
|
|
|
:name,
|
|
|
|
:server,
|
|
|
|
icon_path: [
|
|
|
|
macos: Application.app_dir(:wx, "examples/demo/erlang.png")
|
|
|
|
],
|
|
|
|
url_schemes: [],
|
|
|
|
document_types: [],
|
|
|
|
additional_paths: [],
|
|
|
|
macos_is_agent_app: false,
|
|
|
|
macos_build_dmg: false,
|
|
|
|
macos_notarization: nil,
|
|
|
|
windows_build_installer: true
|
|
|
|
]
|
2022-03-02 19:06:30 +08:00
|
|
|
|
2022-06-02 04:29:54 +08:00
|
|
|
options = Keyword.validate!(release.options[:app], allowed_options)
|
|
|
|
|
|
|
|
case os do
|
|
|
|
:macos ->
|
|
|
|
AppBuilder.MacOS.bundle(release, options)
|
|
|
|
|
|
|
|
:windows ->
|
|
|
|
AppBuilder.Windows.bundle(release, options)
|
|
|
|
end
|
|
|
|
end
|
2022-05-27 20:45:20 +08:00
|
|
|
|
|
|
|
def os do
|
|
|
|
case :os.type() do
|
|
|
|
{:unix, :darwin} -> :macos
|
|
|
|
{:win32, _} -> :windows
|
|
|
|
end
|
|
|
|
end
|
2022-01-18 00:34:38 +08:00
|
|
|
end
|