You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/03/06 01:13:28 UTC

[01/13] git commit: wip implementing reading guid from 'framework' project

Repository: cordova-plugman
Updated Branches:
  refs/heads/master cc51a5f10 -> 172a4dec2


wip implementing reading guid from 'framework' project


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

Branch: refs/heads/master
Commit: 83aa57fb05e6ca378dc401c94887389e8af68086
Parents: f0a339f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Feb 4 02:37:28 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Feb 4 02:37:28 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 50 ++++++++++++++++++++++++++++++++++++++++--
 src/util/w8jsproj.js      | 21 +++++++++++++++++-
 2 files changed, 68 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/83aa57fb/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index bd25562..65a1445 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -20,8 +20,10 @@
 var common = require('./common'),
     path = require('path'),
     glob = require('glob'),
-    w8jsproj = require('../util/w8jsproj');
-    xml_helpers = require('../util/xml-helpers');
+    shell = require('shelljs'),
+    fs   = require('fs');
+var w8jsproj = require('../util/w8jsproj');
+var xml_helpers = require('../util/xml-helpers');
 
 
 module.exports = {
@@ -64,5 +66,49 @@ module.exports = {
         },
         uninstall:function(el, project_dir) {
         }
+    },
+    "framework":{ // CB-5238 custom frameworks only
+        install:function(framework_el, plugin_dir, project_dir, plugin_id, project) {
+            // console.log("framework install called with framework_el:: " + framework_el);
+            // console.log("framework install called with plugin_dir:: " + plugin_dir );
+            // console.log("framework install called with project_dir:: " + project_dir);
+            // console.log("framework install called with plugin_id:: " + plugin_id);
+            // console.log("framework install called with project::" + project);
+
+            // console.log("project.plugins_dir " + project.plugins_dir);
+
+            // framework_el attributes : src, custom
+            var src = framework_el.attrib['src'];
+            console.log("src = " + src);
+
+            var custom = framework_el.attrib['custom'];
+
+            var srcFile = path.resolve(plugin_dir, src);
+
+            console.log("path.basename(src) = " + path.basename(src));
+
+            console.log("srcFile = " + srcFile);
+
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
+
+            if (!custom) throw new Error('cannot add non custom frameworks.');
+            if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <framework>');
+            if (fs.existsSync(targetDir)) throw new Error('target destination "' + targetDir + '" already exists');
+            shell.mkdir('-p', path.dirname(targetDir));
+            shell.cp('-R', srcFile, path.dirname(targetDir)); // frameworks are directories
+            var project_relative = path.relative(project_dir, targetDir);
+            
+            console.log("project_relative = " + project_relative);
+            project.addProjectReference(project_relative);
+            //project.xcode.addFramework(project_relative, {customFramework: true});
+        },
+        uninstall:function(framework_el, project_dir, plugin_id, project) {
+            var src = framework_el.attrib['src'],
+                baseDir = path.resolve(project.plugins_dir, plugin_id),
+                targetDir = path.resolve(baseDir, path.basename(src));
+            project.removeProjectReference(targetDir);
+            shell.rm('-rf', baseDir);
+
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/83aa57fb/src/util/w8jsproj.js
----------------------------------------------------------------------
diff --git a/src/util/w8jsproj.js b/src/util/w8jsproj.js
index bd5dd41..10c5b7b 100644
--- a/src/util/w8jsproj.js
+++ b/src/util/w8jsproj.js
@@ -5,7 +5,9 @@
 
 var xml_helpers = require('./xml-helpers'),
     et = require('elementtree'),
-    fs = require('fs');
+    fs = require('fs'),
+    shell = require('shelljs'),
+    path = require('path');
 
 function jsproj(location) {
     require('../../plugman').emit('verbose','creating jsproj from project at : ' + location);
@@ -17,6 +19,7 @@ function jsproj(location) {
 jsproj.prototype = {
     location:null,
     xml:null,
+    plugins_dir:"Plugins",
     write:function() {
         fs.writeFileSync(this.location, this.xml.write({indent:4}), 'utf-8');
     },
@@ -30,6 +33,22 @@ jsproj.prototype = {
             item.append(content);
         this.xml.getroot().append(item);
     },
+    addProjectReference:function(relative_path) {
+        require('../../plugman').emit('verbose','adding project reference to ' + relative_path);
+        // read the guid from the project
+
+        // could be a .csproj, or ???
+        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"));
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(".\\" + projectFullPath);
+        var guidNode = pluginProjectXML.findall("PropertyGroup/ProjectGuid")[0];
+        var projectGuid = guidNode.text;
+        console.log("Project guid = " + projectGuid);
+
+
+    },
+    removeProjectReference:function(relative_path) {
+        require('../../plugman').emit('verbose','removing project reference to ' + relative_path);
+    },
     removeSourceFile:function(relative_path) {
         relative_path = relative_path.split('/').join('\\');
         var item_groups = this.xml.findall('ItemGroup');


[02/13] git commit: more work on adding project to solution

Posted by pu...@apache.org.
more work on adding project to solution


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

Branch: refs/heads/master
Commit: 2159522231077cebbd51eecc95b04e2526161b4d
Parents: 83aa57f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 6 13:12:53 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 6 13:12:53 2014 -0800

----------------------------------------------------------------------
 src/util/w8jsproj.js | 128 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 112 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/21595222/src/util/w8jsproj.js
----------------------------------------------------------------------
diff --git a/src/util/w8jsproj.js b/src/util/w8jsproj.js
index 10c5b7b..cea3425 100644
--- a/src/util/w8jsproj.js
+++ b/src/util/w8jsproj.js
@@ -9,6 +9,11 @@ var xml_helpers = require('./xml-helpers'),
     shell = require('shelljs'),
     path = require('path');
 
+var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  
+var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  
+var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
+var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
+
 function jsproj(location) {
     require('../../plugman').emit('verbose','creating jsproj from project at : ' + location);
     this.location = location;
@@ -33,22 +38,6 @@ jsproj.prototype = {
             item.append(content);
         this.xml.getroot().append(item);
     },
-    addProjectReference:function(relative_path) {
-        require('../../plugman').emit('verbose','adding project reference to ' + relative_path);
-        // read the guid from the project
-
-        // could be a .csproj, or ???
-        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"));
-        var pluginProjectXML = xml_helpers.parseElementtreeSync(".\\" + projectFullPath);
-        var guidNode = pluginProjectXML.findall("PropertyGroup/ProjectGuid")[0];
-        var projectGuid = guidNode.text;
-        console.log("Project guid = " + projectGuid);
-
-
-    },
-    removeProjectReference:function(relative_path) {
-        require('../../plugman').emit('verbose','removing project reference to ' + relative_path);
-    },
     removeSourceFile:function(relative_path) {
         relative_path = relative_path.split('/').join('\\');
         var item_groups = this.xml.findall('ItemGroup');
@@ -70,6 +59,113 @@ jsproj.prototype = {
             }
         }
         return false;
+    },
+    addProjectReference:function(relative_path) {
+        require('../../plugman').emit('verbose','adding project reference to ' + relative_path);
+        relative_path = relative_path.split('/').join('\\');
+        // read the guid from the project
+        console.log("this.location = " + this.location);
+        console.log("addProjectReference " + relative_path);
+        // could be a .csproj, or ???
+        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"))[0];
+        projectFullPath = projectFullPath.split('/').join('\\');
+
+        var solutionPath = shell.ls(path.join(path.dirname(this.location),"*.sln"))[0];
+        console.log("solutionPath = " + solutionPath);
+        
+        // note we may not have a solution, in which case just add a project reference
+
+        // if it is a vsxproj we will have use the guid to add to the solution
+        /*
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsCppRuntimeComponent1", "..\WindowsCppRuntimeComponent1\WindowsCppRuntimeComponent1.vcxproj", "{91604387-B9EC-4598-8261-5FDC23409E23}"
+EndProject
+        */
+
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(".\\" + projectFullPath);
+        // find the guid of the project
+        var guidNode = pluginProjectXML.findall("PropertyGroup/ProjectGuid")[0];
+        var projectGuid = guidNode.text;
+
+        var assemblyName = pluginProjectXML.findall("PropertyGroup/AssemblyName")[0].text;
+
+        //find the project type
+        var ptGuidsNode = pluginProjectXML.findall("PropertyGroup/ProjectTypeGuids")[0];
+        if(ptGuidsNode != null) {
+            var guids = ptGuidsNode.text.split(";");
+            if(guids.indexOf(WinCSharpProjectTypeGUID) > -1) {
+                console.log("found C# project type");
+
+                var preInsertText = "ProjectSection(ProjectDependencies) = postProject\n\r" +
+                                     projectGuid + "=" + projectGuid + "\n\r" +
+                                     "EndProjectSection\n\r";
+
+                // debug
+                preInsertText = "";
+
+                var postInsertText = 'Project("' + WinCSharpProjectTypeGUID + '") = "' + 
+                                         assemblyName + '", "' + projectFullPath + '",' +
+                                        '"' + projectGuid + '"\n\r EndProject\n\r';
+
+                // read in the solution file
+                var solText = fs.readFileSync(solutionPath,{encoding:"utf8"});
+                var splitText = solText.split("EndProject");
+                if(splitText.length != 2) {
+                    console.log("oops, too many projects in this solution");
+                }                 
+                else {
+                    solText = splitText[0] + preInsertText + "EndProject\n\r" + postInsertText + splitText[1];
+                    // console.log("solText = " + solText);
+                    fs.writeFileSync(solutionPath,solText,{encoding:"utf8"});
+                }
+            }
+            else if(false || guids.indexOf(WinCSharpProjectTypeGUID) > -1) {
+
+            }
+            else {
+
+            }
+        }
+
+
+        var assemblyNode = pluginProjectXML.findall("PropertyGroup/AssemblyName")[0];
+        var assemblyName = assemblyNode.text;
+
+        console.log("Project guid = " + projectGuid);
+        console.log("assemblyName = " + assemblyName);
+
+        return;
+        
+
+        // Add the item group ProjectReference to the cordova project :
+    //         <ItemGroup>
+    //     <ProjectReference Include="WindowsRuntimeComponent1\WindowsRuntimeComponent1.csproj" />
+    // </ItemGroup>
+        // make ItemGroup to hold file.
+        var item = new et.Element('ItemGroup');
+
+        var projRef = new et.Element('ProjectReference');
+            projRef.attrib.Include = assemblyName;//projectFullPath;
+            item.append(projRef);
+        this.xml.getroot().append(item);
+
+    },
+    removeProjectReference:function(relative_path) {
+        require('../../plugman').emit('verbose','removing project reference to ' + relative_path);
+
+        // could be a .csproj, or ???
+        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"));
+
+        // select first ItemsGroups with a ChildNode ProjectReference
+        // ideally select all, and look for @attib 'Include'= projectFullPath
+        var projectRefNodesPar = this.xml.findall("ItemGroup[ProjectReference]")[0];
+
+        console.log("projectRefNodes = " + projectRefNodesPar);
+    
+        return;
+
+        if(projectRefNodesPar) {
+            this.xml.getroot().remove(0, projectRefNodesPar);
+        }
     }
 };
 


[09/13] git commit: formatting / readability

Posted by pu...@apache.org.
formatting / readability


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

Branch: refs/heads/master
Commit: dc6e49fb1512d8deadb462b0ced8f54e372d44aa
Parents: 5332994
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 5 14:57:08 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 5 14:57:08 2014 -0800

----------------------------------------------------------------------
 src/uninstall.js | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dc6e49fb/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index 8b6784b..528b47a 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -144,6 +144,8 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
     www_dir = www_dir || handler.www_dir(project_dir);
     require('../plugman').emit('log', 'Uninstalling ' + plugin_id + ' from ' + platform);
 
+    console.log("in uninstall.js handleUninstall plugin_dir = " + plugin_dir);
+
     var assets = plugin_et.findall('./asset');
     if (platformTag) {
         var sourceFiles = platformTag.findall('./source-file'),
@@ -155,24 +157,39 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
 
         // queue up native stuff
         sourceFiles && sourceFiles.forEach(function(source) {
-            actions.push(actions.createAction(handler["source-file"].uninstall, [source, project_dir, plugin_id], handler["source-file"].install, [source, plugin_dir, project_dir, plugin_id]));
+            actions.push(actions.createAction(handler["source-file"].uninstall, 
+                                             [source, project_dir, plugin_id], 
+                                             handler["source-file"].install, 
+                                             [source, plugin_dir, project_dir, plugin_id]));
         });
 
         headerFiles && headerFiles.forEach(function(header) {
-            actions.push(actions.createAction(handler["header-file"].uninstall, [header, project_dir, plugin_id], handler["header-file"].install, [header, plugin_dir, project_dir, plugin_id]));
+            actions.push(actions.createAction(handler["header-file"].uninstall, 
+                                             [header, project_dir, plugin_id], 
+                                             handler["header-file"].install, 
+                                             [header, plugin_dir, project_dir, plugin_id]));
         });
 
         resourceFiles && resourceFiles.forEach(function(resource) {
-            actions.push(actions.createAction(handler["resource-file"].uninstall, [resource, project_dir, plugin_id], handler["resource-file"].install, [resource, plugin_dir, project_dir]));
+            actions.push(actions.createAction(handler["resource-file"].uninstall, 
+                                              [resource, project_dir, plugin_id], 
+                                              handler["resource-file"].install, 
+                                              [resource, plugin_dir, project_dir]));
         });
 
         // CB-5238 custom frameworks only
         frameworkFiles && frameworkFiles.forEach(function(framework) {
-            actions.push(actions.createAction(handler["framework"].uninstall, [framework, project_dir, plugin_id], handler["framework"].install, [framework, plugin_dir, project_dir]));
+            actions.push(actions.createAction(handler["framework"].uninstall, 
+                                              [framework, project_dir, plugin_id], 
+                                              handler["framework"].install, 
+                                              [framework, plugin_dir, project_dir]));
         });
 
         libFiles && libFiles.forEach(function(source) {
-            actions.push(actions.createAction(handler["lib-file"].uninstall, [source, project_dir, plugin_id], handler["lib-file"].install, [source, plugin_dir, project_dir, plugin_id]));
+            actions.push(actions.createAction(handler["lib-file"].uninstall, 
+                                              [source, project_dir, plugin_id], 
+                                              handler["lib-file"].install, 
+                                              [source, plugin_dir, project_dir, plugin_id]));
         });
     }
 


[06/13] git commit: remove double wip framework element

Posted by pu...@apache.org.
remove double wip framework element


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

Branch: refs/heads/master
Commit: 9de32371f7ac349982791d375a61b0b835eab021
Parents: 3b46848
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 27 16:46:20 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 27 16:46:20 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 29 -----------------------------
 1 file changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9de32371/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index 491c6f0..43f55bc 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -95,35 +95,6 @@ module.exports = {
             var src = el.attrib['src'];
             var dest = src; // if !isCustom, we will just add a reference to the file in place
             var isCustom = el.attrib.custom == "true";
-            if(isCustom) {
-                dest = path.join('plugins', plugin_id, path.basename(src));
-                common.copyFile(plugin_dir, src, project_dir, dest);
-            }
-
-            project_file.addReference(dest,src);
-
-        },
-        uninstall:function(el, project_dir, plugin_id, project_file) {
-            require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
-
-            var src = el.attrib['src'];
-            var isCustom = el.attrib.custom == "true";
-
-            if(isCustom) {
-                var dest = path.join('plugins', plugin_id);//, path.basename(src));
-                common.removeFile(project_dir, dest);
-            }
-
-            project_file.removeReference(src);
-        }
-    },
-    "framework": {
-        install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
-            require('../../plugman').emit('verbose', 'windows8 framework install :: ' + plugin_id);
-
-            var src = el.attrib['src'];
-            var dest = src; // if !isCustom, we will just add a reference to the file in place
-            var isCustom = el.attrib.custom == "true";
             var type = el.attrib["type"];
 
             if(isCustom) {


[12/13] git commit: remove console.log, oops

Posted by pu...@apache.org.
remove console.log, oops


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

Branch: refs/heads/master
Commit: 31720efdebde75af74ae0252fa1169c6dff18f47
Parents: 221fbf5
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 5 15:04:43 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 5 15:04:43 2014 -0800

----------------------------------------------------------------------
 src/uninstall.js | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/31720efd/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index 528b47a..0d55670 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -143,9 +143,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
     var platformTag = plugin_et.find('./platform[@name="'+platform+'"]');
     www_dir = www_dir || handler.www_dir(project_dir);
     require('../plugman').emit('log', 'Uninstalling ' + plugin_id + ' from ' + platform);
-
-    console.log("in uninstall.js handleUninstall plugin_dir = " + plugin_dir);
-
+    
     var assets = plugin_et.findall('./asset');
     if (platformTag) {
         var sourceFiles = platformTag.findall('./source-file'),


[10/13] git commit: projectReference.uninstall has to generate the plugin_dir because it is not passed to uninstall methods

Posted by pu...@apache.org.
projectReference.uninstall has to generate the plugin_dir because it is not passed to uninstall methods


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

Branch: refs/heads/master
Commit: 64de69a1394fd9dc7a59c28d891357a2792342c2
Parents: dc6e49f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 5 14:58:37 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 5 14:58:37 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/64de69a1/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index f859914..287c048 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -116,9 +116,11 @@ module.exports = {
             // technically it is not possible to get here without isCustom == true -jm
             // var isCustom = el.attrib.custom == "true"; 
             var type = el.attrib["type"];
+            // unfortunately we have to generate the plugin_dir path because it is not passed to uninstall
+            var plugin_dir = path.join(project_dir,"cordova/plugins",plugin_id,src);
 
             if(type == "projectReference") {
-                project_file.removeProjectReference(path.join(plugin_dir,src));
+                project_file.removeProjectReference(plugin_dir);
             }
             else {
                 // if(isCustom) {  }  


[04/13] git commit: Separate out adding a dependent project from adding a .winmd reference in windows8

Posted by pu...@apache.org.
Separate out adding a dependent project from adding a .winmd reference in windows8


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

Branch: refs/heads/master
Commit: 0eb0364890509e3a9c8f15027e002bcd8c248767
Parents: fe56a5d
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 27 16:36:04 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 27 16:36:04 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 61 +++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0eb03648/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index 151dfee..491c6f0 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -117,48 +117,41 @@ module.exports = {
             project_file.removeReference(src);
         }
     },
-    "framework":{ // CB-5238 custom frameworks only
-        install:function(framework_el, plugin_dir, project_dir, plugin_id, project) {
-            // console.log("framework install called with framework_el:: " + framework_el);
-            // console.log("framework install called with plugin_dir:: " + plugin_dir );
-            // console.log("framework install called with project_dir:: " + project_dir);
-            // console.log("framework install called with plugin_id:: " + plugin_id);
-            // console.log("framework install called with project::" + project);
-
-            // console.log("project.plugins_dir " + project.plugins_dir);
+    "framework": {
+        install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
+            require('../../plugman').emit('verbose', 'windows8 framework install :: ' + plugin_id);
 
-            // framework_el attributes : src, custom
-            var src = framework_el.attrib['src'];
-            console.log("src = " + src);
+            var src = el.attrib['src'];
+            var dest = src; // if !isCustom, we will just add a reference to the file in place
+            var isCustom = el.attrib.custom == "true";
+            var type = el.attrib["type"];
 
-            var custom = framework_el.attrib['custom'];
+            if(isCustom) {
+                dest = path.join('plugins', plugin_id, path.basename(src));
+                common.copyFile(plugin_dir, src, project_dir, dest);
+            }
 
-            var srcFile = path.resolve(plugin_dir, src);
+            if(type == "projectReference") {
 
-            console.log("path.basename(src) = " + path.basename(src));
+            }
+            else {
+                project_file.addReference(dest,src);
+            }
 
-            console.log("srcFile = " + srcFile);
+        },
+        uninstall:function(el, project_dir, plugin_id, project_file) {
+            require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
 
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
+            var src = el.attrib['src'];
+            var isCustom = el.attrib.custom == "true";
 
-            if (!custom) throw new Error('cannot add non custom frameworks.');
-            if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <framework>');
-            if (fs.existsSync(targetDir)) throw new Error('target destination "' + targetDir + '" already exists');
-            shell.mkdir('-p', path.dirname(targetDir));
-            shell.cp('-R', srcFile, path.dirname(targetDir)); // frameworks are directories
-            var project_relative = path.relative(project_dir, targetDir);
-            
-            console.log("project_relative = " + project_relative);
-            project.addProjectReference(project_relative);
-            //project.xcode.addFramework(project_relative, {customFramework: true});
-        },
-        uninstall:function(framework_el, project_dir, plugin_id, project) {
-            var src = framework_el.attrib['src'],
-                baseDir = path.resolve(project.plugins_dir, plugin_id),
-                targetDir = path.resolve(baseDir, path.basename(src));
-            project.removeProjectReference(targetDir);
-            shell.rm('-rf', baseDir);
+            if(isCustom) {
+                var dest = path.join('plugins', plugin_id);//, path.basename(src));
+                common.removeFile(project_dir, dest);
+            }
 
+            project_file.removeReference(src);
         }
+
     }
 };


[11/13] git commit: working uninstall for projectReferences

Posted by pu...@apache.org.
working uninstall for projectReferences


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

Branch: refs/heads/master
Commit: 221fbf54bf2d8d4823f76e0ceff6bb7fab347ee1
Parents: 64de69a
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 5 15:00:25 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 5 15:00:25 2014 -0800

----------------------------------------------------------------------
 src/util/w8jsproj.js | 182 +++++++++++++++++++++++-----------------------
 1 file changed, 89 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/221fbf54/src/util/w8jsproj.js
----------------------------------------------------------------------
diff --git a/src/util/w8jsproj.js b/src/util/w8jsproj.js
index eb0487b..a890429 100644
--- a/src/util/w8jsproj.js
+++ b/src/util/w8jsproj.js
@@ -9,10 +9,10 @@ var xml_helpers = require('./xml-helpers'),
     shell = require('shelljs'),
     path = require('path');
 
-var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  
-var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  
-var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
-var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
+var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  // any of the below, subtype
+var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";    // .csproj
+var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";     // who the ef cares?
+var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; // .vcxproj
 
 
 function jsproj(location) {
@@ -42,9 +42,9 @@ jsproj.prototype = {
     },
 
     removeSDKRef:function(incText) {
-        var item_groups = this.xml.findall('ItemGroup/SDKReference[@Include="' + incText + '"]/..');
-        if(item_groups.length > 0 ) {
-            this.xml.getroot().remove(0, item_groups[0]);
+        var item_group = this.xml.find('ItemGroup/SDKReference[@Include="' + incText + '"]/..');
+        if(item_group) { // TODO: error handling
+            this.xml.getroot().remove(0, item_group);
         }
     },
 
@@ -78,15 +78,14 @@ jsproj.prototype = {
     removeReference:function(relPath) {
         require('../../plugman').emit('verbose','removeReference::' + relPath);
 
-        var item = new et.Element('ItemGroup');
         var extName = path.extname(relPath);
         var includeText = path.basename(relPath,extName);
         // <ItemGroup>
         //   <Reference Include="WindowsRuntimeComponent1">
-        var item_groups = this.xml.findall('ItemGroup/Reference[@Include="' + includeText + '"]/..');
+        var item_group = this.xml.find('ItemGroup/Reference[@Include="' + includeText + '"]/..');
 
-        if(item_groups.length > 0 ) {
-            this.xml.getroot().remove(0, item_groups[0]);
+        if(item_group) { // TODO: erro handling
+            this.xml.getroot().remove(0, item_group);
         }
     },
 
@@ -107,7 +106,6 @@ jsproj.prototype = {
 
         // path.normalize(relative_path);// ??
         relative_path = relative_path.split('/').join('\\');
-
         // var oneStep = this.xml.findall('ItemGroup/Content[@Include="' + relative_path + '""]/..');
 
         var item_groups = this.xml.findall('ItemGroup');
@@ -130,91 +128,59 @@ jsproj.prototype = {
         }
         return false;
     },
+    // relative path must include the project file, so we can determine .csproj, .jsproj, .vcxproj...
     addProjectReference:function(relative_path) {
         require('../../plugman').emit('verbose','adding project reference to ' + relative_path);
-        relative_path = relative_path.split('/').join('\\');
-        // read the guid from the project
-        console.log("this.location = " + this.location);
-        console.log("addProjectReference " + relative_path);
-        // could be a .csproj, or ???
-        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"))[0];
-        projectFullPath = projectFullPath.split('/').join('\\');
-
-        var solutionPath = shell.ls(path.join(path.dirname(this.location),"*.sln"))[0];
-        console.log("solutionPath = " + solutionPath);
-        
-        // note we may not have a solution, in which case just add a project reference
-
-        // if it is a vsxproj we will have use the guid to add to the solution
-        /*
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsCppRuntimeComponent1", "..\WindowsCppRuntimeComponent1\WindowsCppRuntimeComponent1.vcxproj", "{91604387-B9EC-4598-8261-5FDC23409E23}"
-EndProject
-        */
-
-        var pluginProjectXML = xml_helpers.parseElementtreeSync(".\\" + projectFullPath);
-        // find the guid of the project
-        var guidNode = pluginProjectXML.findall("PropertyGroup/ProjectGuid")[0];
-        var projectGuid = guidNode.text;
-
-        var assemblyName = pluginProjectXML.findall("PropertyGroup/AssemblyName")[0].text;
-
-        //find the project type
-        var ptGuidsNode = pluginProjectXML.findall("PropertyGroup/ProjectTypeGuids")[0];
-        if(ptGuidsNode != null) {
-            var guids = ptGuidsNode.text.split(";");
-            if(guids.indexOf(WinCSharpProjectTypeGUID) > -1) {
-                console.log("found C# project type");
-
-                var preInsertText = "ProjectSection(ProjectDependencies) = postProject\n\r" +
-                                     projectGuid + "=" + projectGuid + "\n\r" +
-                                     "EndProjectSection\n\r";
-
-                // debug
-                preInsertText = "";
-
-                var postInsertText = 'Project("' + WinCSharpProjectTypeGUID + '") = "' + 
-                                         assemblyName + '", "' + projectFullPath + '",' +
-                                        '"' + projectGuid + '"\n\r EndProject\n\r';
-
-                // read in the solution file
-                var solText = fs.readFileSync(solutionPath,{encoding:"utf8"});
-                var splitText = solText.split("EndProject");
-                if(splitText.length != 2) {
-                    console.log("oops, too many projects in this solution");
-                }                 
-                else {
-                    solText = splitText[0] + preInsertText + "EndProject\n\r" + postInsertText + splitText[1];
-                    // console.log("solText = " + solText);
-                    fs.writeFileSync(solutionPath,solText,{encoding:"utf8"});
-                }
-            }
-            else if(false || guids.indexOf(WinCSharpProjectTypeGUID) > -1) {
-
-            }
-            else {
 
-            }
+        relative_path = relative_path.split('/').join('\\');
+        // read the solution path from the base directory
+        var solutionPath = shell.ls(path.join(path.dirname(this.location),"*.sln"))[0];// TODO:error handling
+        // note we may not have a solution, in which case just add a project reference, I guess ..
+        // get the project extension to figure out project type
+        var projectExt = path.extname(relative_path);
+
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
+        // find the guid + name of the referenced project
+        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
+        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+
+        var preInsertText = "ProjectSection(ProjectDependencies) = postProject\n\r" +
+                             projectGuid + "=" + projectGuid + "\n\r" +
+                            "EndProjectSection\n\r";
+
+        // read in the solution file
+        var solText = fs.readFileSync(solutionPath,{encoding:"utf8"});
+        var splitText = solText.split("EndProject");
+        if(splitText.length != 2) {
+            throw new Error("too many projects in solution.");
         }
 
+        var projectTypeGuid = null;
+        if(projectExt == ".vcxproj") {
+            projectTypeGuid = WinCplusplusProjectTypeGUID;
+        }
+        else if(projectExt == ".csproj") {
+            projectTypeGuid = WinCSharpProjectTypeGUID;
+        }
+        
+        if(!projectTypeGuid) {
+            throw new Error("unrecognized project type");
+        }
 
-        var assemblyNode = pluginProjectXML.findall("PropertyGroup/AssemblyName")[0];
-        var assemblyName = assemblyNode.text;
-
-        console.log("Project guid = " + projectGuid);
-        console.log("assemblyName = " + assemblyName);
+        var postInsertText = 'Project("' + projectTypeGuid + '") = "' + 
+                         projName + '", "' + relative_path + '",' +
+                        '"' + projectGuid + '"\n\r EndProject\n\r';
 
-        return;
+        solText = splitText[0] + preInsertText + "EndProject\n\r" + postInsertText + splitText[1];
+        fs.writeFileSync(solutionPath,solText,{encoding:"utf8"});
         
 
-        // Add the item group ProjectReference to the cordova project :
-    //         <ItemGroup>
-    //     <ProjectReference Include="WindowsRuntimeComponent1\WindowsRuntimeComponent1.csproj" />
-    // </ItemGroup>
-        // make ItemGroup to hold file.
+        // Add the ItemGroup/ProjectReference to the cordova project :
+        // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
         var item = new et.Element('ItemGroup');
 
         var projRef = new et.Element('ProjectReference');
-            projRef.attrib.Include = assemblyName;//projectFullPath;
+            projRef.attrib.Include = relative_path;
             item.append(projRef);
         this.xml.getroot().append(item);
 
@@ -222,17 +188,47 @@ EndProject
     removeProjectReference:function(relative_path) {
         require('../../plugman').emit('verbose','removing project reference to ' + relative_path);
 
-        // could be a .csproj, or ???
-        var projectFullPath = shell.ls(path.join(relative_path,"*.*proj"));
+        // find the guid + name of the referenced project
+        var pluginProjectXML = xml_helpers.parseElementtreeSync(relative_path);
+        var projectGuid = pluginProjectXML.find("PropertyGroup/ProjectGuid").text;
+        var projName = pluginProjectXML.find("PropertyGroup/ProjectName").text;
+
+        // get the project extension to figure out project type
+        var projectExt = path.extname(relative_path);
+        // get the project type
+        var projectTypeGuid = null;
+        if(projectExt == ".vcxproj") {
+            projectTypeGuid = WinCplusplusProjectTypeGUID;
+        }
+        else if(projectExt == ".csproj") {
+            projectTypeGuid = WinCSharpProjectTypeGUID;
+        }
+        
+        if(!projectTypeGuid) {
+            throw new Error("unrecognized project type");
+        }
 
-        // select first ItemsGroups with a ChildNode ProjectReference
-        // ideally select all, and look for @attib 'Include'= projectFullPath
-        var projectRefNodesPar = this.xml.findall("ItemGroup[ProjectReference]")[0];
+        var preInsertText = "ProjectSection(ProjectDependencies) = postProject\n\r" +
+                             projectGuid + "=" + projectGuid + "\n\r" +
+                            "EndProjectSection\n\r";
 
-        console.log("projectRefNodes = " + projectRefNodesPar);
-    
-        return;
+        var postInsertText = 'Project("' + projectTypeGuid + '") = "' + 
+                              projName + '", "' + relative_path + '",' +
+                              '"' + projectGuid + '"\n\r EndProject\n\r';
+
+        // find and read in the solution file
+        var solutionPath = shell.ls(path.join(path.dirname(this.location),"*.sln"))[0];  // TODO:error handling
+        var solText = fs.readFileSync(solutionPath,{encoding:"utf8"});
+        var splitText = solText.split(preInsertText);
+        
+        solText = splitText.join("").split(postInsertText);
+        solText = solText.join("");
 
+        fs.writeFileSync(solutionPath,solText,{encoding:"utf8"});
+
+        // select first ItemsGroups with a ChildNode ProjectReference
+        // ideally select all, and look for @attib 'Include'= projectFullPath
+        var projectRefNodesPar = this.xml.find("ItemGroup/ProjectReference[@Include='" + relative_path + "']/..");
         if(projectRefNodesPar) {
             this.xml.getroot().remove(0, projectRefNodesPar);
         }


[03/13] git commit: manual merge

Posted by pu...@apache.org.
manual merge


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

Branch: refs/heads/master
Commit: fe56a5de3836076021f40a047671931f44f8d351
Parents: 2159522 85f7ed9
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 27 11:49:37 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 27 11:49:37 2014 -0800

----------------------------------------------------------------------
 README.md                         |   28 +-
 RELEASENOTES.md                   |   16 +
 doc/base.js                       |    5 +
 doc/help.txt                      |   31 +
 doc/platforms/android/android.xml |   12 +
 doc/platforms/android/base.java   |   32 +
 doc/platforms/ios/base.m          |   28 +
 doc/platforms/ios/ios.xml         |    9 +
 main.js                           |    4 +-
 package.json                      |    5 +-
 plugman.js                        |   44 +-
 spec/add_platform.spec.js         |   64 ++
 spec/create.spec.js               |   62 ++
 spec/install.spec.js              |    9 +-
 spec/platform.spec.js             |   26 +
 spec/platforms/android.spec.js    |    6 +-
 spec/platforms/common.spec.js     |   56 +-
 spec/platforms/ios.spec.js        |   18 +-
 spec/prepare.spec.js              |   13 +-
 spec/util/config-changes.spec.js  |  126 ++--
 spec/util/csproj.spec.js          |    9 -
 spec/wrappers.spec.js             |    2 +-
 src/create.js                     |   81 +++
 src/fetch.js                      |   43 +-
 src/install.js                    |  122 ++--
 src/platform.js                   |  119 ++++
 src/platform_operation.js         |    5 +
 src/platforms/amazon-fireos.js    |   24 +-
 src/platforms/android.js          |   30 +-
 src/platforms/blackberry10.js     |   29 +-
 src/platforms/common.js           |   11 +-
 src/platforms/firefoxos.js        |   50 +-
 src/platforms/ios.js              |   44 +-
 src/platforms/ubuntu.js           |   16 +
 src/platforms/windows8.js         |   62 +-
 src/platforms/wp7.js              |   36 +-
 src/platforms/wp8.js              |   62 +-
 src/prepare.js                    |   43 +-
 src/registry/manifest.js          |    8 +-
 src/registry/registry.js          |  115 ++--
 src/uninstall.js                  |    7 +-
 src/util/action-stack.js          |    2 +-
 src/util/config-changes.js        | 1030 +++++++++++++++++++-------------
 src/util/csproj.js                |  102 ++--
 src/util/plugins.js               |   15 -
 src/util/w8jsproj.js              |   74 ++-
 46 files changed, 1942 insertions(+), 793 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fe56a5de/src/platforms/windows8.js
----------------------------------------------------------------------
diff --cc src/platforms/windows8.js
index 65a1445,908dc95..151dfee
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@@ -20,10 -20,9 +20,10 @@@
  var common = require('./common'),
      path = require('path'),
      glob = require('glob'),
 +    shell = require('shelljs'),
-     fs   = require('fs');
- var w8jsproj = require('../util/w8jsproj');
- var xml_helpers = require('../util/xml-helpers');
+     fs = require('fs'),
+     w8jsproj = require('../util/w8jsproj'),
+     xml_helpers = require('../util/xml-helpers');
  
  
  module.exports = {
@@@ -60,55 -61,59 +62,103 @@@
              project_file.removeSourceFile(dest);
          }
      },
+     "header-file": {
+         install:function(source_el, plugin_dir, project_dir, plugin_id) {
+             require('../../plugman').emit('verbose', 'header-fileinstall is not supported for Windows 8');
+         },
+         uninstall:function(source_el, project_dir, plugin_id) {
+             require('../../plugman').emit('verbose', 'header-file.uninstall is not supported for Windows 8');
+         }
+     },
      "resource-file":{
-         install:function(el, plugin_dir, project_dir) {
+         install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
              require('../../plugman').emit('verbose', 'resource-file is not supported for Windows 8');
          },
-         uninstall:function(el, project_dir) {
+         uninstall:function(el, project_dir, plugin_id, project_file) {
+         }
+     },
+     "lib-file": {
+         install:function(el, plugin_dir, project_dir, plugin_id, project_file) { 
+             var inc  = el.attrib['Include'];
+             project_file.addSDKRef(inc);
+         },
+         uninstall:function(el, project_dir, plugin_id, project_file) {
+             require('../../plugman').emit('verbose', 'windows8 lib-file uninstall :: ' + plugin_id);
+             var inc = el.attrib['Include'];
+             project_file.removeSDKRef(inc);
+         }
+     },
+     "framework": {
+         install:function(el, plugin_dir, project_dir, plugin_id, project_file) {
+             require('../../plugman').emit('verbose', 'windows8 framework install :: ' + plugin_id);
+ 
+             var src = el.attrib['src'];
+             var dest = src; // if !isCustom, we will just add a reference to the file in place
+             var isCustom = el.attrib.custom == "true";
+             if(isCustom) {
+                 dest = path.join('plugins', plugin_id, path.basename(src));
+                 common.copyFile(plugin_dir, src, project_dir, dest);
+             }
+ 
+             project_file.addReference(dest,src);
+ 
+         },
+         uninstall:function(el, project_dir, plugin_id, project_file) {
+             require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
+ 
+             var src = el.attrib['src'];
+             var isCustom = el.attrib.custom == "true";
+ 
+             if(isCustom) {
+                 var dest = path.join('plugins', plugin_id);//, path.basename(src));
+                 common.removeFile(project_dir, dest);
+             }
+ 
+             project_file.removeReference(src);
          }
 +    },
 +    "framework":{ // CB-5238 custom frameworks only
 +        install:function(framework_el, plugin_dir, project_dir, plugin_id, project) {
 +            // console.log("framework install called with framework_el:: " + framework_el);
 +            // console.log("framework install called with plugin_dir:: " + plugin_dir );
 +            // console.log("framework install called with project_dir:: " + project_dir);
 +            // console.log("framework install called with plugin_id:: " + plugin_id);
 +            // console.log("framework install called with project::" + project);
 +
 +            // console.log("project.plugins_dir " + project.plugins_dir);
 +
 +            // framework_el attributes : src, custom
 +            var src = framework_el.attrib['src'];
 +            console.log("src = " + src);
 +
 +            var custom = framework_el.attrib['custom'];
 +
 +            var srcFile = path.resolve(plugin_dir, src);
 +
 +            console.log("path.basename(src) = " + path.basename(src));
 +
 +            console.log("srcFile = " + srcFile);
 +
 +            var targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
 +
 +            if (!custom) throw new Error('cannot add non custom frameworks.');
 +            if (!fs.existsSync(srcFile)) throw new Error('cannot find "' + srcFile + '" ios <framework>');
 +            if (fs.existsSync(targetDir)) throw new Error('target destination "' + targetDir + '" already exists');
 +            shell.mkdir('-p', path.dirname(targetDir));
 +            shell.cp('-R', srcFile, path.dirname(targetDir)); // frameworks are directories
 +            var project_relative = path.relative(project_dir, targetDir);
 +            
 +            console.log("project_relative = " + project_relative);
 +            project.addProjectReference(project_relative);
 +            //project.xcode.addFramework(project_relative, {customFramework: true});
 +        },
 +        uninstall:function(framework_el, project_dir, plugin_id, project) {
 +            var src = framework_el.attrib['src'],
 +                baseDir = path.resolve(project.plugins_dir, plugin_id),
 +                targetDir = path.resolve(baseDir, path.basename(src));
 +            project.removeProjectReference(targetDir);
 +            shell.rm('-rf', baseDir);
 +
 +        }
      }
  };

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fe56a5de/src/util/w8jsproj.js
----------------------------------------------------------------------
diff --cc src/util/w8jsproj.js
index cea3425,ab874e7..bd4e6ed
--- a/src/util/w8jsproj.js
+++ b/src/util/w8jsproj.js
@@@ -6,14 -6,8 +6,15 @@@
  var xml_helpers = require('./xml-helpers'),
      et = require('elementtree'),
      fs = require('fs'),
 +    shell = require('shelljs'),
      path = require('path');
  
 +var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  
 +var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  
 +var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
 +var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
 +
++
  function jsproj(location) {
      require('../../plugman').emit('verbose','creating jsproj from project at : ' + location);
      this.location = location;


[08/13] git commit: CB-5970 added type attribute 'projectReference' to element to signal addition of dependent project

Posted by pu...@apache.org.
CB-5970 added type attribute 'projectReference' to <framework> element to signal addition of dependent project


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

Branch: refs/heads/master
Commit: 533299416146f54f12b75d8a2824e5e6259cdd1d
Parents: 944f0f4
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Mar 3 14:39:38 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Mar 3 14:39:38 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/53329941/src/platforms/windows8.js
----------------------------------------------------------------------
diff --git a/src/platforms/windows8.js b/src/platforms/windows8.js
index 43f55bc..f859914 100644
--- a/src/platforms/windows8.js
+++ b/src/platforms/windows8.js
@@ -94,18 +94,17 @@ module.exports = {
 
             var src = el.attrib['src'];
             var dest = src; // if !isCustom, we will just add a reference to the file in place
-            var isCustom = el.attrib.custom == "true";
+            // technically it is not possible to get here without isCustom == true -jm
+            // var isCustom = el.attrib.custom == "true";
             var type = el.attrib["type"];
 
-            if(isCustom) {
-                dest = path.join('plugins', plugin_id, path.basename(src));
-                common.copyFile(plugin_dir, src, project_dir, dest);
-            }
-
             if(type == "projectReference") {
-
+                project_file.addProjectReference(path.join(plugin_dir,src));
             }
             else {
+                // if(isCustom) {}
+                dest = path.join('plugins', plugin_id, path.basename(src));
+                common.copyFile(plugin_dir, src, project_dir, dest);
                 project_file.addReference(dest,src);
             }
 
@@ -114,14 +113,19 @@ module.exports = {
             require('../../plugman').emit('verbose', 'windows8 framework uninstall :: ' + plugin_id  );
 
             var src = el.attrib['src'];
-            var isCustom = el.attrib.custom == "true";
+            // technically it is not possible to get here without isCustom == true -jm
+            // var isCustom = el.attrib.custom == "true"; 
+            var type = el.attrib["type"];
 
-            if(isCustom) {
-                var dest = path.join('plugins', plugin_id);//, path.basename(src));
-                common.removeFile(project_dir, dest);
+            if(type == "projectReference") {
+                project_file.removeProjectReference(path.join(plugin_dir,src));
+            }
+            else {
+                // if(isCustom) {  }  
+                var targetPath = path.join('plugins', plugin_id);
+                common.removeFile(project_dir, targetPath);
+                project_file.removeReference(src);
             }
-
-            project_file.removeReference(src);
         }
 
     }


[05/13] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into CB-5970

Posted by pu...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into CB-5970


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

Branch: refs/heads/master
Commit: 3b468486adef58c2ae8af59402c5dd6a8ffca83d
Parents: 0eb0364 ae05e6f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 27 16:40:12 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 27 16:40:12 2014 -0800

----------------------------------------------------------------------
 LICENSE              | 194 +++++++++++++++++++++++++++++++++++++++++++++-
 NOTICE               |   5 ++
 src/util/w8jsproj.js |   2 -
 3 files changed, 196 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/3b468486/src/util/w8jsproj.js
----------------------------------------------------------------------


[07/13] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into CB-5970

Posted by pu...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into CB-5970


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

Branch: refs/heads/master
Commit: 944f0f43903007ebbe7ea9642548591085163442
Parents: 9de3237 6cb78c4
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 27 18:24:05 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 27 18:24:05 2014 -0800

----------------------------------------------------------------------
 src/fetch.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[13/13] git commit: Merge branch 'CB-5970' of github.com:purplecabbage/cordova-plugman

Posted by pu...@apache.org.
Merge branch 'CB-5970' of github.com:purplecabbage/cordova-plugman


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

Branch: refs/heads/master
Commit: 172a4dec2f36c13dd672801f49d87ab0e37bbade
Parents: cc51a5f 31720ef
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Mar 5 16:11:49 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 5 16:11:49 2014 -0800

----------------------------------------------------------------------
 src/platforms/windows8.js |  35 ++++++++----
 src/uninstall.js          |  27 +++++++--
 src/util/w8jsproj.js      | 127 ++++++++++++++++++++++++++++++++++++++---
 3 files changed, 165 insertions(+), 24 deletions(-)
----------------------------------------------------------------------