MobiVM / robovm

Ahead of time compiler for JVM bytecode targetting iOS, Mac OSX and Linux
https://mobivm.github.io
966 stars 133 forks source link

* gradle plugin: arguments support for launch* tasks #789

Open dkimitsa opened 6 months ago

dkimitsa commented 6 months ago

These changes allows to pass arguments to application, when launching it on device/simulator similar to arguments field in Idea run/debug configuration. Beside debug/specific cases this is also required to enable debug mode of Crashlytics: https://firebase.google.com/docs/crashlytics/test-implementation?platform=ios

Custom commands are supported since Gradle v5. Usage as simple as: ./gradlew launchIPhoneSimulator --info --args "'hello world'"

String passed in --args is then tokenized into individual arguments, e.g. --args="one two" will produce two arguments in args array ["one", "two"], if spaces to be considered as part of argument, quotation to be used.

Gradle also propagate option description to help command:

./gradlew help --task launchIPhoneSimulator

> Task :help
Detailed task information for launchIPhoneSimulator

Path
     :launchIPhoneSimulator

Type
     IPhoneSimulatorTask (org.robovm.gradle.tasks.IPhoneSimulatorTask)

Options
     --args     Command line arguments passed to app.

Description
     Runs your iOS app in the iPhone simulator

Group
     MobiVM