From 9d03e4ec0aebdd93a6fde0cb6798f5e1824002ac Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 12 Nov 2018 21:42:31 -0500 Subject: [PATCH 1/7] Fix tests of plugin files with new app dir scheme (new app target-dir scheme) --- spec/unit/pluginHandlers/handlers.spec.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 4c398eabb3..833933ce17 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -103,20 +103,20 @@ describe('android project handler', function () { }).toThrow(new Error('"' + target + '" already exists!')); }); - it('Test#007 : should allow installing sources using proper path', function () { + // TODO: renumber these tests and other tests below + it('Test#00a6 : should allow installing sources with new app target-dir scheme', function () { android['source-file'].install(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin2.java', temp, path.join('app/src/main/src/com/phonegap/plugins/dummyplugin/DummyPlugin2.java'), false); }); - // TODO: renumber these tests and other tests below - it('Test#007a : should allow installing lib file from sources using proper path', function () { + it('Test#006b : should allow installing jar lib file from sources with new app target-dir scheme', function () { android['source-file'].install(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/TestLib.jar', temp, path.join('app/libs/TestLib.jar'), false); }); - it('Test#007b : should allow installing aar file from sources using proper path', function () { + it('Test#006c : should allow installing aar lib file from sources with new app target-dir scheme', function () { android['source-file'].install(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/TestAar.aar', temp, path.join('app/libs/TestAar.aar'), false); @@ -270,36 +270,26 @@ describe('android project handler', function () { }); }); - // TODO: - // - merge tests of elements into single describe block - // (with proper beforeEach/afterEach) - // - renumber the tests after Test#019 describe('of elements', function () { it('Test#019 : should remove stuff by calling common.deleteJava for Android Studio projects', function () { android['source-file'].install(valid_source[0], dummyPluginInfo, dummyProject); android['source-file'].uninstall(valid_source[0], dummyPluginInfo, dummyProject); expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/java/com/phonegap/plugins/dummyplugin/DummyPlugin.java')); }); - }); - describe('of element, with specific app target-dir', function () { it('Test#019a : should remove stuff by calling common.deleteJava for Android Studio projects, with specific app target-dir', function () { android['source-file'].install(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true}); expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/src/com/phonegap/plugins/dummyplugin/DummyPlugin2.java')); }); - }); - describe('of element, with JAR in specific app target-dir', function () { - it('Test#019b : should remove stuff by calling common.deleteJava for Android Studio projects, with JAR into specific app target-dir', function () { + it('Test#019b : should remove stuff by calling common.removeFile for Android Studio projects, of jar with new app target-dir scheme', function () { android['source-file'].install(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestLib.jar')); }); - }); - describe('of element, with AAR in specific app target-dir', function () { - it('Test#019c : should remove stuff by calling common.deleteJava for Android Studio projects, with JAR into specific app target-dir', function () { + it('Test#019c : should remove stuff by calling common.removeFile for Android Studio projects, of aar with new app target-dir scheme', function () { android['source-file'].install(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestAar.aar')); From 578a6422098f9c1786834d6f98782142846f72cb Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 12 Nov 2018 21:50:20 -0500 Subject: [PATCH 2/7] Check target-dir mapping of plugin xml source file Possibly related to: CB-13830: Add handlers for plugins that use non-Java source files, such as Camera --- .../org.test.plugins.dummyplugin/plugin.xml | 1 + .../src/android/mysettings.xml | 1 + spec/unit/pluginHandlers/handlers.spec.js | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml diff --git a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml index b299b645a5..5cd28720b4 100644 --- a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml +++ b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml @@ -76,6 +76,7 @@ target-dir="app/libs" /> + diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml b/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml @@ -0,0 +1 @@ +dummy diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 833933ce17..1c5b2245d5 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -121,6 +121,13 @@ describe('android project handler', function () { expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/TestAar.aar', temp, path.join('app/libs/TestAar.aar'), false); }); + + it('Test#006d : should allow installing xml file from sources with old target-dir scheme', function () { + android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/mysettings.xml', temp, + path.join('app/src/main/res/xml/mysettings.xml'), false); + }); }); describe('of elements', function () { @@ -294,6 +301,12 @@ describe('android project handler', function () { android['source-file'].uninstall(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestAar.aar')); }); + + it('Test#019d : should remove stuff by calling common.removeFile for Android Studio projects, of xml with old target-dir scheme', function () { + android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/xml/mysettings.xml')); + }); }); describe('of elements', function () { From 92f07d0418aded0751120609025ac2df06d05a32 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 12 Nov 2018 22:01:13 -0500 Subject: [PATCH 3/7] Check old compat of other extension (CB-14125) of plugin source file installed into app/src/main with old target-dir scheme NOTE: These tests do *not* check compatibility of plugins with old lib target-dir scheme. --- .../org.test.plugins.dummyplugin/plugin.xml | 1 + .../src/android/other.extension | 1 + spec/unit/pluginHandlers/handlers.spec.js | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/other.extension diff --git a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml index 5cd28720b4..f4ae82beea 100644 --- a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml +++ b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml @@ -77,6 +77,7 @@ + diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/other.extension b/spec/fixtures/org.test.plugins.dummyplugin/src/android/other.extension new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/other.extension @@ -0,0 +1 @@ +dummy diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 1c5b2245d5..abac72991f 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -128,6 +128,13 @@ describe('android project handler', function () { 'src/android/mysettings.xml', temp, path.join('app/src/main/res/xml/mysettings.xml'), false); }); + + it('Test#006e : should allow installing file with other extension from sources with old target-dir scheme', function () { + android['source-file'].install(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/other.extension', temp, + path.join('app/src/main/res/values/other.extension'), false); + }); }); describe('of elements', function () { @@ -307,6 +314,12 @@ describe('android project handler', function () { android['source-file'].uninstall(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/xml/mysettings.xml')); }); + + it('Test#019e : should remove stuff by calling common.removeFile for Android Studio projects, of file with other extension with old target-dir scheme', function () { + android['source-file'].install(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/values/other.extension')); + }); }); describe('of elements', function () { From bbb3913a3648ca6cb7a2aeb593acded4a8e4cf4d Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 13 Nov 2018 13:06:48 -0500 Subject: [PATCH 4/7] Test old plugin aidl & lib mapping - repros GH-547 (reproduces GH-547) --- .../org.test.plugins.dummyplugin/plugin.xml | 4 ++ .../src/android/jniLibs/x86/libnative.so | 1 + .../src/android/myapi.aidl | 1 + .../src/android/testaar2.aar | 1 + .../src/android/testjar2.jar | 1 + spec/unit/pluginHandlers/handlers.spec.js | 60 +++++++++++++++++++ 6 files changed, 68 insertions(+) create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/jniLibs/x86/libnative.so create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/myapi.aidl create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/testaar2.aar create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/testjar2.jar diff --git a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml index f4ae82beea..4e2ebcc6c6 100644 --- a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml +++ b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml @@ -78,6 +78,10 @@ target-dir="app/libs" /> + + + + diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/jniLibs/x86/libnative.so b/spec/fixtures/org.test.plugins.dummyplugin/src/android/jniLibs/x86/libnative.so new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/jniLibs/x86/libnative.so @@ -0,0 +1 @@ +dummy diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/myapi.aidl b/spec/fixtures/org.test.plugins.dummyplugin/src/android/myapi.aidl new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/myapi.aidl @@ -0,0 +1 @@ +dummy diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/testaar2.aar b/spec/fixtures/org.test.plugins.dummyplugin/src/android/testaar2.aar new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/testaar2.aar @@ -0,0 +1 @@ +dummy diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/testjar2.jar b/spec/fixtures/org.test.plugins.dummyplugin/src/android/testjar2.jar new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/testjar2.jar @@ -0,0 +1 @@ +dummy diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index abac72991f..0f19d9a329 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -135,6 +135,38 @@ describe('android project handler', function () { 'src/android/other.extension', temp, path.join('app/src/main/res/values/other.extension'), false); }); + + it('Test#006f : should allow installing aidl file from sources with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/myapi.aidl', temp, + path.join('app/src/main/src/com/mytest/myapi.aidl'), false); + }); + + it('Test#006g : should allow installing aar lib file from sources with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/testaar2.aar', temp, + path.join('app/src/main/libs/testaar2.aar'), false); + }); + + it('Test#006h : should allow installing jar lib file from sources with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/testjar2.jar', temp, + path.join('app/src/main/libs/testjar2.jar'), false); + }); + + it('Test#006i : should allow installing .so lib file from sources with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/jniLibs/x86/libnative.so', temp, + path.join('app/src/main/libs/x86/libnative.so'), false); + }); }); describe('of elements', function () { @@ -320,6 +352,34 @@ describe('android project handler', function () { android['source-file'].uninstall(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/values/other.extension')); }); + + it('Test#019f : should remove stuff by calling common.removeFile for Android Studio projects, of aidl with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/src/com/mytest/myapi.aidl')); + }); + + it('Test#019g : should remove stuff by calling common.removeFile for Android Studio projects, of aar with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/testaar2.aar')); + }); + + it('Test#019h : should remove stuff by calling common.removeFile for Android Studio projects, of jar with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/testjar2.jar')); + }); + + it('Test#019i : should remove stuff by calling common.removeFile for Android Studio projects, of .so lib file with old target-dir scheme - reproduces GH-547', function () { + // reproduces GH-547 + android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/x86/libnative.so')); + }); }); describe('of elements', function () { From 21f84732c87cf758740571bf89f6721c368c2aea Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Wed, 14 Nov 2018 11:38:39 -0500 Subject: [PATCH 5/7] Cleanup getInstallDestination in pluginHandlers.js --- bin/templates/cordova/lib/pluginHandlers.js | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/bin/templates/cordova/lib/pluginHandlers.js b/bin/templates/cordova/lib/pluginHandlers.js index f1b0dba02a..364f4cde8e 100644 --- a/bin/templates/cordova/lib/pluginHandlers.js +++ b/bin/templates/cordova/lib/pluginHandlers.js @@ -293,20 +293,17 @@ function generateAttributeError (attribute, element, id) { } function getInstallDestination (obj) { - return studioPathRemap(obj) || - path.join(obj.targetDir, path.basename(obj.src)); -} - -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)); - } 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)); - } + var APP_MAIN_PREFIX = 'app/src/main'; + + if (obj.targetDir.includes('app')) { + // If any source file is using the app new 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 { + // For all other files, add 'app/src/main' to the targetDir if it didn't have it already + return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src)); } } From 895ab0c97026ec58bce563ff1f2d5eb2360b91cb Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Wed, 14 Nov 2018 11:40:33 -0500 Subject: [PATCH 6/7] Fix comments in getInstallDestination (in pluginHandlers.js) --- bin/templates/cordova/lib/pluginHandlers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/templates/cordova/lib/pluginHandlers.js b/bin/templates/cordova/lib/pluginHandlers.js index 364f4cde8e..2ef18c289c 100644 --- a/bin/templates/cordova/lib/pluginHandlers.js +++ b/bin/templates/cordova/lib/pluginHandlers.js @@ -296,13 +296,14 @@ function getInstallDestination (obj) { var APP_MAIN_PREFIX = 'app/src/main'; if (obj.targetDir.includes('app')) { - // If any source file is using the app new directory structure, + // 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 { - // For all other files, add 'app/src/main' to the targetDir if it didn't have it already + // 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)); } From a67bc75b93f4630e3a5ef9b09ad1ed72aaaa0bbf Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Wed, 14 Nov 2018 13:19:58 -0500 Subject: [PATCH 7/7] GH-547 Fix for old plugins with non-Java sources (source-file entries) including aidl, aar, jar, and so files --- bin/templates/cordova/lib/pluginHandlers.js | 10 ++++++ spec/unit/pluginHandlers/handlers.spec.js | 40 +++++++++------------ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/bin/templates/cordova/lib/pluginHandlers.js b/bin/templates/cordova/lib/pluginHandlers.js index 2ef18c289c..794154b547 100644 --- a/bin/templates/cordova/lib/pluginHandlers.js +++ b/bin/templates/cordova/lib/pluginHandlers.js @@ -301,6 +301,16 @@ function getInstallDestination (obj) { 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 { + 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 diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 0f19d9a329..20f5e6e93b 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -136,36 +136,32 @@ describe('android project handler', function () { path.join('app/src/main/res/values/other.extension'), false); }); - it('Test#006f : should allow installing aidl file from sources with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#006f : should allow installing aidl file from sources with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 'src/android/myapi.aidl', temp, - path.join('app/src/main/src/com/mytest/myapi.aidl'), false); + path.join('app/src/main/aidl/com/mytest/myapi.aidl'), false); }); - it('Test#006g : should allow installing aar lib file from sources with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#006g : should allow installing aar lib file from sources with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 'src/android/testaar2.aar', temp, - path.join('app/src/main/libs/testaar2.aar'), false); + path.join('app/libs/testaar2.aar'), false); }); - it('Test#006h : should allow installing jar lib file from sources with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#006h : should allow installing jar lib file from sources with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 'src/android/testjar2.jar', temp, - path.join('app/src/main/libs/testjar2.jar'), false); + path.join('app/libs/testjar2.jar'), false); }); - it('Test#006i : should allow installing .so lib file from sources with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#006i : should allow installing .so lib file from sources with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 'src/android/jniLibs/x86/libnative.so', temp, - path.join('app/src/main/libs/x86/libnative.so'), false); + path.join('app/src/main/jniLibs/x86/libnative.so'), false); }); }); @@ -353,32 +349,28 @@ describe('android project handler', function () { expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/values/other.extension')); }); - it('Test#019f : should remove stuff by calling common.removeFile for Android Studio projects, of aidl with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#019f : should remove stuff by calling common.removeFile for Android Studio projects, of aidl with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true}); - expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/src/com/mytest/myapi.aidl')); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/aidl/com/mytest/myapi.aidl')); }); - it('Test#019g : should remove stuff by calling common.removeFile for Android Studio projects, of aar with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#019g : should remove stuff by calling common.removeFile for Android Studio projects, of aar with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true}); - expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/testaar2.aar')); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/testaar2.aar')); }); - it('Test#019h : should remove stuff by calling common.removeFile for Android Studio projects, of jar with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#019h : should remove stuff by calling common.removeFile for Android Studio projects, of jar with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true}); - expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/testjar2.jar')); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/testjar2.jar')); }); - it('Test#019i : should remove stuff by calling common.removeFile for Android Studio projects, of .so lib file with old target-dir scheme - reproduces GH-547', function () { - // reproduces GH-547 + it('Test#019i : should remove stuff by calling common.removeFile for Android Studio projects, of .so lib file with old target-dir scheme (GH-547)', function () { android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); android['source-file'].uninstall(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true}); - expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/libs/x86/libnative.so')); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/jniLibs/x86/libnative.so')); }); });