Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): app builds fail with uppercase module JARs on case-sensitive systems #11417

Merged
merged 3 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ AndroidBuilder.prototype.generateLibProjectForModule = async function generateLi
await fs.emptyDir(projectLibsDirPath);

// Copy module's main JAR to project's "libs" directory.
const sourceJarFileName = moduleInfo.manifest.name.toLowerCase() + '.jar';
const sourceJarFileName = moduleInfo.manifest.name + '.jar';
const sourceJarFilePath = path.join(moduleInfo.modulePath, sourceJarFileName);
afs.copyFileSync(sourceJarFilePath, path.join(projectLibsDirPath, sourceJarFileName), {
logger: this.logger.debug
Expand Down Expand Up @@ -3124,10 +3124,10 @@ AndroidBuilder.prototype.generateJavaFiles = async function generateJavaFiles()

// Attempt to read the module's Java bindings JSON file.
let javaBindings = null;
const lowerCaseModuleName = module.manifest.name.toLowerCase();
const moduleName = module.manifest.name;
{
// Check if a "<module.name>.json" file exists in the module's root directory.
const jsonFilePath = path.join(module.modulePath, lowerCaseModuleName + '.json');
const jsonFilePath = path.join(module.modulePath, moduleName + '.json');
try {
if (await fs.exists(jsonFilePath)) {
const fileContent = await fs.readFile(jsonFilePath);
Expand All @@ -3144,7 +3144,7 @@ AndroidBuilder.prototype.generateJavaFiles = async function generateJavaFiles()
}
if (!javaBindings) {
// Check if a JSON file is embedded within the module's main JAR file.
const jarFilePath = path.join(module.modulePath, lowerCaseModuleName + '.jar');
const jarFilePath = path.join(module.modulePath, moduleName + '.jar');
try {
if (await fs.exists(jarFilePath)) {
javaBindings = this.getNativeModuleBindings(jarFilePath);
Expand Down
2 changes: 1 addition & 1 deletion android/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ AndroidModuleBuilder.prototype.packageZip = async function () {
// Add module's proxy binding JSON file to archive.
// Needed by the app build system when generating the "TiApplication" derived class to inject
// this module's classes into the KrollRuntime and to invoke module's onAppCreate() if defined.
const bindingsFileName = this.manifest.name.toLowerCase() + '.json';
const bindingsFileName = this.manifest.name + '.json';
const bindingsFilePath = path.join(this.buildModuleDir, 'build', 'ti-generated', 'json', bindingsFileName);
if (await fs.exists(bindingsFilePath)) {
dest.append(fs.createReadStream(bindingsFilePath), { name: path.join(moduleFolder, bindingsFileName) });
Expand Down
2 changes: 1 addition & 1 deletion android/templates/module/generated/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {
}

// Path to proxy binding JSON file created by "kroll-apt" annotation processor and used to do C/C++ code generation.
def tiModuleBindingsJsonPath = "${buildDir}/ti-generated/json/<%- moduleName.toLowerCase() %>.json".toString()
def tiModuleBindingsJsonPath = "${buildDir}/ti-generated/json/<%- moduleName %>.json".toString()

android {
compileSdkVersion <%- compileSdkVersion %>
Expand Down