diff --git a/assets/runtime/android/files/android-runtime-1463-1459/gradle.properties b/assets/runtime/android/files/android-runtime-1463-1459/gradle.properties new file mode 100644 index 00000000..55c5b250 --- /dev/null +++ b/assets/runtime/android/files/android-runtime-1463-1459/gradle.properties @@ -0,0 +1 @@ +useKotlin=true \ No newline at end of file diff --git a/core/utils/file_utils.py b/core/utils/file_utils.py index 90a623e7..df0fecd6 100644 --- a/core/utils/file_utils.py +++ b/core/utils/file_utils.py @@ -306,6 +306,14 @@ def get_files_names_in_zip(file_path): zfile.close() return file_names + @staticmethod + def is_file_in_zip(zip_file, file_name_to_check): + files_list = File.get_files_names_in_zip(zip_file) + for current_file in files_list: + if file_name_to_check in str(current_file.filename): + return True + return False + @staticmethod def download(file_name, url, destination_dir=Settings.TEST_RUN_HOME): file_path = os.path.join(destination_dir, file_name) diff --git a/tests/runtimes/android/abi_split_with_snapshot_tests.py b/tests/runtimes/android/abi_split_with_snapshot_tests.py index d237ea60..0ef58ea7 100644 --- a/tests/runtimes/android/abi_split_with_snapshot_tests.py +++ b/tests/runtimes/android/abi_split_with_snapshot_tests.py @@ -41,14 +41,6 @@ def setUpClass(cls): Adb.uninstall(cls.app_id, device_id, assert_success=False) Tns.platform_add_android(APP_NAME, framework_path=Android.FRAMEWORK_PATH) - @staticmethod - def check_file_in_zip(zip_file, file_name_to_check): - files_list = File.get_files_names_in_zip(zip_file) - for current_file in files_list: - if file_name_to_check in str(current_file.filename): - return True - return False - def test_100_build_app_with_abi_split_and_snapshot(self): """ Test build with abi split and snapshot. Also check if the apk for emulator is working @@ -83,31 +75,31 @@ def test_100_build_app_with_abi_split_and_snapshot(self): app_x86_64_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-x86_64-release.apk") - assert self.check_file_in_zip(app_x86_64_release_path, os.path.join("x86_64", "libNativeScript.so")) + assert File.is_file_in_zip(app_x86_64_release_path, os.path.join("x86_64", "libNativeScript.so")) assert File.exists(app_x86_64_release_path) app_arm64_v8a_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-arm64-v8a-release.apk") assert File.exists(app_arm64_v8a_release_path) - assert self.check_file_in_zip(app_arm64_v8a_release_path, os.path.join("arm64-v8a", "libNativeScript.so")) + assert File.is_file_in_zip(app_arm64_v8a_release_path, os.path.join("arm64-v8a", "libNativeScript.so")) app_armeabi_v7a_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-armeabi-v7a-release.apk") assert File.exists(app_armeabi_v7a_release_path) - assert self.check_file_in_zip(app_armeabi_v7a_release_path, os.path.join("armeabi-v7a", "libNativeScript.so")) + assert File.is_file_in_zip(app_armeabi_v7a_release_path, os.path.join("armeabi-v7a", "libNativeScript.so")) app_x86_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-x86-release.apk") assert File.exists(app_x86_release_path) - assert self.check_file_in_zip(app_x86_release_path, os.path.join("x86", "libNativeScript.so")) + assert File.is_file_in_zip(app_x86_release_path, os.path.join("x86", "libNativeScript.so")) app_universal_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-universal-release.apk") assert File.exists(app_universal_release_path) - assert self.check_file_in_zip(app_universal_release_path, os.path.join("arm64-v8a", "libNativeScript.so")) - assert self.check_file_in_zip(app_universal_release_path, os.path.join("armeabi-v7a", "libNativeScript.so")) - assert self.check_file_in_zip(app_universal_release_path, os.path.join("x86", "libNativeScript.so")) - assert self.check_file_in_zip(app_universal_release_path, os.path.join("x86_64", "libNativeScript.so")) + assert File.is_file_in_zip(app_universal_release_path, os.path.join("arm64-v8a", "libNativeScript.so")) + assert File.is_file_in_zip(app_universal_release_path, os.path.join("armeabi-v7a", "libNativeScript.so")) + assert File.is_file_in_zip(app_universal_release_path, os.path.join("x86", "libNativeScript.so")) + assert File.is_file_in_zip(app_universal_release_path, os.path.join("x86_64", "libNativeScript.so")) AbiSplitHelper.assert_apk( os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_RELEASE_PATH, "app-x86-release.apk"), diff --git a/tests/runtimes/android/android_plugins_tests.py b/tests/runtimes/android/android_plugins_tests.py index 7bcd238a..0bbd3279 100644 --- a/tests/runtimes/android/android_plugins_tests.py +++ b/tests/runtimes/android/android_plugins_tests.py @@ -13,6 +13,7 @@ from data.templates import Template from products.nativescript.tns import Tns +PLATFORM_ANDROID_APK_DEBUG_PATH = os.path.join('platforms', 'android', 'app', 'build', 'outputs', 'apk', 'debug') APP_NAME = AppName.DEFAULT @@ -331,3 +332,23 @@ def test_451_support_external_buildscript_config_in_plugin(self): Tns.plugin_add(plugin_path, path=APP_NAME, verify=False) Tns.build_android(os.path.join(TEST_RUN_HOME, APP_NAME), verify=True) + + Tns.plugin_remove("sample-plugin-2", verify=False, path=APP_NAME) + + def test_452_support_gradle_properties_for_enable_Kotlin(self): + """ + Support gradle.properties file for enable Kotlin + https://github.com/NativeScript/android-runtime/issues/1459 + https://github.com/NativeScript/android-runtime/issues/1463 + """ + Tns.plugin_remove("sample-plugin-2", verify=False, path=APP_NAME) + source_app_gradle = os.path.join(TEST_RUN_HOME, 'assets', 'runtime', 'android', 'files', + 'android-runtime-1463-1459', 'gradle.properties') + target_app_gradle = os.path.join(TEST_RUN_HOME, APP_NAME, 'app', 'App_Resources', 'Android') + File.copy(source=source_app_gradle, target=target_app_gradle, backup_files=True) + + Tns.build_android(os.path.join(TEST_RUN_HOME, APP_NAME), verify=True) + app_universal_release_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_DEBUG_PATH, + "app-debug.apk") + assert File.exists(app_universal_release_path) + assert File.is_file_in_zip(app_universal_release_path, os.path.join("kotlin")), "Kotlin is not working!" diff --git a/tests/runtimes/ios/ios_runtime_tests.py b/tests/runtimes/ios/ios_runtime_tests.py index 7f1f12ee..d8b59fc8 100644 --- a/tests/runtimes/ios/ios_runtime_tests.py +++ b/tests/runtimes/ios/ios_runtime_tests.py @@ -65,7 +65,7 @@ def test_201_test_init_mocha_js_stacktrace(self): # https://github.com/NativeScript/nativescript-cli/issues/4524 strings = ['JavaScript stack trace', 'JS ERROR AssertionError: expected -1 to equal 1'] - TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=90) + TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=120) def test_380_tns_run_ios_plugin_dependencies(self): """