mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

Java compilation: Filename or extension too long #779

Open david-bouyssie opened 4 years ago

david-bouyssie commented 4 years ago

Steps to Reproduce

Embeddinator-4000.exe -v -gen Java -p Windows -c -t shared -o java

Expected Behavior

Generated Java files should be compiled. A JAR file should be created.

Actual Behavior

Java files are generated but invoking javac fails with the error The filename or extension is too long

Environment

Windows 10 v 2004, Visual Studio 2019 + Xamarin, mono-6.10.0.104

Build Logs

Compiling binding code...
    ValidateAndroidSdkLocation: ``, result=False
    Looking for Android SDK...
    ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True
    ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True
    ValidateAndroidNdkLocation: ``, result=False
    Looking for Android NDK...
    Looking for Android SDK...
    ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True
    ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True
    ValidateJavaSdkLocation: ``, result=False

Unhandled Exception: System.ComponentModel.Win32Exception: The filename or extension is too long
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Embeddinator.Helpers.Invoke(String program, String arguments, Dictionary`2 envVars) in C:\dev\Embeddinator-4000\binder\Utils\Utils.cs:line 147
   at Embeddinator.Driver.CompileJava(IEnumerable`1 files) in C:\dev\Embeddinator-4000\binder\Compilation.cs:line 215
   at Embeddinator.Driver.CompileCode() in C:\dev\Embeddinator-4000\binder\Compilation.cs:line 60
   at Embeddinator.Driver.Run() in C:\dev\Embeddinator-4000\binder\Driver.cs:line 253
   at Embeddinator.CLI.Main(String[] args) in C:\dev\Embeddinator-4000\binder\CLI.cs:line 220
david-bouyssie commented 4 years ago

As suggested in issue #705, javac should be invoked with a file containing all the sources to be compiled.

See: https://stackoverflow.com/questions/6623161/javac-option-to-compile-all-java-files-under-a-given-directory-recursively