mix.exs (1887B)
1 defmodule FileSystem.Mixfile do 2 use Mix.Project 3 4 def project do 5 [ app: :file_system, 6 version: "0.2.10", 7 elixir: "~> 1.3", 8 deps: deps(), 9 description: "A file system change watcher wrapper based on [fs](https://github.com/synrc/fs)", 10 source_url: "https://github.com/falood/file_system", 11 package: package(), 12 compilers: [:file_system | Mix.compilers()], 13 aliases: ["compile.file_system": &file_system/1], 14 docs: [ 15 extras: ["README.md"], 16 main: "readme", 17 ] 18 ] 19 end 20 21 def application do 22 [ 23 applications: [:logger], 24 ] 25 end 26 27 defp deps do 28 [ 29 { :ex_doc, "~> 0.14", only: :docs }, 30 ] 31 end 32 33 defp file_system(_args) do 34 case :os.type() do 35 {:unix, :darwin} -> compile_mac() 36 _ -> :ok 37 end 38 end 39 40 defp compile_mac do 41 require Logger 42 source = "c_src/mac/*.c" 43 target = "priv/mac_listener" 44 45 if Mix.Utils.stale?(Path.wildcard(source), [target]) do 46 Logger.info "Compiling file system watcher for Mac..." 47 cmd = "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations #{source} -o #{target}" 48 if Mix.shell().cmd(cmd) > 0 do 49 Logger.error "Could not compile file system watcher for Mac, try to run #{inspect cmd} manually inside the dependency." 50 else 51 Logger.info "Done." 52 end 53 :ok 54 else 55 :noop 56 end 57 end 58 59 defp package do 60 %{ maintainers: ["Xiangrong Hao", "Max Veytsman"], 61 files: [ 62 "lib", "README.md", "mix.exs", 63 "c_src/mac/cli.c", 64 "c_src/mac/cli.h", 65 "c_src/mac/common.h", 66 "c_src/mac/compat.c", 67 "c_src/mac/compat.h", 68 "c_src/mac/main.c", 69 "priv/inotifywait.exe", 70 ], 71 licenses: ["WTFPL"], 72 links: %{"Github" => "https://github.com/falood/file_system"} 73 } 74 end 75 end