summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Muskała <michal@muskala.eu>2018-12-05 17:10:56 +0100
committerGitHub <noreply@github.com>2018-12-05 17:10:56 +0100
commitebf71774384e0e97ce04cdec32c5e327a09637ca (patch)
tree7ed04ff45065da3be5bb3c63b9d3153080b7784d
parentfad027f029151219969b530fb8545682a4896c77 (diff)
downloadelixir-ebf71774384e0e97ce04cdec32c5e327a09637ca.tar.gz
Simplify Makefile by introducing --path option to compile.app task (#8438)
-rw-r--r--Makefile6
-rw-r--r--lib/mix/lib/mix/tasks/compile.app.ex6
2 files changed, 5 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index adb6fc7e9..727f959b3 100644
--- a/Makefile
+++ b/Makefile
@@ -34,11 +34,7 @@ define APP_TEMPLATE
$(1): lib/$(1)/ebin/Elixir.$(2).beam lib/$(1)/ebin/$(1).app
lib/$(1)/ebin/$(1).app: lib/$(1)/mix.exs
- $(Q) mkdir -p lib/$(1)/_build/shared/lib/$(1)
- $(Q) cp -R lib/$(1)/ebin lib/$(1)/_build/shared/lib/$(1)/
- $(Q) cd lib/$(1) && ../../bin/elixir -e 'Mix.start(:permanent, [])' -r mix.exs -e 'Mix.Task.run("compile.app")'
- $(Q) cp lib/$(1)/_build/shared/lib/$(1)/ebin/$(1).app lib/$(1)/ebin/$(1).app
- $(Q) rm -rf lib/$(1)/_build
+ $(Q) cd lib/$(1) && ../../bin/elixir -e 'Mix.start(:permanent, [])' -r mix.exs -e 'Mix.Task.run("compile.app", ~w[--compile-path ebin])'
lib/$(1)/ebin/Elixir.$(2).beam: $(wildcard lib/$(1)/lib/*.ex) $(wildcard lib/$(1)/lib/*/*.ex) $(wildcard lib/$(1)/lib/*/*/*.ex)
@ echo "==> $(1) (compile)"
diff --git a/lib/mix/lib/mix/tasks/compile.app.ex b/lib/mix/lib/mix/tasks/compile.app.ex
index c8f93d737..943cf9e3d 100644
--- a/lib/mix/lib/mix/tasks/compile.app.ex
+++ b/lib/mix/lib/mix/tasks/compile.app.ex
@@ -82,6 +82,8 @@ defmodule Mix.Tasks.Compile.App do
## Command line options
* `--force` - forces compilation regardless of modification times
+ * `--compile-path` - where to find `.beam` files and write the
+ resulting `.app` file, defaults to `Mix.Project.compile_path/0`
## Phases
@@ -116,7 +118,7 @@ defmodule Mix.Tasks.Compile.App do
@impl true
def run(args) do
- {opts, _, _} = OptionParser.parse(args, switches: [force: :boolean])
+ {opts, _, _} = OptionParser.parse(args, switches: [force: :boolean, compile_path: :string])
project = Mix.Project.get!()
config = Mix.Project.config()
@@ -127,7 +129,7 @@ defmodule Mix.Tasks.Compile.App do
validate_app(app)
validate_version(version)
- path = Mix.Project.compile_path()
+ path = Keyword.get_lazy(opts, :compile_path, &Mix.Project.compile_path/0)
mods = modules_from(Path.wildcard("#{path}/*.beam")) |> Enum.sort()
target = Path.join(path, "#{app}.app")