-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmix.exs
executable file
·79 lines (71 loc) · 1.97 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
defmodule NifXsdValidate.MixProject do
use Mix.Project
def project do
[
app: :nif_xsd_validate,
version: "0.0.11",
elixir: "~> 1.6",
package: [
maintainers: ["terminalstatic"],
licenses: ["MIT"],
description: "Xsd schema validation for elixir based on libxml2",
links: %{"Github" => "https://github.com/terminalstatic/nif_xsd_validate"},
files: [
"mix.exs",
"LICENSE",
"Makefile",
"README.md",
"config",
"lib",
"priv/.gitkeep",
"c_source"
]
],
compilers: [:nifXsdValidate] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
deps: deps(),
# ExDoc
name: "NifXsdValidate",
source_url: "https://github.com/terminalstatic/nif_xsd_validate"
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
applications: []
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ex_doc, "~> 0.18.3", only: :dev, runtime: false},
{:dialyxir, "~> 0.5", only: [:dev], runtime: false}
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
]
end
end
defmodule Mix.Tasks.Compile.NifXsdValidate do
def run(_args) do
if match?({:win32, _}, :os.type()) do
IO.warn("Windows is not supported.")
exit(1)
else
{_, errcode} = System.cmd("make", [], into: IO.stream(:stdio, :line))
if errcode != 0 do
Mix.raise("Mix task failed")
end
if Mix.env() == :prod do
IO.puts("Applying :prod build hack")
basename = Path.basename(Mix.Project.app_path())
('cp -rf ' ++
String.to_charlist(
Path.join(Mix.Project.deps_path(), [basename, "/", "priv"]) <>
" " <> Mix.Project.app_path()
))
|> :os.cmd()
end
end
:ok
end
end