Skip to content

Commit 65af30e

Browse files
committed
[#6603] chore(*): fix CLI.sh can't find the Jar
Changing the packaging flow, Copy the CLI-related jars to package/libs and add gcli.sh to bin.
1 parent b237637 commit 65af30e

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

bin/gcli.sh.template

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# Referred from Apache Submarine's common.sh implementation
19+
# bin/common.sh
20+
21+
set -e
22+
23+
if [ -L "${BASH_SOURCE-$0}" ]; then
24+
FWDIR=$(dirname "$(readlink "${BASH_SOURCE-$0}")")
25+
else
26+
FWDIR=$(dirname "${BASH_SOURCE-$0}")
27+
fi
28+
29+
FWDIR=$(
30+
cd "$FWDIR" || exit 2
31+
pwd
32+
)
33+
34+
ROOT_DIR=$(dirname "$FWDIR")
35+
ROOT_DIR=$(
36+
cd "$ROOT_DIR" || exit 2
37+
pwd
38+
)
39+
40+
. "${FWDIR}/common.sh"
41+
42+
CLI_JAR=$(find "$ROOT_DIR/libs" -name "gravitino-cli-*-incubating-SNAPSHOT.jar" 2>/dev/null)
43+
VERSION=$(basename "$CLI_JAR" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
44+
if [ -z "$CLI_JAR" ]; then
45+
echo "Could not find CLI jar in $ROOT_DIR/libs "
46+
exit 1
47+
fi
48+
49+
50+
echo "Find CLI jar version: $VERSION"
51+
java -jar "$CLI_JAR" "$@"

build.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,12 @@ tasks {
819819
setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
820820
}
821821
}
822+
823+
dependsOn("clients:cli:build")
824+
from("clients/cli/build/libs")
825+
into("distribution/package/libs")
826+
include("*.jar")
827+
setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
822828
}
823829

824830
register("copyCatalogLibAndConfigs", Copy::class) {

0 commit comments

Comments
 (0)