This is an automated email from the ASF dual-hosted git repository.

sdanilov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 54a6a70df5 IGNITE-18399 Adapt WorkDirectoryExtension to Gradle (#1445)
54a6a70df5 is described below

commit 54a6a70df5f1bec9fb28cd6e76dbd61627dbe9cf
Author: Alexander Polovtcev <[email protected]>
AuthorDate: Tue Dec 13 22:52:44 2022 +0300

    IGNITE-18399 Adapt WorkDirectoryExtension to Gradle (#1445)
---
 .../internal/testframework/WorkDirectoryExtension.java  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/modules/core/src/testFixtures/java/org/apache/ignite/internal/testframework/WorkDirectoryExtension.java
 
b/modules/core/src/testFixtures/java/org/apache/ignite/internal/testframework/WorkDirectoryExtension.java
index 044590939f..7c087a517b 100644
--- 
a/modules/core/src/testFixtures/java/org/apache/ignite/internal/testframework/WorkDirectoryExtension.java
+++ 
b/modules/core/src/testFixtures/java/org/apache/ignite/internal/testframework/WorkDirectoryExtension.java
@@ -56,8 +56,8 @@ import 
org.junit.platform.commons.support.HierarchyTraversalMode;
  * to the module, where the tests are being run, and their paths depends on 
the lifecycle of the folder:
  *
  * <ol>
- *     <li>For test methods: "target/work/{@literal 
<name-of-the-test-class>/<name-of-the-test-method>_<current_time_millis>}"</li>
- *     <li>For test classes: "target/work/{@literal 
<name-of-the-test-class>/static_<current_time_millis>}"</li>
+ *     <li>For test methods: "build/work/{@literal 
<name-of-the-test-class>/<name-of-the-test-method>_<current_time_millis>}"</li>
+ *     <li>For test classes: "build/work/{@literal 
<name-of-the-test-class>/static_<current_time_millis>}"</li>
  * </ol>
  *
  * <p>Temporary folders are removed after tests have finished running, but 
this behaviour can be controlled by setting the
@@ -75,7 +75,7 @@ public class WorkDirectoryExtension
     public static final String KEEP_WORK_DIR_PROPERTY = "KEEP_WORK_DIR";
 
     /** Base path for all temporary folders in a module. */
-    private static final Path BASE_PATH = Path.of("target", "work");
+    private static final Path BASE_PATH = getBasePath();
 
     /** Name of the work directory that will be injected into {@link 
BeforeAll} methods or static members. */
     private static final String STATIC_FOLDER_NAME = "static";
@@ -270,4 +270,15 @@ public class WorkDirectoryExtension
         }
     }
 
+    private static Path getBasePath() {
+        // Maven build folder
+        Path mavenPath = Path.of("target");
+
+        if (Files.exists(mavenPath)) {
+            return mavenPath.resolve("work");
+        } else {
+            // Gradle build folder
+            return Path.of("build", "work");
+        }
+    }
 }

Reply via email to