diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..8303c81d --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,49 @@ +var gulp = require('gulp'); +var fs = require('fs'); + +//generate plugin.xml for use as a cordova plugin +//here we explode the contents of the frameworks +gulp.task('gen-npm-plugin-xml', function(){ + var xml = fs.readFileSync('plugin.template.xml', 'utf-8'); + + var files = []; + var root = 'src/ios/dependencies/'; + files = files.concat(emitFiles(root + 'Fabric/')); + files = files.concat(emitFiles(root + 'Branch-SDK/')); + files = files.concat(emitFiles(root + 'Branch-SDK/Requests/')); + + var newLineIndent = '\n '; + xml = xml.replace('', newLineIndent + + files.join(newLineIndent)); + + fs.writeFileSync('plugin.xml', xml); +}); + +//generate plugin.xml for local development +//here we reference the frameworks instead of all the files directly +gulp.task('gen-dev-plugin-xml', function(){ + var xml = fs.readFileSync('plugin.template.xml', 'utf-8'); + + xml = xml.replace('', + ''); + + fs.writeFileSync('plugin.xml', xml); +}); + +//emit array of cordova file references for all .h/.m files in path +function emitFiles(path){ + var ret = []; + for(filename of fs.readdirSync(path)){ + var fileType = null; + if(filename.match(/\.m$/)){ + fileType = 'source'; + }else if(filename.match(/\.h$/) || filename.match(/\.pch$/)){ + fileType = 'header'; + } + if(fileType){ + ret.push('<' + fileType + '-file src="' + path + filename + '" />'); + } + } + ret.push(''); + return ret; +} \ No newline at end of file diff --git a/plugin.template.xml b/plugin.template.xml new file mode 100644 index 00000000..5165dac0 --- /dev/null +++ b/plugin.template.xml @@ -0,0 +1,108 @@ + + + + + branch-cordova-sdk + Branch SDK Plugin + Apache 2.0 + cordova,branch + https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK.git + https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK/issues + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $BRANCH_KEY + + + + + CFBundleURLName + io.branch.sdk + CFBundleURLSchemes + + $URI_SCHEME + + + + + + + + + + diff --git a/plugin.xml b/plugin.xml index 17420318..4ab7bb93 100644 --- a/plugin.xml +++ b/plugin.xml @@ -103,24 +103,26 @@ SOFTWARE. - - - - + + +