This is an automated email from the ASF dual-hosted git repository.
ulyssesyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 8ef211a1d [KYUUBI #2328] Support getting mainResource in the module
target directory of KYUUBI_HOME
8ef211a1d is described below
commit 8ef211a1d9df16b0e48928947ad58a420030c373
Author: wforget <[email protected]>
AuthorDate: Thu Apr 14 09:51:50 2022 +0800
[KYUUBI #2328] Support getting mainResource in the module target directory
of KYUUBI_HOME
### _Why are the changes needed?_
close #2328
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [X] Add screenshots for manual tests if appropriate


- [ ] [Run
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #2350 from wForget/KYUUBI-2328.
Closes #2328
8e4f5d1a [wforget] [KYUUBI-2328] Support getting mainResource in the module
target directory of KYUUBI_HOME
Authored-by: wforget <[email protected]>
Signed-off-by: ulysses-you <[email protected]>
---
.../src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
index 2919dbb91..39c58b04d 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
@@ -72,9 +72,13 @@ trait ProcBuilder {
}
}.orElse {
// 2. get the main resource jar from system build default
- env.get(KYUUBI_HOME)
- .map { Paths.get(_, "externals", "engines", shortName, jarName) }
- .filter(Files.exists(_)).map(_.toAbsolutePath.toFile.getCanonicalPath)
+ env.get(KYUUBI_HOME).toSeq
+ .flatMap { p =>
+ Seq(
+ Paths.get(p, "externals", "engines", shortName, jarName),
+ Paths.get(p, "externals", module, "target", jarName))
+ }
+ .find(Files.exists(_)).map(_.toAbsolutePath.toFile.getCanonicalPath)
}.orElse {
// 3. get the main resource from dev environment
val cwd = Utils.getCodeSourceLocation(getClass).split("kyuubi-server")