You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/29 13:54:31 UTC

[GitHub] [pulsar] nicoloboschi opened a new pull request, #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

nicoloboschi opened a new pull request, #17243:
URL: https://github.com/apache/pulsar/pull/17243

   Fixes #16688
   
   TL; DR - now Pulsar shell works on Windows
   ![Screen Shot 2022-08-23 at 6 02 50 PM](https://user-images.githubusercontent.com/23314389/186206825-b644054a-8729-4a79-902f-a6ac598d6929.png)
   
   
   ### Motivation
   Currently pulsar shell is only runnable on Unix system because the entry point script is written in bash.
   
   ### Modifications
   
   1. Provided a new `pulsar-shell.cmd`, `pulsar-admin.cmd`, `pulsar-client.cmd` and `pulsar-perf.cmd` files (written in Windows Command Prompt language) that starts their processes
   
   It implements the exact same configurations from the current pulsar-shell, even the java8 detection. The only thing not implemented is the on-the-fly compile. Actually, the batch script only work if you unzip the distro tarball. Running it from the codebase (so without the `lib` dir) is not supported (and it's okay since currently it's not even possible develop Pulsar on a Win machine)
   
   2. Added the jna lib to make the jline command prompt display colors correctly - will need to upgrade to the latest JNA version to fix some current issues
   
   3. Added zip distribution to pulsar-shell (distribution/shell). The idea is to distribute both and suggest to download the .zip for Windows user
   
   - [x] `doc-not-needed` 
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi closed pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi closed pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows
URL: https://github.com/apache/pulsar/pull/17243


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957382006


##########
pom.xml:
##########
@@ -211,7 +211,7 @@ flexible messaging model and an intuitive client API.</description>
     <jakarta.activation.version>1.2.2</jakarta.activation.version>
     <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
     <jakarta.validation.version>2.0.2</jakarta.validation.version>
-    <jna.version>5.12.1</jna.version>
+    <jna.version>4.2.0</jna.version>

Review Comment:
   oh thanks, that's what I call a bad git rebase



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957383511


##########
distribution/shell/src/assemble/shell.xml:
##########
@@ -24,6 +24,7 @@
   <id>shell</id>
   <formats>
     <format>tar.gz</format>
+    <format>zip</format>

Review Comment:
   in this way we could make the .zip downloadable (from the download page) for Windows users which is a more friendly format for win
   
   this change doesn't affect the build time (more or less 2 secs on my laptop)



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957385405


##########
distribution/shell/src/assemble/shell.xml:
##########
@@ -24,6 +24,7 @@
   <id>shell</id>
   <formats>
     <format>tar.gz</format>
+    <format>zip</format>

Review Comment:
   It can consume more space as this comment https://github.com/apache/pulsar/pull/17062#discussion_r947672761.
   
   Although, fair enough for convenience to Windows users :)



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957378865


##########
pom.xml:
##########
@@ -211,7 +211,7 @@ flexible messaging model and an intuitive client API.</description>
     <jakarta.activation.version>1.2.2</jakarta.activation.version>
     <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
     <jakarta.validation.version>2.0.2</jakarta.validation.version>
-    <jna.version>5.12.1</jna.version>
+    <jna.version>4.2.0</jna.version>

Review Comment:
   I guess you'd prefer revert this change as described in https://github.com/apache/pulsar/pull/17262?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r1061272669


