Repository: cordova-lib Updated Branches: refs/heads/master 68a0b5b7a -> a4c780ac2
CB-7083 Missing SDKReference support on Windows Phone Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/f6054673 Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/f6054673 Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/f6054673 Branch: refs/heads/master Commit: f6054673dde95d09fdb9ba5fcb3ba7342b1388a7 Parents: ab49973 Author: sgrebnov <[email protected]> Authored: Tue Jul 8 12:37:39 2014 +0400 Committer: sgrebnov <[email protected]> Committed: Tue Jul 8 12:37:39 2014 +0400 ---------------------------------------------------------------------- cordova-lib/src/plugman/platforms/wp8.js | 12 ++++++++---- cordova-lib/src/util/windows/csproj.js | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f6054673/cordova-lib/src/plugman/platforms/wp8.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/plugman/platforms/wp8.js b/cordova-lib/src/plugman/platforms/wp8.js index 2c6da4a..996a04d 100644 --- a/cordova-lib/src/plugman/platforms/wp8.js +++ b/cordova-lib/src/plugman/platforms/wp8.js @@ -107,11 +107,15 @@ module.exports = { } }, 'lib-file': { - install:function(source_el, plugin_dir, project_dir, plugin_id) { - events.emit('verbose', 'lib-file.install is not supported for wp8'); + install:function(el, plugin_dir, project_dir, plugin_id, project_file) { + events.emit('verbose', 'wp8 lib-file install :: ' + plugin_id); + var inc = el.attrib['Include']; + project_file.addSDKRef(inc); }, - uninstall:function(source_el, project_dir, plugin_id) { - events.emit('verbose', 'lib-file.uninstall is not supported for wp8'); + uninstall:function(el, project_dir, plugin_id, project_file) { + events.emit('verbose', 'wp8 lib-file uninstall :: ' + plugin_id); + var inc = el.attrib['Include']; + project_file.removeSDKRef(inc); } } }; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/f6054673/cordova-lib/src/util/windows/csproj.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/util/windows/csproj.js b/cordova-lib/src/util/windows/csproj.js index 90f84da..3e73482 100644 --- a/cordova-lib/src/util/windows/csproj.js +++ b/cordova-lib/src/util/windows/csproj.js @@ -36,7 +36,24 @@ csproj.prototype = { write:function() { fs.writeFileSync(this.location, this.xml.write({indent:4}), 'utf-8'); }, + // add/remove the item group for SDKReference + // example : + // <ItemGroup><SDKReference Include="MSAdvertising, Version=6.1" /></ItemGroup> + addSDKRef:function(incText) { + var item_group = new et.Element('ItemGroup'); + var elem = new et.Element('SDKReference'); + elem.attrib.Include = incText; + + item_group.append(elem); + this.xml.getroot().append(item_group); + }, + removeSDKRef:function(incText) { + var item_group = this.xml.find('ItemGroup/SDKReference[@Include="' + incText + '"]/..'); + if(item_group) { + this.xml.getroot().remove(0, item_group); + } + }, addReference:function(relPath) { var item = new et.Element('ItemGroup'); var extName = path.extname(relPath);
