Skip to content

Commit

Permalink
* fixed broken reg-exp for version matching (development image lookup…
Browse files Browse the repository at this point in the history
…), added testcases for new code (#427)
  • Loading branch information
dkimitsa authored and Tom-Ski committed Nov 7, 2019
1 parent 83e43df commit 2f99780
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

}

0 comments on commit 2f99780

Please sign in to comment.