From 27d3f8139bf1a0d5e2062f95804e3faf7a748dc5 Mon Sep 17 00:00:00 2001 From: Demyan Kimitsa Date: Thu, 7 Nov 2019 17:18:21 +0200 Subject: [PATCH] * fixed broken reg-exp for version matching (development image lookup), added testcases for new code --- .../libimobiledevice/util/AppLauncher.java | 16 ++++++++++++++-- .../libimobiledevice/util/AppLauncherTest.java | 12 +++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/compiler/libimobiledevice/src/main/java/org/robovm/libimobiledevice/util/AppLauncher.java b/compiler/libimobiledevice/src/main/java/org/robovm/libimobiledevice/util/AppLauncher.java index f584d67a1..9e659b0b3 100755 --- a/compiler/libimobiledevice/src/main/java/org/robovm/libimobiledevice/util/AppLauncher.java +++ b/compiler/libimobiledevice/src/main/java/org/robovm/libimobiledevice/util/AppLauncher.java @@ -593,8 +593,20 @@ static File findDeveloperImage(File dsDir, String productVersion, String buildVe String.format("%s\\.%s \\(.*\\)", versionParts[0], versionParts[1]), // 7.0 String.format("%s\\.%s", versionParts[0], versionParts[1]), - // 7.(*) -- forced anything after major to allow using older image with newer devices (e.g. 13.0 with 13.1 device) - String.format("%s\\.(.*\\)", versionParts[0]) + // + // wildcard versions to allow newer devices to work with older sdk as long as major version matches + // 7.0.* (*) + String.format("%s\\.%s\\.\\d+ \\(.*\\)", versionParts[0], versionParts[1]), + // 7.0.* + String.format("%s\\.%s\\.\\d+", versionParts[0], versionParts[1]), + // 7.*.* (*) + String.format("%s\\.\\d+\\.\\d+ \\(.*\\)", versionParts[0]), + // 7.*.* + String.format("%s\\.\\d+\\.\\d+", versionParts[0]), + // 7.* (*) + String.format("%s\\.\\d+ \\(.*\\)", versionParts[0]), + // 7.* + String.format("%s\\.\\d+", versionParts[0]) }; File[] dirs = dsDir.listFiles(); diff --git a/compiler/libimobiledevice/src/test/java/org/robovm/libimobiledevice/util/AppLauncherTest.java b/compiler/libimobiledevice/src/test/java/org/robovm/libimobiledevice/util/AppLauncherTest.java index 8c91aa400..97a2b3e72 100755 --- a/compiler/libimobiledevice/src/test/java/org/robovm/libimobiledevice/util/AppLauncherTest.java +++ b/compiler/libimobiledevice/src/test/java/org/robovm/libimobiledevice/util/AppLauncherTest.java @@ -52,13 +52,23 @@ public void testFindDeveloperImage() throws Exception { File f613 = createDeveloperImage(dsDir, "6.1.3", false); File f70_11A465 = createDeveloperImage(dsDir, "7.0 (11A465)"); File f703_11B508 = createDeveloperImage(dsDir, "7.0.3 (11B508)"); - + File f812_13B812 = createDeveloperImage(dsDir, "8.1.2 (13B812)"); + File f92 = createDeveloperImage(dsDir, "9.2"); + File f102 = createDeveloperImage(dsDir, "10.2 (14D123)"); + assertEquals(f703_11B508, AppLauncher.findDeveloperImage(dsDir.toFile(), "7.0.3", "11B508")); assertEquals(f61, AppLauncher.findDeveloperImage(dsDir.toFile(), "6.1.3", "10A123")); assertEquals(f61, AppLauncher.findDeveloperImage(dsDir.toFile(), "6.1.1", "10A123")); assertEquals(f612, AppLauncher.findDeveloperImage(dsDir.toFile(), "6.1.2", "10A123")); assertEquals(f703_11B508, AppLauncher.findDeveloperImage(dsDir.toFile(), "7.0.3", "12C123")); assertEquals(f70_11A465, AppLauncher.findDeveloperImage(dsDir.toFile(), "7.0.2", "12C123")); + // finding not exact match + assertEquals(f812_13B812, AppLauncher.findDeveloperImage(dsDir.toFile(), "8.1.3", "14C710")); + assertEquals(f812_13B812, AppLauncher.findDeveloperImage(dsDir.toFile(), "8.2", "14C710")); + assertEquals(f92, AppLauncher.findDeveloperImage(dsDir.toFile(), "9.3.3", "15C710")); + assertEquals(f92, AppLauncher.findDeveloperImage(dsDir.toFile(), "9.3", "15C710")); + assertEquals(f102, AppLauncher.findDeveloperImage(dsDir.toFile(), "10.3.5", "15C710")); + assertEquals(f102, AppLauncher.findDeveloperImage(dsDir.toFile(), "10.3", "15C710")); } }