incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [2/3] wp7 commit: actual VS project parsing, to avoid including hidden files ex. .git folders
Date Tue, 10 Apr 2012 00:41:14 GMT
actual VS project parsing, to avoid including hidden files ex. .git folders


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/4104afba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/4104afba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/4104afba

Branch: refs/heads/master
Commit: 4104afba49847f2b56e3f92c72baf8162a3856f2
Parents: 15df9d3
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon Apr 9 17:34:44 2012 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon Apr 9 17:34:44 2012 -0700

----------------------------------------------------------------------
 templates/full/BuildManifestProcessor.js |   55 +++++++++++++------------
 1 files changed, 28 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4104afba/templates/full/BuildManifestProcessor.js
----------------------------------------------------------------------
diff --git a/templates/full/BuildManifestProcessor.js b/templates/full/BuildManifestProcessor.js
index 1ccb16c..e46fc3e 100644
--- a/templates/full/BuildManifestProcessor.js
+++ b/templates/full/BuildManifestProcessor.js
@@ -11,50 +11,51 @@ if (objArgs && objArgs.length > 0) {
 
 
 var fso = WScript.CreateObject("Scripting.FileSystemObject");
-
-var folder = fso.GetFolder("..\\..\\www");
-
 var outFile = fso.CreateTextFile("..\\..\\CordovaSourceDictionary.xml", true);
 
 outFile.WriteLine('<?xml version="1.0" encoding="utf-8"?>');
 outFile.WriteLine('<!-- This file is auto-generated, do not edit! -jm -->');
 outFile.WriteLine('<CordovaSourceDictionary>');
 
-function enumerateFolder(folder, parentPath) {
-    var files = new Enumerator(folder.files);
-    while (!files.atEnd()) {
-        WScript.Echo(parentPath + "\\" + fso.GetFileName(files.item()));
-        outFile.WriteLine('    <FilePath Value="' + parentPath + "\\" + fso.GetFileName(files.item())
+ '"/>');
-        files.moveNext();
-    }
-
-    var subFolders = new Enumerator(folder.SubFolders);
-    while (!subFolders.atEnd()) {
-        var item = subFolders.item();
-        enumerateFolder(item, parentPath + "\\" + fso.GetFileName(item));
-        subFolders.moveNext();
-    }
-}
-enumerateFolder(folder, "www");
-
-// Next we need to get any Linked files from the project
+// We need to get any Linked files from the project
 
-WScript.Echo("Adding Linked Files ...");
+WScript.Echo("Adding Source Files ...");
 if (projectFilePath != null) {
     var projXml = WScript.CreateObject("Microsoft.XMLDOM");
 
     projXml.async = false;
     if (projXml.load(projectFilePath)) {
-        var nodes = projXml.selectNodes("Project/ItemGroup/Content/Link");
-        WScript.Echo("nodes.length" + nodes.length);
+
+        // add linked content ( windows shortcuts )
+        var nodes = projXml.selectNodes("/Project/ItemGroup/Content/Link");
+        WScript.Echo("/Project/ItemGroup/Content/Link nodes.length" + nodes.length);
         for (var n = 0; n < nodes.length; n++) {
             outFile.WriteLine('    <FilePath Value="' + nodes[n].text + '"/>');
         }
-        nodes = projXml.selectNodes("Project/ItemGroup/Resource/Link");
-        WScript.Echo("nodes.length" + nodes.length);
-        for (var n = 0; n < nodes.length; n++) {
+
+        // add files of type Resource
+        nodes = projXml.selectNodes("/Project/ItemGroup/Resource/Link");
+        WScript.Echo("/Project/ItemGroup/Resource/Link nodes.length" + nodes.length);
+        for (n = 0; n < nodes.length; n++) {
             outFile.WriteLine('    <FilePath Value="' + nodes[n].text + '"/>');
         }
+
+        // add Content files from www folder
+        nodes = projXml.selectNodes("/Project/ItemGroup/Content[@Include]");
+        WScript.Echo("/Project/ItemGroup/Content nodes.length" + nodes.length);
+        for (n = 0; n < nodes.length; n++) {
+            for (var i = 0; i < nodes[n].attributes.length; i++) {
+
+                if (nodes[n].attributes[i].name == "Include") {
+                    var val = nodes[n].attributes[i].value;
+                    if (val.indexOf("www") == 0) {
+                        WScript.Echo("adding value :: " + val);
+                        outFile.WriteLine('    <FilePath Value="' + val + '"/>');
+                    }
+                }
+            }
+            
+        }
     }
 }
 


Mime
View raw message