##########
bin/pulsar-admin-common.cmd:
##########
@@ -0,0 +1,82 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM   http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+
+@echo off
+
+if "%JAVA_HOME%" == "" (
+  for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
+) else (
+  set "JAVACMD=%JAVA_HOME%\bin\java.exe"
+)
+
+if not exist "%JAVACMD%" (
+  echo The JAVA_HOME environment variable is not defined correctly, so Pulsar CLI cannot be started. >&2
+  echo JAVA_HOME is set to "%JAVA_HOME%", but "%JAVACMD%" does not exist. >&2
+  goto error
+)
+
+
+for %%i in ("%~dp0.") do SET "SCRIPT_PATH=%%~fi"
+set "PULSAR_HOME_DIR=%SCRIPT_PATH%\..\"
+for %%i in ("%PULSAR_HOME_DIR%.") do SET "PULSAR_HOME=%%~fi"
+set "PULSAR_CLASSPATH=%PULSAR_CLASSPATH%;%PULSAR_HOME%\lib\*"
+
+
+if "%PULSAR_CLIENT_CONF%" == "" set "PULSAR_CLIENT_CONF=%PULSAR_HOME%\conf\client.conf"
+if "%PULSAR_LOG_CONF%" == "" set "PULSAR_LOG_CONF=%PULSAR_HOME%\conf\log4j2.yaml"
+
+set "PULSAR_LOG_CONF_DIR1=%PULSAR_LOG_CONF%\..\"
+for %%i in ("%PULSAR_LOG_CONF_DIR1%.") do SET "PULSAR_LOG_CONF_DIR=%%~fi"
+for %%a in ("%PULSAR_LOG_CONF%") do SET "PULSAR_LOG_CONF_BASENAME=%%~nxa"
+
+set "PULSAR_CLASSPATH=%PULSAR_CLASSPATH%;%PULSAR_LOG_CONF_DIR%"
+
+set "OPTS=%OPTS% -Dlog4j.configurationFile="%PULSAR_LOG_CONF_BASENAME%""
+set "OPTS=%OPTS% -Djava.net.preferIPv4Stack=true"
+
+set "isjava8=false"
+FOR /F "tokens=*" %%g IN ('"java -version 2>&1"') do (
+  echo %%g|find "version" >nul
+  if errorlevel 0 (
+    echo %%g|find "1.8" >nul
+    if errorlevel 0 (
+     set "isjava8=true"
+    )
+  )
+)
+
+if "%isjava8%" == "false" set "OPTS=%OPTS% --add-opens java.base/sun.net=ALL-UNNAMED"
+
+set "OPTS=-cp "%PULSAR_CLASSPATH%" %OPTS%"
+set "OPTS=%OPTS% %PULSAR_EXTRA_OPTS%"
+
+if "%PULSAR_LOG_DIR%" == "" set "PULSAR_LOG_DIR=%PULSAR_HOME%\logs"
+if "%PULSAR_LOG_APPENDER%" == "" set "PULSAR_LOG_APPENDER=RoutingAppender"
+if "%PULSAR_LOG_LEVEL%" == "" set "PULSAR_LOG_LEVEL=info"
+if "%PULSAR_LOG_ROOT_LEVEL%" == "" set "PULSAR_LOG_ROOT_LEVEL=%PULSAR_LOG_LEVEL%"
+if "%PULSAR_ROUTING_APPENDER_DEFAULT%" == "" set "PULSAR_ROUTING_APPENDER_DEFAULT=Console"
+
+set "OPTS=%OPTS% -Dpulsar.log.appender=%PULSAR_LOG_APPENDER%"
+set "OPTS=%OPTS% -Dpulsar.log.dir=%PULSAR_LOG_DIR%"
+set "OPTS=%OPTS% -Dpulsar.log.level=%PULSAR_LOG_LEVEL%"
+set "OPTS=%OPTS% -Dpulsar.log.root.level=%PULSAR_LOG_ROOT_LEVEL%"
+set "OPTS=%OPTS% -Dpulsar.routing.appender.default=%PULSAR_ROUTING_APPENDER_DEFAULT%"
+
+:error
+exit /b 1

Review Comment:
   it's a leftover, we can drop it



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] BewareMyPower commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r1061199501


