From 9537e3468bc82141d9dd5815518aa8969c3e1799 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 13 Nov 2018 13:06:48 -0500 Subject: [PATCH] Test old plugin aidl & lib mapping - repros GH-547 (PR #550) (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 5a55cb8ea9..71137fb5f6 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -141,6 +141,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 () { @@ -326,6 +358,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 () {