mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Merge pull request #550 from brodybits/gh-547-bugfix
Fix for old plugins with non-Java sources (GH-547)
This commit is contained in:
+19
-11
@@ -293,20 +293,28 @@ function generateAttributeError (attribute, element, id) {
|
||||
}
|
||||
|
||||
function getInstallDestination (obj) {
|
||||
return studioPathRemap(obj) ||
|
||||
path.join(obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
var APP_MAIN_PREFIX = 'app/src/main';
|
||||
|
||||
function studioPathRemap (obj) {
|
||||
// If any source file is using the app new directory structure,
|
||||
// don't penalize it
|
||||
if (!obj.targetDir.includes('app')) {
|
||||
if (obj.src.endsWith('.java')) {
|
||||
return path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
|
||||
if (obj.targetDir.includes('app')) {
|
||||
// If any source file is using the new app directory structure,
|
||||
// don't penalize it
|
||||
return path.join(obj.targetDir, path.basename(obj.src));
|
||||
} else if (obj.src.endsWith('.java')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.substring(4), path.basename(obj.src));
|
||||
} else if (obj.src.endsWith('.aidl')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'aidl', obj.targetDir.substring(4), path.basename(obj.src));
|
||||
} else if (obj.targetDir.includes('libs')) {
|
||||
if (obj.src.endsWith('.so')) {
|
||||
return path.join(APP_MAIN_PREFIX, 'jniLibs', obj.targetDir.substring(5), path.basename(obj.src));
|
||||
} else {
|
||||
// For all other files, add 'app/src/main' to the targetDir if it didn't have it already
|
||||
return path.join('app/src/main', obj.targetDir, path.basename(obj.src));
|
||||
return path.join('app', obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
} else if (obj.targetDir.includes('src/main')) {
|
||||
return path.join('app', obj.targetDir, path.basename(obj.src));
|
||||
} else {
|
||||
// For all other source files not using the new app directory structure,
|
||||
// add 'app/src/main' to the targetDir
|
||||
return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user