couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [14/50] git commit: Make update-deps honor apps= and skip_apps=
Date Fri, 17 Jan 2014 23:12:59 GMT
Make update-deps honor apps= and skip_apps=

Because rebar_core handles skipping apps, we had to specialcase the
handling in the case of update-deps because it has to do its own dep
handling. The way this was done is not particularly clean, but there
currently does not exist another way for a command to signal rebar_core
that it doesn't want rebar_core to pay attention to skip_apps.

With this change, however, you can update-deps even with local
conflicting changes/commits by simply skipping the deps you don't wish
to update, or whitelisting he ones you do wish to update.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/d9aa65f1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/d9aa65f1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/d9aa65f1

Branch: refs/heads/import
Commit: d9aa65f118839f2ea76bbdace71166bad705423b
Parents: f46e7b2
Author: Andrew Thompson <andrew@hijacked.us>
Authored: Mon Sep 23 15:19:51 2013 -0400
Committer: Andrew Thompson <andrew@hijacked.us>
Committed: Mon Sep 23 15:19:51 2013 -0400

----------------------------------------------------------------------
 src/rebar_core.erl |  7 +++++++
 src/rebar_deps.erl | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/d9aa65f1/src/rebar_core.erl
----------------------------------------------------------------------
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index 863d1d5..42e106e 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -163,6 +163,13 @@ skip_or_process_dir({_, ModuleSetFile}=ModuleSet, Config, CurrentCodePath,
 skip_or_process_dir1(AppFile, ModuleSet, Config, CurrentCodePath,
                      Dir, Command, DirSet) ->
     case rebar_app_utils:is_skipped_app(Config, AppFile) of
+        {Config1, {true, _SkippedApp}} when Command == 'update-deps' ->
+            %% update-deps does its own app skipping. Unfortunately there's no
+            %% way to signal this to rebar_core, so we have to explicitly do it
+            %% here... Otherwise if you use app=, it'll skip the toplevel
+            %% directory and nothing will be updated.
+             process_dir1(Dir, Command, DirSet, Config1,
+                         CurrentCodePath, ModuleSet);
         {Config1, {true, SkippedApp}} ->
             ?DEBUG("Skipping app: ~p~n", [SkippedApp]),
             Config2 = increment_operations(Config1),

http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/d9aa65f1/src/rebar_deps.erl
----------------------------------------------------------------------
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 4a98ddf..40000ad 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -600,7 +600,10 @@ update_deps_int(Config0, UDD) ->
 
     %% Update each dep
     UpdatedDeps = [update_source(Config1, D)
-                   || D <- Deps, D#dep.source =/= undefined, not lists:member(D, UDD)],
+                   || D <- Deps, D#dep.source =/= undefined,
+                      not lists:member(D, UDD),
+                      not should_skip_update_dep(Config1, D)
+                  ],
 
     lists:foldl(fun(Dep, {Config, Updated}) ->
                         {true, AppDir} = get_deps_dir(Config, Dep#dep.app),
@@ -629,6 +632,16 @@ update_deps_int(Config0, UDD) ->
                 end, {Config1, lists:umerge(lists:sort(UpdatedDeps),
                                             lists:sort(UDD))}, UpdatedDeps).
 
+should_skip_update_dep(Config, Dep) ->
+    {true, AppDir} = get_deps_dir(Config, Dep#dep.app),
+    {true, AppFile} = rebar_app_utils:is_app_dir(AppDir),
+    case rebar_app_utils:is_skipped_app(Config, AppFile) of
+        {_Config, {true, _SkippedApp}} ->
+            true;
+        _ ->
+            false
+    end.
+
 %% Recursively walk the deps and build a list of them.
 collect_deps(Dir, C) ->
     case file:set_cwd(Dir) of


Mime
View raw message