[ 
https://issues.apache.org/jira/browse/CASSANDRA-20990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adenauer Gabriel updated CASSANDRA-20990:
-----------------------------------------
    Description: 
The build process fails on Windows when running the Ant task that invokes the 
Gradle wrapper inside the {{modules/accord}} directory.
The failure is caused by the {{gradlew}} script being a Unix shell file 
({{{}#!/bin/bash{}}}) rather than a Windows batch file, which triggers the 
{{CreateProcess error=193, %1 is not a valid Win32 application}} exception.

*Environment:*
OS: Windows 11 Pro (Version 10.0.26200 Build 26200)
Java: Java(TM) SE Runtime Environment 18.9 (build 11.0.21+9-LTS-193)
JVM: Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.21+9-LTS-193, mixed 
mode)
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Cassandra branch: trunk (latest, cloned from apache/cassandra)

*Steps to reproduce:*
1) git clone [https://github.com/apache/cassandra.git]
2) {{cd cassandra }}
3) ant build
Observe the failure when the {{build-accord.xml}} script is executed: 
BUILD FAILED
D:\...\cassandra\.build\build-accord.xml:22: Execute failed: 
java.io.IOException:
Cannot run program "D:\...\cassandra\modules\accord\gradlew" (in directory 
"D:\...\cassandra\modules\accord"): CreateProcess error=193, %1 is not a valid 
Win32 application

 

  was:
The build process fails on Windows when running the Ant task that invokes the 
Gradle wrapper inside the {{modules/accord}} directory.
The failure is caused by the {{gradlew}} script being a Unix shell file 
({{{}#!/bin/bash{}}}) rather than a Windows batch file, which triggers the 
{{CreateProcess error=193, %1 is not a valid Win32 application}} exception.

*Environment:*
OS: Windows 11 Pro (Version 10.0.26200 Build 26200)
Java: Java(TM) SE Runtime Environment 18.9 (build 11.0.21+9-LTS-193)
JVM: Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.21+9-LTS-193, mixed 
mode)
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Cassandra branch: trunk (latest, cloned from apache/cassandra)

*Steps to reproduce:*
1) git clone [https://github.com/apache/cassandra.git]
2) {{cd cassandra }}
3) ant build
Observe the failure when the {{build-accord.xml}} script is executed: 
BUILD FAILED
D:\...\cassandra\.build\build-accord.xml:22: Execute failed: 
java.io.IOException:
Cannot run program "D:\...\cassandra\modules\accord\gradlew" (in directory 
"D:\...\cassandra\modules\accord"): CreateProcess error=193, %1 is not a valid 
Win32 application


*Analysis*
 * On Windows, {{gradlew}} requires a corresponding {{gradlew.bat}} file to be 
executed.

 * The Ant script {{.build/build-accord.xml}} currently attempts to execute 
{{modules/accord/gradlew}} directly, which fails because the shell script is 
not compatible with the Windows process model.

 * The error {{CreateProcess error=193}} confirms that the operating system 
tried to execute a non-Windows binary/script.

h3. Expected *Behavior*

The Ant build should execute successfully on Windows by invoking the correct 
Gradle wrapper ({{{}gradlew.bat{}}}) in {{{}modules/accord{}}}.


*Proposed Fix*

Modify {{.build/build-accord.xml}} to conditionally execute {{gradlew.bat}} 
when running on Windows systems.
For example:
{code:java}
<condition property="gradle.exec" value="gradlew.bat" else="gradlew">
  <os family="windows"/>
</condition>
<exec executable="${basedir}/${accord.dir}/${gradle.exec}" 
dir="${basedir}/${accord.dir}" logError="true" failonerror="true" 
failifexecutionfails="true">  {code}
h3. Notes
 * This issue appears specifically on *Windows environments* due to the absence 
of shell support for Unix-style executables.

 * The proposed change ensures cross-platform compatibility without altering 
the Gradle configuration itself.

 * The local fix was validated on Windows 11 Pro using JDK 11 and Ant 1.10.15.

h3. Next Steps

Once this issue is confirmed, I can submit a pull request containing the 
conditional execution patch for {{build-accord.xml}} to restore Windows 
compatibility.
 


> Windows build failure: Ant task cannot execute Gradle wrapper under 
> modules/accord (error=193)
> ----------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-20990
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20990
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Accord, Build
>            Reporter: Adenauer Gabriel
>            Assignee: Adenauer Gabriel
>            Priority: Normal
>         Attachments: error1.png
>
>
> The build process fails on Windows when running the Ant task that invokes the 
> Gradle wrapper inside the {{modules/accord}} directory.
> The failure is caused by the {{gradlew}} script being a Unix shell file 
> ({{{}#!/bin/bash{}}}) rather than a Windows batch file, which triggers the 
> {{CreateProcess error=193, %1 is not a valid Win32 application}} exception.
> *Environment:*
> OS: Windows 11 Pro (Version 10.0.26200 Build 26200)
> Java: Java(TM) SE Runtime Environment 18.9 (build 11.0.21+9-LTS-193)
> JVM: Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.21+9-LTS-193, mixed 
> mode)
> Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
> Cassandra branch: trunk (latest, cloned from apache/cassandra)
> *Steps to reproduce:*
> 1) git clone [https://github.com/apache/cassandra.git]
> 2) {{cd cassandra }}
> 3) ant build
> Observe the failure when the {{build-accord.xml}} script is executed: 
> BUILD FAILED
> D:\...\cassandra\.build\build-accord.xml:22: Execute failed: 
> java.io.IOException:
> Cannot run program "D:\...\cassandra\modules\accord\gradlew" (in directory 
> "D:\...\cassandra\modules\accord"): CreateProcess error=193, %1 is not a 
> valid Win32 application
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to