roboscala / sbt-robovm

An sbt plugin for iOS development in Scala
BSD 2-Clause "Simplified" License
108 stars 16 forks source link

[1.7 dev] createStoryboard throws an exception #50

Open Darkyenus opened 9 years ago

Darkyenus commented 9 years ago

Note: This is about a new feature in version1.7 branch, not present in the published versions

With InterfaceBuilder integration, a few commands were added: createStoryboard, createView and createViewController. (Latter two were not feature-tested yet, but exhibit the same behavior as createStoryboard.) createStoryboard, when invoked, creates the storyboard (seemingly) correctly, but then throws an obfuscated NPE:

IBIntegratorProxy: Method newIOSStoryboard(String, File) has thrown an exception
java.lang.NullPointerException
        at com.robovm.ibintegrator.a.s.a(Unknown.java:22356)
        at com.robovm.ibintegrator.a.v.a(Unknown.java:882)
        at com.robovm.ibintegrator.n.a(Unknown.java:269)
        at com.robovm.ibintegrator.a.s.a(Unknown.java:849)
        at com.robovm.ibintegrator.IBIntegrator.newIOSFileFromTemplate(Unknown.java:267)
        at com.robovm.ibintegrator.IBIntegrator.newIOSStoryboard(Unknown.java:237)

The question is: why does it happen? The usage is created to mimic the robovm-idea's usage as closely as possible. Should we even use these (newIOSStoryboard etc.) methods?

Another, related question is: com.robovm.ibintegrator.IBIntegrator has these methods:

setClasspath()
setSourceFolders()
setResourceFolders()
setInfoPlist()

Since they are not part of the public API, their correct usage is hard to guess. When they should be called, on which thread, with which arguments? I think I got them mostly right, but currently, setClasspath and setSourceFolders is called with the same files for argument. It works, but it is probably not 100% correct.

Any help with these questions would be appreciated.

Darkyenus commented 8 years ago

Current understanding:

Source folders and resource folders are watched for changes and trigger Xcode project regeneration.

Open questions:

ntherning commented 8 years ago

Classpath should contain user classes, yes.

User libraries should go into Classpath.

Can you please run against the latest 1.9.0 release of RoboVM and show me the NPE stack trace and I can try to investigate? Or let me know how to reproduce it (I never used sbt :-) ) and I can try to debug it.

Calling setClasspath/... often should be fine. We don't do it very often in Eclipse/IDEA. Only when the project classpath changes. So I cannot say for sure. Shouldn't be a problem in theory.

Darkyenus commented 8 years ago

Thanks! (Updated my previous comment)

With RoboVM 1.9.0 NPE still appears, relevant part of stack trace:

java.lang.NullPointerException
        at com.robovm.ibintegrator.a.s.a(Unknown.java:22356)
        at com.robovm.ibintegrator.a.v.a(Unknown.java:882)
        at com.robovm.ibintegrator.n.a(Unknown.java:269)
        at com.robovm.ibintegrator.a.s.a(Unknown.java:849)
        at com.robovm.ibintegrator.IBIntegrator.newIOSFileFromTemplate(Unknown.java:267)
        at com.robovm.ibintegrator.IBIntegrator.newIOSStoryboard(Unknown.java:237)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
(... a lot of plugin and then sbt frames)

And as before, the file appears and seems to work, although something might be missing, I don't know how it should look.