Skip to content

Commit

Permalink
feat(android): module build should add "build.gradle" if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jquick-axway authored and sgtcoolguy committed Mar 2, 2020
1 parent 73c73b6 commit 6e066e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 13 additions & 3 deletions android/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ AndroidModuleBuilder.prototype.run = async function run(logger, config, cli, fin
cli.emit('build.module.pre.compile', this, resolve);
});

// If this is a "hybrid" module (has native and JS code), then make sure "manifest" is flagged as "commonjs".
await this.updateModuleManifest();
// Update module files such as "manifest" if needed.
await this.updateModuleFiles();

// Generate all gradle project files.
await this.generateRootProjectFiles();
Expand Down Expand Up @@ -459,7 +459,17 @@ AndroidModuleBuilder.prototype.cleanup = async function cleanup() {
}
};

AndroidModuleBuilder.prototype.updateModuleManifest = async function updateModuleManifest() {
AndroidModuleBuilder.prototype.updateModuleFiles = async function updateModuleFiles() {
// Add empty "build.gradle" template file to project folder if missing. Used to define library dependencies.
// Note: Appcelerator Studio looks for this file to determine if this is an Android module project.
const buildGradleFileName = 'build.gradle';
const buildGradleFilePath = path.join(this.projectDir, buildGradleFileName);
if (!await fs.exists(buildGradleFilePath)) {
await fs.copyFile(
path.join(this.platformPath, 'templates', 'module', 'default', 'template', 'android', buildGradleFileName),
buildGradleFilePath);
}

// Determine if "assets" directory contains at least 1 JavaScript file.
let hasJSFile = false;
if (await fs.exists(this.assetsDir)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

repositories {
google()
jcenter()
}

dependencies {
// Add the module's library dependencies here.
// See: https://developer.android.com/studio/build/dependencies
Expand Down

0 comments on commit 6e066e0

Please sign in to comment.