cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bennma...@apache.org
Subject git commit: added ability to load .dll from a windows phone plugin
Date Fri, 21 Jun 2013 22:02:57 GMT
Updated Branches:
  refs/heads/master e911da27d -> 59c684af1


added ability to load .dll from a windows phone plugin


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/59c684af
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/59c684af
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/59c684af

Branch: refs/heads/master
Commit: 59c684af119847add009a4078c7143a0ab5b55f9
Parents: e911da2
Author: Benn Mapes <benn.mapes@gmail.com>
Authored: Fri Jun 21 15:01:41 2013 -0700
Committer: Benn Mapes <benn.mapes@gmail.com>
Committed: Fri Jun 21 15:01:41 2013 -0700

----------------------------------------------------------------------
 src/util/csproj.js | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/59c684af/src/util/csproj.js
----------------------------------------------------------------------
diff --git a/src/util/csproj.js b/src/util/csproj.js
index 34be9a5..572bbbc 100644
--- a/src/util/csproj.js
+++ b/src/util/csproj.js
@@ -39,6 +39,19 @@ csproj.prototype = {
             compile.append(dep);
             item.append(compile);
         }
+        // check if it's a .dll that we should add as a reference.
+        else if (relative_path.indexOf('.dll', relative_path.length - 4) > -1) {
+            var compile = new et.Element('Reference');
+            // add dll name
+            var parts = relative_path.split('\\');
+            var dll_name = parts[parts.length - 1].substr(0, parts[parts.length - 1].length
- 4);
+            compile.attrib.Include = dll_name;
+            // add hint path with full path
+            var hint_path = new et.Element('HintPath');
+            hint_path.text = relative_path;
+            compile.append(hint_path);
+            item.append(compile);
+        }
         // otherwise add it normally
         else {
             var compile = new et.Element('Compile');
@@ -66,6 +79,23 @@ csproj.prototype = {
                     return true;
                 }
             }
+            // for removing .dll reference
+            var references = group.findall('Reference');
+            for (var j = 0, k = references.length; j < k; j++) {
+                var reference = references[j];
+                var parts = relative_path.split('\\');
+                var dll_name = parts[parts.length - 1].substr(0, parts[parts.length - 1].length
- 4);
+                if(reference.attrib.Include == dll_name) {
+                    // remove file reference
+                    group.remove(0, reference);
+                     // remove ItemGroup if empty
+                    var new_group = group.findall('Compile').concat(group.findall('Page'));
+                    if(new_group.length < 1) {
+                        this.xml.getroot().remove(0, group);
+                    }
+                    return true;
+                }
+            }
         }
         return false;
     }


Mime
View raw message