talatuyarer commented on code in PR #36305:
URL: https://github.com/apache/beam/pull/36305#discussion_r2389827055


##########
scripts/beam-sql.sh:
##########
@@ -0,0 +1,260 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# A simple launcher for the Apache Beam SQL Shell.
+# This script builds a self-contained JAR with all dependencies using Maven,
+# which correctly handles service loading for IOs, and caches the JAR.
+set -e # Exit immediately if a command exits with a non-zero status.
+
+# --- Configuration ---
+DEFAULT_BEAM_VERSION="2.67.0"
+MAIN_CLASS="org.apache.beam.sdk.extensions.sql.jdbc.BeamSqlLine"
+# Directory to store cached executable JAR files
+CACHE_DIR="${HOME}/.beamshell/cache"
+mkdir -p "${CACHE_DIR}"
+
+# Create a temporary directory for our Maven project.
+WORK_DIR=$(mktemp -d)
+
+# --- Helper Functions ---
+# This function downloads the maven wrapper script and supporting files.
+function setup_maven_wrapper() {
+  echo "🔧 Setting up Maven Wrapper..."
+  local wrapper_dir="${WORK_DIR}/.mvn/wrapper"
+  mkdir -p "${wrapper_dir}"
+
+  # Define URLs for a stable version of the wrapper files
+  local 
mvnw_script_url="https://raw.githubusercontent.com/apache/maven-wrapper/maven-wrapper-3.2.0/src/main/wrapper/mvnw";
+  local 
wrapper_jar_url="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar";
+
+  # We will create the properties file ourselves to specify a modern Maven 
version
+  echo 
"distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip";
 > "${wrapper_dir}/maven-wrapper.properties"
+
+  # Download the mvnw script and the wrapper JAR
+  curl -sSL -o "${WORK_DIR}/mvnw" "${mvnw_script_url}"
+  curl -sSL -o "${wrapper_dir}/maven-wrapper.jar" "${wrapper_jar_url}"
+
+  # Make the wrapper script executable
+  chmod +x "${WORK_DIR}/mvnw"
+}
+
+function usage() {
+  echo "Usage: $0 [--version <beam_version>] [--runner <runner_name>] [--io 
<io_connector>]..."
+  echo ""
+  echo "A self-contained launcher for the Apache Beam SQL Shell."
+  echo ""
+  echo "Options:"
+  echo "  --version   Specify the Apache Beam version (default: 
${DEFAULT_BEAM_VERSION})."
+  echo "  --runner    Specify the Beam runner to use (default: direct). 
Supported: direct, dataflow."
+  echo "  --io        Specify an IO connector to include (e.g., iceberg, 
kafka). Can be used multiple times."
+  echo "  --list-versions      List all available Beam versions from Maven 
Central and exit."

Review Comment:
   I dont know how can I resolve for snapshot version. mvn central does not 
have snapshot versions. I will keep for release versions. If there is an ask 
for that We can change the script



##########
scripts/beam-sql.sh:
##########
@@ -0,0 +1,260 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# A simple launcher for the Apache Beam SQL Shell.
+# This script builds a self-contained JAR with all dependencies using Maven,
+# which correctly handles service loading for IOs, and caches the JAR.
+set -e # Exit immediately if a command exits with a non-zero status.
+
+# --- Configuration ---
+DEFAULT_BEAM_VERSION="2.67.0"
+MAIN_CLASS="org.apache.beam.sdk.extensions.sql.jdbc.BeamSqlLine"
+# Directory to store cached executable JAR files
+CACHE_DIR="${HOME}/.beamshell/cache"
+mkdir -p "${CACHE_DIR}"
+
+# Create a temporary directory for our Maven project.
+WORK_DIR=$(mktemp -d)
+
+# --- Helper Functions ---
+# This function downloads the maven wrapper script and supporting files.
+function setup_maven_wrapper() {
+  echo "🔧 Setting up Maven Wrapper..."
+  local wrapper_dir="${WORK_DIR}/.mvn/wrapper"
+  mkdir -p "${wrapper_dir}"
+
+  # Define URLs for a stable version of the wrapper files
+  local 
mvnw_script_url="https://raw.githubusercontent.com/apache/maven-wrapper/maven-wrapper-3.2.0/src/main/wrapper/mvnw";
+  local 
wrapper_jar_url="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar";
+
+  # We will create the properties file ourselves to specify a modern Maven 
version
+  echo 
"distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip";
 > "${wrapper_dir}/maven-wrapper.properties"
+
+  # Download the mvnw script and the wrapper JAR
+  curl -sSL -o "${WORK_DIR}/mvnw" "${mvnw_script_url}"
+  curl -sSL -o "${wrapper_dir}/maven-wrapper.jar" "${wrapper_jar_url}"
+
+  # Make the wrapper script executable
+  chmod +x "${WORK_DIR}/mvnw"
+}
+
+function usage() {
+  echo "Usage: $0 [--version <beam_version>] [--runner <runner_name>] [--io 
<io_connector>]..."
+  echo ""
+  echo "A self-contained launcher for the Apache Beam SQL Shell."
+  echo ""
+  echo "Options:"
+  echo "  --version   Specify the Apache Beam version (default: 
${DEFAULT_BEAM_VERSION})."
+  echo "  --runner    Specify the Beam runner to use (default: direct). 
Supported: direct, dataflow."
+  echo "  --io        Specify an IO connector to include (e.g., iceberg, 
kafka). Can be used multiple times."
+  echo "  --list-versions      List all available Beam versions from Maven 
Central and exit."
+  echo "  -h, --help  Show this help message."

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to