You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2024/12/30 17:56:19 UTC

(couchdb) 04/07: Fix warnings about undefined functions

This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a commit to branch fix-elixir-compile-warnings
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 6636e5bb62c1f9c2ec4084e76b83643e120658d9
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Mon Dec 30 11:16:42 2024 -0600

    Fix warnings about undefined functions
    
    ```
        warning: :fabric.get_db_info/1 is undefined (module :fabric is not available or is yet to be defined)
        │
     26 │       :fabric.get_db_info(db_name)
        │               ~
        │
        └─ test/elixir/lib/utils.ex:26:15: Couch.Test.Utils.db_exists?/1
    ```
---
 mix.exs | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/mix.exs b/mix.exs
index 5c77f1bbd..200d37dc2 100644
--- a/mix.exs
+++ b/mix.exs
@@ -85,17 +85,22 @@ defmodule CouchDBTest.Mixfile do
 
   # Run "mix help deps" to learn about dependencies.
   defp deps() do
-    deps_list = [
+    deps1 = [
       {:junit_formatter, "~> 3.0", only: [:dev, :test, :integration]},
       {:httpotion, ">= 3.1.3", only: [:dev, :test, :integration], runtime: false},
       {:excoveralls, "~> 0.12", only: :test},
-      {:b64url, path: path("b64url")},
-      {:jiffy, path: path("jiffy")},
-      {:jwtf, path: path("jwtf")},
-      {:ibrowse, path: path("ibrowse"), override: true},
-      {:credo, "~> 1.7.7", only: [:dev, :test, :integration], runtime: false}
+      {:credo, "~> 1.7.7", only: [:dev, :test, :integration], runtime: false},
+      {:ibrowse, path: path("ibrowse"), override: true}
     ]
 
+    extra_deps = [:b64url, :jiffy, :jwtf, :meck, :mochiweb]
+    couch_deps = [:config, :couch, :couch_mrview, :fabric, :mem3]
+
+    deps2 = Enum.map(extra_deps, &{&1, path: path(&1)})
+    deps3 = Enum.map(couch_deps, &{&1, path: link_ebin(&1), compile: false})
+
+    deps_list = deps1 ++ deps2 ++ deps3
+
     # Some deps may be missing during source check
     # Besides we don't want to spend time checking them anyway
     List.foldl([:b64url, :jiffy, :jwtf, :ibrowse], deps_list, fn dep, acc ->
@@ -107,9 +112,14 @@ defmodule CouchDBTest.Mixfile do
     end)
   end
 
-  defp path(app) do
-    lib_dir = Path.expand("src", __DIR__)
-    Path.expand(app, lib_dir)
+  defp path(app), do: Path.expand("src/#{app}", __DIR__)
+
+  defp link_ebin(app) do
+    app_ebin = Path.expand("src/#{app}/ebin", __DIR__)
+    build_ebin = "_build/#{Mix.env()}/lib/#{app}/ebin"
+    File.mkdir_p!(Path.dirname(build_ebin))
+    unless File.exists?(build_ebin), do: System.cmd("ln", ["-s", app_ebin, build_ebin])
+    path(app)
   end
 
   def get_test_paths(:test) do