nimblehq / android-templates

Our optimized Android templates used in our projects
https://nimblehq.co/
MIT License
98 stars 23 forks source link

Cant create new project cause of ERROR: Invalid argument name: package-name #583

Open fjr619 opened 4 months ago

fjr619 commented 4 months ago

Issue

Cant create new project cause of ERROR: Invalid argument name: package-name

kscript -version Version : 4.2.3 Build : 2023-07-22T13:06:02.327407526Z Kotlin : 1.9.24-release-822 Java : JRE 17.0.11+0

Expected

Steps to reproduce

luongvo commented 4 months ago

@fjr619 Could you please upload your full command log?

fjr619 commented 4 months ago
 kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project"

=> ? Running new project script version 3.29.0...

? ERROR: Invalid argument name: package-name
Run kscript new_project.kts to create a new project with the following arguments:
    package-name=   New package name (i.e., com.example.package)
    app-name=       New app name (i.e., MyApp, "My App", "my-app")
    template=       Template (i.e. compose) (optional, default: compose)
    force=          Force project creation even if the script fails (default: false)
    destination=    Set the output location where the project should be generated (i.e., /Users/johndoe/documents/projectfolder)

Examples:
    kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project"
    template=compose
    kscript scripts/new_project.kts package-name=co.mycomposeproject.example app-name="My Compose
    Project" template=compose force=true
    kscript scripts/new_project.kts package-name=co.mycomposeproject.example app-name="My Compose
    Project" template=compose force=true
    destination=/Users/johndoe/documents/projectfolder

When i debug the function handleArguments, the arg always give me just package-name, instead of package-name=co.mycomposeproject.example, so it will go to else everytime i tried

and when i tried to change DELIMITER_ARGUMENT to : for example.

kscript new_project.kts package-name:co.mycomposeproject.example app-name:"My Compose Project"

it will give me other error :

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at Main_New_project$Companion.main(Main_New_project.kt:6)
        at Main_New_project.main(Main_New_project.kt)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:70)
        at org.jetbrains.kotlin.runner.Main.run(Main.kt:194)
        at org.jetbrains.kotlin.runner.Main.main(Main.kt:204)
Caused by: java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
        at java.base/java.lang.Runtime.exec(Runtime.java:594)
        at java.base/java.lang.Runtime.exec(Runtime.java:453)
        at kscript.scriplet.New_project$NewProject.executeCommand(New_project.kts:362)
        at kscript.scriplet.New_project$NewProject.cleanNewProjectFolder(New_project.kts:238)
        at kscript.scriplet.New_project$NewProject.generate(New_project.kts:103)
        at kscript.scriplet.New_project.<init>(New_project.kts:458)
        ... 14 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
        ... 21 more
[kscript] [ERROR] Execution of scriplet failed:
[kscript] [ERROR] Command     : 'cmd /c  "C:[bs]Program Files[bs]Android[bs]Android Studio[bs]plugins[bs]Kotlin[bs]kotlinc[bs]bin[bs]kotlin.bat"  -classpath "C:[bs]Users[bs]Administrator[bs]AppData[bs]Local[bs]kscript[bs]jar_b64e645dbb74b1cc3afe588085c5ee1f[bs]scriplet.jar;C:[bs]Program Files[bs]Android[bs]Android Studio[bs]plugins[bs]Kotlin[bs]kotlinc[bs]lib[bs]kotlin-script-runtime.jar" Main_New_project "package-name--co.mycomposeproject.example" "app-name--My Compose Project"'
[kscript] [ERROR] Exit Code   : 1
[kscript] [ERROR]