Skip to content

Commit

Permalink
Merge pull request #8621 from cb1kenobi/timob-24041_6_0_X
Browse files Browse the repository at this point in the history
[TIMOB-24041] Added a 'hooks' folder to the bundled module zip file.
  • Loading branch information
hansemannn committed Nov 17, 2016
2 parents 7f974d8 + f0ad5f3 commit 082b79c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 9 deletions.
25 changes: 23 additions & 2 deletions android/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ AndroidModuleBuilder.prototype.initialize = function initialize(next) {
}
}, this);

this.hooksDir = path.join(this.projectDir, 'hooks');
this.sharedHooksDir = path.resolve(this.projectDir, '..', 'hooks');

this.timoduleXmlFile = path.join(this.projectDir, 'timodule.xml');
this.licenseFile = path.join(this.projectDir, 'LICENSE');
if (!fs.existsSync(this.licenseFile)) {
Expand Down Expand Up @@ -1369,7 +1372,25 @@ AndroidModuleBuilder.prototype.packageZip = function (next) {
}.bind(this));
}

// 4. Resources folder
// 4. hooks folder
var hookFiles = {};
if (fs.existsSync(this.hooksDir)) {
this.dirWalker(this.hooksDir, function (file) {
var relFile = path.relative(this.hooksDir, file);
hookFiles[relFile] = 1;
dest.append(fs.createReadStream(file), { name: path.join(moduleFolder, 'hooks', relFile) });
}.bind(this));
}
if (fs.existsSync(this.sharedHooksDir)) {
this.dirWalker(this.sharedHooksDir, function (file) {
var relFile = path.relative(this.sharedHooksDir, file);
if (!hookFiles[relFile]) {
dest.append(fs.createReadStream(file), { name: path.join(moduleFolder, 'hooks', relFile) });
}
}.bind(this));
}

// 5. Resources folder
if (fs.existsSync(this.resourcesDir)) {
this.dirWalker(this.resourcesDir, function (file, name) {
if (name !== 'README.md') {
Expand All @@ -1378,7 +1399,7 @@ AndroidModuleBuilder.prototype.packageZip = function (next) {
}.bind(this));
}

// 5. assets folder, not including js files
// 6. assets folder, not including js files
this.dirWalker(this.assetsDir, function (file) {
if (path.extname(file) !== '.js' && path.basename(file) !== 'README') {
dest.append(fs.createReadStream(file), { name: path.join(moduleFolder, 'assets', path.relative(this.assetsDir, file)) });
Expand Down
35 changes: 28 additions & 7 deletions iphone/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ iOSModuleBuilder.prototype.initialize = function initialize() {
}
}, this);

this.hooksDir = path.join(this.projectDir, 'hooks');
this.sharedHooksDir = path.resolve(this.projectDir, '..', 'hooks');

this.licenseDefault = "TODO: place your license here and we'll include it in the module distribution";
this.licenseFile = path.join(this.projectDir, 'LICENSE');
if (!fs.existsSync(this.licenseFile)) {
Expand Down Expand Up @@ -592,7 +595,25 @@ iOSModuleBuilder.prototype.packageModule = function packageModule() {
}.bind(this));
}

// 4. Resources folder
// 4. hooks folder
var hookFiles = {};
if (fs.existsSync(this.hooksDir)) {
this.dirWalker(this.hooksDir, function (file) {
var relFile = path.relative(this.hooksDir, file);
hookFiles[relFile] = 1;
dest.append(fs.createReadStream(file), { name: path.join(moduleFolders, 'hooks', relFile) });
}.bind(this));
}
if (fs.existsSync(this.sharedHooksDir)) {
this.dirWalker(this.sharedHooksDir, function (file) {
var relFile = path.relative(this.sharedHooksDir, file);
if (!hookFiles[relFile]) {
dest.append(fs.createReadStream(file), { name: path.join(moduleFolders, 'hooks', relFile) });
}
}.bind(this));
}

// 5. Resources folder
if (fs.existsSync(this.resourcesDir)) {
this.dirWalker(this.resourcesDir, function (file, name) {
if (name !== 'README.md') {
Expand All @@ -601,7 +622,7 @@ iOSModuleBuilder.prototype.packageModule = function packageModule() {
}.bind(this));
}

// 5. assets folder, not including js files
// 6. assets folder, not including js files
if (fs.existsSync(this.assetsDir)) {
this.dirWalker(this.assetsDir, function (file) {
if (path.extname(file) != '.js') {
Expand All @@ -610,11 +631,11 @@ iOSModuleBuilder.prototype.packageModule = function packageModule() {
}.bind(this));
}

// 6. the merge *.a file
// 7. LICENSE file
// 8. manifest
// 9. module.xcconfig
// 10. metadata.json
// 7. the merge *.a file
// 8. LICENSE file
// 9. manifest
// 10. module.xcconfig
// 11. metadata.json
dest.append(fs.createReadStream(binarylibFile), { name: path.join(moduleFolders, binarylibName) });
dest.append(fs.createReadStream(this.licenseFile), { name: path.join(moduleFolders,'LICENSE') });
dest.append(fs.createReadStream(this.manifestFile), { name: path.join(moduleFolders,'manifest') });
Expand Down

0 comments on commit 082b79c

Please sign in to comment.