##########
bin/pulsar-admin-common.cmd:
##########
@@ -0,0 +1,82 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM   http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+
+@echo off
+
+if "%JAVA_HOME%" == "" (
+  for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
+) else (
+  set "JAVACMD=%JAVA_HOME%\bin\java.exe"
+)
+
+if not exist "%JAVACMD%" (
+  echo The JAVA_HOME environment variable is not defined correctly, so Pulsar CLI cannot be started. >&2
+  echo JAVA_HOME is set to "%JAVA_HOME%", but "%JAVACMD%" does not exist. >&2
+  goto error
+)
+
+
+for %%i in ("%~dp0.") do SET "SCRIPT_PATH=%%~fi"
+set "PULSAR_HOME_DIR=%SCRIPT_PATH%\..\"
+for %%i in ("%PULSAR_HOME_DIR%.") do SET "PULSAR_HOME=%%~fi"
+set "PULSAR_CLASSPATH=%PULSAR_CLASSPATH%;%PULSAR_HOME%\lib\*"
+
+
+if "%PULSAR_CLIENT_CONF%" == "" set "PULSAR_CLIENT_CONF=%PULSAR_HOME%\conf\client.conf"
+if "%PULSAR_LOG_CONF%" == "" set "PULSAR_LOG_CONF=%PULSAR_HOME%\conf\log4j2.yaml"
+
+set "PULSAR_LOG_CONF_DIR1=%PULSAR_LOG_CONF%\..\"
+for %%i in ("%PULSAR_LOG_CONF_DIR1%.") do SET "PULSAR_LOG_CONF_DIR=%%~fi"
+for %%a in ("%PULSAR_LOG_CONF%") do SET "PULSAR_LOG_CONF_BASENAME=%%~nxa"
+
+set "PULSAR_CLASSPATH=%PULSAR_CLASSPATH%;%PULSAR_LOG_CONF_DIR%"
+
+set "OPTS=%OPTS% -Dlog4j.configurationFile="%PULSAR_LOG_CONF_BASENAME%""
+set "OPTS=%OPTS% -Djava.net.preferIPv4Stack=true"
+
+set "isjava8=false"
+FOR /F "tokens=*" %%g IN ('"java -version 2>&1"') do (
+  echo %%g|find "version" >nul
+  if errorlevel 0 (
+    echo %%g|find "1.8" >nul
+    if errorlevel 0 (
+     set "isjava8=true"
+    )
+  )
+)
+
+if "%isjava8%" == "false" set "OPTS=%OPTS% --add-opens java.base/sun.net=ALL-UNNAMED"
+
+set "OPTS=-cp "%PULSAR_CLASSPATH%" %OPTS%"
+set "OPTS=%OPTS% %PULSAR_EXTRA_OPTS%"
+
+if "%PULSAR_LOG_DIR%" == "" set "PULSAR_LOG_DIR=%PULSAR_HOME%\logs"
+if "%PULSAR_LOG_APPENDER%" == "" set "PULSAR_LOG_APPENDER=RoutingAppender"
+if "%PULSAR_LOG_LEVEL%" == "" set "PULSAR_LOG_LEVEL=info"
+if "%PULSAR_LOG_ROOT_LEVEL%" == "" set "PULSAR_LOG_ROOT_LEVEL=%PULSAR_LOG_LEVEL%"
+if "%PULSAR_ROUTING_APPENDER_DEFAULT%" == "" set "PULSAR_ROUTING_APPENDER_DEFAULT=Console"
+
+set "OPTS=%OPTS% -Dpulsar.log.appender=%PULSAR_LOG_APPENDER%"
+set "OPTS=%OPTS% -Dpulsar.log.dir=%PULSAR_LOG_DIR%"
+set "OPTS=%OPTS% -Dpulsar.log.level=%PULSAR_LOG_LEVEL%"
+set "OPTS=%OPTS% -Dpulsar.log.root.level=%PULSAR_LOG_ROOT_LEVEL%"
+set "OPTS=%OPTS% -Dpulsar.routing.appender.default=%PULSAR_ROUTING_APPENDER_DEFAULT%"
+
+:error
+exit /b 1

Review Comment:
   Why did you add this line? I cannot use `pulsar-shell` on Windows unless I removed this line.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] eolivelli commented on pull request #17243: [improve][cli] Pulsar shell, Pulsar admin and Pulsar client: support for Windows

Posted by GitBox <gi...@apache.org>.
eolivelli commented on PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#issuecomment-1225617267

   @eolivelli license check is failing


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957377896


##########
distribution/shell/src/assemble/shell.xml:
##########
@@ -24,6 +24,7 @@
   <id>shell</id>
   <formats>
     <format>tar.gz</format>
+    <format>zip</format>

Review Comment:
   Why do you add zip output?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #17243: [improve][cli] Pulsar shell: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r953472453


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/shell/PulsarShell.java:
##########
@@ -216,7 +216,6 @@ public void reload(Properties properties) throws Exception {
     }
 
     public void run() throws Exception {
-        System.setProperty("org.jline.terminal.dumb", "true");

Review Comment:
   Actually nothing. I had firstly misunderstood the meaning of this property. It's not useful 



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] eolivelli commented on a diff in pull request #17243: [improve][cli] Pulsar shell: support for Windows

Posted by GitBox <gi...@apache.org>.
eolivelli commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r953468968


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/shell/PulsarShell.java:
##########
@@ -216,7 +216,6 @@ public void reload(Properties properties) throws Exception {
     }
 
     public void run() throws Exception {
-        System.setProperty("org.jline.terminal.dumb", "true");

Review Comment:
   what's the impact on Linux and Mac ?



##########
pom.xml:
##########
@@ -211,7 +211,7 @@ flexible messaging model and an intuitive client API.</description>
     <jakarta.activation.version>1.2.2</jakarta.activation.version>
     <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
     <jakarta.validation.version>2.0.2</jakarta.validation.version>
-    <jna.version>4.2.0</jna.version>
+    <jna.version>5.12.1</jna.version>

Review Comment:
   I would move this change to a separate PR



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi merged pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi merged PR #17243:
URL: https://github.com/apache/pulsar/pull/17243


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #17243: [improve][cli] Pulsar shell, Pulsar admin, Pulsar client and Pulsar perf: support for Windows

Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #17243:
URL: https://github.com/apache/pulsar/pull/17243#discussion_r957389526


##########
distribution/shell/src/assemble/shell.xml:
##########
@@ -24,6 +24,7 @@
   <id>shell</id>
   <formats>
     <format>tar.gz</format>
+    <format>zip</format>

Review Comment:
   that's a good point. Pulsar shell currently is 50mb so I guess is not a big deal



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org