Skip to content
Permalink
Browse files

8236518: There is no Native Packages WinUpgradeUUIDTest-2.0.exe after…

… creating Native packages on win

Reviewed-by: asemenyuk, almatvee
  • Loading branch information
Andy Herrick
Andy Herrick committed May 7, 2020
1 parent 1a16a4b commit 29f015cf61fb8dadb53176c7543062f29c0cd4f9
@@ -603,7 +603,7 @@ private Executor createExecutor() {

if (isImagePackageType()) {
TKit.deleteDirectoryContentsRecursive(outputDir());
} else if (ThrowingSupplier.toSupplier(() -> Files.deleteIfExists(
} else if (ThrowingSupplier.toSupplier(() -> TKit.deleteIfExists(
outputBundle())).get()) {
TKit.trace(
String.format("Deleted [%s] file before running jpackage",
@@ -399,6 +399,15 @@ public void accept(Path root) {
private boolean contentsOnly;
}

public static boolean deleteIfExists(Path path) throws IOException {
if (isWindows()) {
if (path.toFile().exists()) {
Files.setAttribute(path, "dos:readonly", false);
}
}
return Files.deleteIfExists(path);
}

/**
* Deletes contents of the given directory recursively. Shortcut for
* <code>deleteDirectoryContentsRecursive(path, null)</code>
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
* @requires (jpackage.test.SQETest == null)
* @build jdk.jpackage.test.*
* @requires (os.family == "windows")
* @modules jdk.jpackage/jdk.jpackage.internal
* @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
* @compile WinUpgradeUUIDTest.java
* @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main
* --jpt-run=WinUpgradeUUIDTest
@@ -79,10 +79,6 @@ public static void test() {
final UUID upgradeCode = UUID.fromString(
"F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB");
return new PackageTest()
.forTypes(PackageType.WINDOWS)
.configureHelloApp()
.addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
upgradeCode.toString()))
.forTypes(PackageType.WIN_MSI)
.addBundlePropertyVerifier("UpgradeCode", value -> {
if (value.startsWith("{")) {
@@ -92,7 +88,12 @@ public static void test() {
value = value.substring(0, value.length() - 1);
}
return UUID.fromString(value).equals(upgradeCode);
}, "is a match with");
}, "is a match with")
.forTypes(PackageType.WINDOWS)
.configureHelloApp()
.addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
upgradeCode.toString())) ;

};

// Replace real uninstall command for the first package with nop action.

0 comments on commit 29f015c

Please sign in to comment.