robovm / robovm-gradle-plugin

RoboVM Gradle plugin
45 stars 24 forks source link

Dynamic robovm.properties ? #61

Open denisk20 opened 8 years ago

denisk20 commented 8 years ago

I'm interested in being able to set the values of robovm.properties dynamically. Specifically, I want app.build to be set from gradle config. However, I can't make it work. So far I have tried:

  1. in build.gradle: project.ext."app.build" = 333
  2. in command line: ./gradlew createIPA -Papp.build=444

I have skimmed through the sources of the plugin and it looks like robovm.properties is not handled by the plugin, but by robovm itself.

I'm doing all this in a libGDX project.

Is there a way to set values of robovm.properties dynamically? I can of course generate the whole file on the fly, but I'm not sure if this is an overkill since I only need to set app.build.

denisk20 commented 8 years ago

I have ended up generating robovm.properties on the fly, in ios/build.gradle (spacing is important):

    ext {
        appVersion = '1.0'
        buildNumber = getBuildNumber()
       appName = 'My App'
    }

    task generateRobovmProperties << {
        def file = new File(project.projectDir.path + '/robovm.properties');

        String text ="""app.version=$appVersion
app.id=com.myapp
app.mainclass=com.myapp.ios.IOSLauncher
app.executable=IOSLauncher
app.name=$appName
app.build=$buildNumber"""
        file.write(text)
    }

I then run

./gradlew ios:generateRobovmProperties

davidgiga1993 commented 4 years ago

This is a very old task, will there be someone working on this or should I also go with generating the file on the fly? It would be nice if properties set by the JVM would override the one from the file. Then we could just define it using gradle