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

Migrating a project from 2013 #681

Closed ollyde closed 1 year ago

ollyde commented 2 years ago

I got the Apple warning yesterday, if we don't update our apps they will be taken off the store. We got an old game that still makes a bit of money and we'd like to keep it going.

It was built with RoboVM back in 2013, but was updated in 2017. We're not sure how to upgrade the project; the build script is like so:

apply plugin: "java"

sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]

project.ext.mainClassName = "com.polygonattraction.universepandemicee.desktop.DesktopLauncher"
project.ext.assetsDir = FileCollection("../android/assets");

task run(dependsOn: classes, type: JavaExec) {
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.assetsDir
    ignoreExitValue = true
}

task dist(type: Jar) {
    from files(sourceSets.main.output.classesDir)
    from files(sourceSets.main.output.resourcesDir)
    from {configurations.compile.collect {zipTree(it)}}
    from files(project.assetsDir);

    manifest {
        attributes 'Main-Class': project.mainClassName
    }
}

dist.dependsOn classes

eclipse {
    project {
        name = appName + "-desktop"
        linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
    }
}

task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
  doLast {
    def classpath = new XmlParser().parse(file(".classpath"))
    new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
    def writer = new FileWriter(file(".classpath"))
    def printer = new XmlNodePrinter(new PrintWriter(writer))
    printer.setPreserveWhitespace(true)
    printer.print(classpath)
  }
}

But the modern way is very different?

https://github.com/MobiVM/robovm/tree/master/plugins/gradle

Any ideas here?

davidgiga1993 commented 2 years ago

Not entirely sure what you're asking here. Since you need to use the latest ios sdk you need to use the current robovm version as well. Therefore you need to adjust your gradle file as described in the link you already found.

Or are you having any specific issues with this?

ollyde commented 2 years ago

@davidgiga1993 I guess the easy way would be to make a new project and just copy/paste the code across :-)

bartekpacia commented 1 year ago

This project of mine is building fine on iOS (and is migrated to Gradle Kotlin DSL). Feel free to take a look and copy from it.