This is an automated email from the ASF dual-hosted git repository.
mariofusco pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new b7cb10c3f9 Updated AppPaths.java for better gradle compatibility
(#5587)
b7cb10c3f9 is described below
commit b7cb10c3f9701b2cd801f1bef750f22f3550f568
Author: Umut Sahin <[email protected]>
AuthorDate: Mon Nov 27 16:00:37 2023 +0300
Updated AppPaths.java for better gradle compatibility (#5587)
* Added better gradle compatibility to AppPaths
* Updated headers to Apache
* Updated findBuildTool method to better identify gradle
* Reverted findBuildTool changes
---
.../src/main/java/org/drools/codegen/common/AppPaths.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java
b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java
index 98655143bd..37479b76a1 100644
---
a/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java
+++
b/drools-model/drools-codegen-common/src/main/java/org/drools/codegen/common/AppPaths.java
@@ -45,11 +45,12 @@ public class AppPaths {
private final Collection<Path> classesPaths = new ArrayList<>();
private final boolean isJar;
+ private final BuildTool bt;
private final Path resourcesPath;
private final Path outputTarget;
public static AppPaths fromProjectDir(Path projectDir, Path outputTarget) {
- return new AppPaths(Collections.singleton(projectDir),
Collections.emptyList(), false, BuildTool.MAVEN, "main", outputTarget);
+ return new AppPaths(Collections.singleton(projectDir),
Collections.emptyList(), false, BuildTool.findBuildTool(), "main",
outputTarget);
}
/**
@@ -59,7 +60,7 @@ public class AppPaths {
* @return
*/
public static AppPaths fromTestDir(Path projectDir) {
- return new AppPaths(Collections.singleton(projectDir),
Collections.emptyList(), false, BuildTool.MAVEN, "test",
Paths.get(projectDir.toString(), TARGET_DIR));
+ return new AppPaths(Collections.singleton(projectDir),
Collections.emptyList(), false, BuildTool.findBuildTool(), "test",
Paths.get(projectDir.toString(), TARGET_DIR));
}
/**
@@ -72,6 +73,7 @@ public class AppPaths {
protected AppPaths(Set<Path> projectPaths, Collection<Path> classesPaths,
boolean isJar, BuildTool bt,
String resourcesBasePath, Path outputTarget) {
this.isJar = isJar;
+ this.bt = bt;
this.projectPaths.addAll(projectPaths);
this.classesPaths.addAll(classesPaths);
this.outputTarget = outputTarget;
@@ -91,7 +93,9 @@ public class AppPaths {
}
public Path getFirstProjectPath() {
- return projectPaths.iterator().next();
+ return bt == BuildTool.MAVEN
+ ? projectPaths.iterator().next()
+ : outputTarget;
}
private Path[] getJarPaths() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]