f2prateek/dart

Multi module using DH3, M2 to M1 cycle navigation

Closed this issue · 15 comments

Hi, almost feels like getting DH3 working 👍

except that I got below Unresolved Reference error, but it seems the correct files are already generated and IDE doesn't complaint about it. Only when running gradle builds.
screen shot 2018-06-01 at 10 09 46

If I add

sourceSets {
        main.java.srcDirs += 'build/generated/source/navigator/debug'
    }

it compiles and cycle navigation works fine. M1->M2, M2->M1, but this is not something I want to add to gradle.

I think my activity is in Kotlin, thus it can't be resolved. Change it to java class works fine.

Can you try version 3.0.1-SNAPSHOT please ?
I am trying to make the plugin compatible with Java and Kotlin. We were not using the abstract model of the gradle android plugin, but only tweeking the java gradle tasks directly.

Thanks for reporting this issue and following up !

Hi, I don't see 3.0.1-SNAPSHOT in maven central

Snapshots are in a different repo:

repositories {
    ...
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

Hi, @stephanenicolas it's working now with the snapshot! No need to manually add source set.

Good news @cooperkong , I am gonna merge the PR then. Are you sure you also removed the modification of the source set ?

If you want you can have a look at https://github.com/f2prateek/dart/blob/master/henson-plugin/src/functTest/groovy/dart/henson/plugin/HensonPluginFunctionalTest.groovy#L133

I would like to add a Kotlin functional test. Basically, I need some help to write this 2 classes in Kotlin:

package module1;
        
        import android.app.Activity;
        import android.os.Bundle;
        import android.content.Intent;
        
        class FooActivity extends Activity {
          
          @Override
          public void onCreate(Bundle bundle) {
            super.onCreate(bundle);
            FooActivityNavigationModel foo = new FooActivityNavigationModel();
            Intent intent = HensonNavigator.gotoFooActivity(this)
              .s("s")
              .build();
          }
        }

and

package module1;
        
        import dart.BindExtra;
        import dart.DartModel;
        
        @DartModel()
        class FooActivityNavigationModel {
          @BindExtra String s;
        }

I guess I can deal with the gradle setup. Thx already for your follow up!

Yeah sure.

package module1
        
import android.app.Activity
import android.os.Bundle
import android.content.Intent
class FooActivity : Activity() {

    override fun onCreate(bundle :Bundle?) {
        super.onCreate(bundle)
        val foo = FooActivityNavigationModel()
        val intent = HensonNavigator.gotoFooActivity(this)
                .s("s")
                .build()
    }
}
package module1
import dart.BindExtra
import dart.DartModel
@DartModel
class FooActivityNavigationModel {
    @BindExtra
    lateinit var s : String
}

@cooperkong, I am close but it looks like Kotlin can't find the Henson navigator. I had to run the task manually to generate the navigator and it looks like I must also add the folder where the generated source is...
Can you post the build file you use please ? (For the module that uses Henson generator).

I could get it solved @cooperkong , I was using a bad version of the henson plugin... We are gonna release the fix soon, with kotlin support. Thx a lot for your help.

@stephanenicolas Nice, can't wait!

PR merged #218 !
Releasing in 1 hour.