   """
   def run(args) do
     {opts, _, _} = OptionParser.parse(args, switches: @switches)
-    project      = Mix.Project.config
+    project = Mix.Project.config()
     source_paths = project[:erlc_paths]
     Mix.Compilers.Erlang.assert_valid_erlc_paths(source_paths)
     files = Mix.Utils.extract_files(source_paths, [:erl])

        else
          erl
        end
      {:attribute, _, :behaviour, behaviour} ->
        %{erl | behaviours: [behaviour | erl.behaviours]}
      {:attribute, _, :compile, value} when is_list(value) ->
        %{erl | compile: value ++ erl.compile}
      {:attribute, _, :compile, value} ->
        %{erl | compile: [value | erl.compile]}
      _ ->
        erl
    end
  end

  defp sort_dependencies(erls) do
    graph = :digraph.new

    _ = for erl <- erls do
      :digraph.add_vertex(graph, erl.module, erl)
    end

    _ = for erl <- erls do
      _ = for b <- erl.behaviours, do: :digraph.add_edge(graph, b, erl.module)
      _ = for c <- erl.compile do
        case c do
          {:parse_transform, transform} -> :digraph.add_edge(graph, transform, erl.module)
          _ -> :ok
        end
      end
      :ok
    end

    result =
      case :digraph_utils.topsort(graph) do
        false -> erls
        mods  ->
          for m <- mods, do: elem(:digraph.vertex(graph, m), 1)
      end


  end

  defp do_run([], _, _, _), do: :noop

  defp do_run(files, opts, project, source_paths) do
    include_path = to_erl_file(project[:erlc_include_path])
    compile_path = to_erl_file(Mix.Project.compile_path(project))

    erlc_options = project[:erlc_options] || []

    unless is_list(erlc_options) do
      Mix.raise(":erlc_options should be a list of options, got: #{inspect(erlc_options)}")
    end

    erlc_options = erlc_options ++ [:return, :report, outdir: compile_path, i: include_path]

    erlc_options =
      Enum.map(erlc_options, fn
        {kind, dir} when kind in [:i, :outdir] -> {kind, to_erl_file(dir)}
        opt -> opt
      end)

    compile_path = Path.relative_to(compile_path, File.cwd!())

    tuples =
      files
      |> scan_sources(include_path, source_paths)
      |> sort_dependencies()
      |> Enum.map(&annotate_target(&1, compile_path, opts[:force]))

    Mix.Compilers.Erlang.compile(manifest(), tuples, opts, fn input, _output ->
      # We're purging the module because a previous compiler (e.g. Phoenix)
      # might have already loaded the previous version of it.
      module = input |> Path.basename(".erl") |> String.to_atom()
      :code.purge(module)
      :code.delete(module)

      file = to_erl_file(Path.rootname(input, ".erl"))

      case :compile.file(file, erlc_options) do
        {:error, :badarg} ->
          message =
            "Compiling Erlang #{inspect(file)} failed with ArgumentError, probably because of invalid :erlc_options"

          Mix.raise(message)

        result ->
          result
      end
    end)
  end

