gradle-native icon indicating copy to clipboard operation
gradle-native copied to clipboard

Gradle does not recognize bat files as executables on Windows preventing using drop-in replacements for gcc/clang

Open andreiled opened this issue 4 years ago • 0 comments

Expected Behavior

Gradle should treat *.bat files as valid executable files on Windows when looking for specified executable in the tool chain path.

Current Behavior

Gradle does not recognize *.bat files as valid executable files on Windows and, consequently, reports that it was not able to find specified custom C++ compiler.

Execution failed for task ':compileDebugCpp'.
> No tool chain is available to build C++ for host operating system 'Windows 10' architecture 'Node:12':
    - Tool chain 'emscripten' (Clang):
        - Could not find C++ compiler 'em++.bat'. Searched in:
            - D:\Soft\emsdk\upstream\emscripten

Looking into the code, I see that the root cause is that Gradle is actually looking for em++.exe instead of em++.bat.

Context

The issue prevents using custom drop-in gcc/clang replacements on Windows such as emscripten. In my specific case, I am not able to configure a build to transpile C++ code to JavaScript.

Steps to Reproduce (for bugs)

I am trying to keep emscripten tool chain configuration as a separate file with an intention to extract it into its own plugin, so the configuration is split between {{build.gradle}} and {{emscripten.gradle}}: emscripten.test.zip The C++ source files don't need to be anything special here: as mentioned above, Gradle is not even able to recognize ec++.bat as an executable.

Your Environment

Windows 10, jdk-13.0.1

I cannot provide build scan since it includes OS user name and machine name which I consider sensitive.

andreiled avatar Jul 14 '20 01:07 andreiled