NativeScript / android-dts-generator

A tool that generates TypeScript declaration files (.d.ts) from Jars
90 stars 22 forks source link

[Windows] gradlew extractAllJars fails due to invalid symbols in file paths #32

Closed NickIliev closed 5 years ago

NickIliev commented 5 years ago

Windows only issue. Steps to reproduce:

Set a library with testCompileOnly

testCompileOnly  "com.android.support:support-v4:27.0.1"

Execute

$ ./gradlew extractAllJars

Result:

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\repositories\android-dts-generator\dts-generator\build.gradle' line: 62

* What went wrong:
Execution failed for task ':extractAllJars'.
> Illegal char <:> at index 45: jar-files\support-v4.aar (com.android.support:support-v4:27.0.1)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
1 actionable task: 1 executed
vtrifonov commented 5 years ago

seems that the issue is with the folder name in windows as it is not accepting the : symbol.

mayureshjadhav commented 4 years ago

I am still facing this issue. Any updates?

vtrifonov commented 4 years ago

@mayureshjadhav can you give some steps to reproduce, as I cannot reproduce it with the steps above?

alonstar commented 4 years ago

I have the same issue on Windows 10, too. I downloaded the repository and removed one comment, then run extraAllJars.

testCompileOnly "androidx.appcompat:appcompat:1.0.0"

λ gradlew extractAllJars --info --stacktrace Initialized native services in: C:\Users\XXXXXX.gradle\native The client will now receive all logging from the daemon (pid: 36792). The daemon log file: C:\Users\XXXXXX.gradle\daemon\5.3.1\daemon-36792.out.log Starting 2nd build in daemon [uptime: 8 mins 17.059 secs, performance: 96%, non-heap usage: 14% of 268.4 MB] Using 4 worker leases. Starting Build Settings evaluated using settings file 'D:\Projects\android-dts-generator\dts-generator\settings.gradle'. Projects loaded. Root project using build file 'D:\Projects\android-dts-generator\dts-generator\build.gradle'. Included projects: [root project 'dts-generator']

Configure project : Evaluating root project 'dts-generator' using build file 'D:\Projects\android-dts-generator\dts-generator\build.gradle'. All projects evaluated. Selected primary task 'extractAllJars' from project : Tasks to be executed: [task ':extractAllJars'] :extractAllJars (Thread[Execution worker for ':',5,main]) started.

Task :extractAllJars FAILED Task ':extractAllJars' is not up-to-date because: One or more additional actions for task ':extractAllJars' have changed. :extractAllJars (Thread[Execution worker for ':',5,main]) completed. Took 0.184 secs.

FAILURE: Build failed with an exception.

BUILD FAILED in 2s 1 actionable task: 1 executed

alonstar commented 4 years ago

I found error came from this:

def outputDir = java.nio.file.Paths.get(extractedDependenciesDir, nextDependency.toString()).normalize().toString().replace(':', '_')

I moved the replace() into java.nio.file.Paths.get() and it's work.

def outputDir = java.nio.file.Paths.get(extractedDependenciesDir, nextDependency.toString().normalize().toString().replace(':', '_')).toString()'

vallemar commented 2 years ago

@alonstar solution works for me. Why is it not applied?