Comments (22)
Another approach: write a Gradle plugin in buildSrc
which each Kotlin module uses to generate the sources at build time. This means they never have to be checked in and we don't have to worry about them being stale (and writing the Travis CI hooks to prevent staleness).
from rxbinding.
👍 the buildSrc
method. That's essentially how Victor works and we've also got other scripts working internally to do similar.
I wonder if registerJavaGeneratingTask()
will work for Kotlin. I'm not exactly sure how it all fits together.
from rxbinding.
Yeah it should work. Will have to try. I'm not too eager about writing it in a JVM-based language, but maybe I can spin that into an advantage.
from rxbinding.
might look to https://github.com/JetBrains/anko for some inspiration or technique they are generating a lot of kotlin code by crawling through java files.
from rxbinding.
JVM-based is probably going to be the easiest, because pretty much the go-to library for parsing java files is google/eclipse's JavaParser.
I've gotten some decent familiarity working with it recently for an internal gradle plugin recently, and it looks like that's what Anko is using as well.
If no one else is working on it already, I'd be happy to take a crack at it while the iron's hot.
from rxbinding.
Please do! My threshold of pain is high so I don't mind doing it manually for now...
from rxbinding.
hehe, alright. Traveling this week, but I should be able to ramp up on it next weekend
from rxbinding.
Had some time on my flight this morning and have hacked together a basic working implementation for the project in its current state. Not pretty, but it's a start and I can work on improving it from here.
https://github.com/hzsweers/RxBinding/tree/kotlingen
One change I wanted to check with you on is this one. I couldn't think of a way to statically resolve what the parent type's parameter bounds are, so I think it would be better to just be explicit in the Rx*
implementation itself, unless there's a specific reason you wanted it to be an unbounded wildcard. Thoughts?
from rxbinding.
That generic bounds change looks fine. Do you want to submit just it as a PR?
As to the generator, it looks awesome! I would like to eventually get to a place where we can delete the actual *.kt
files in the kotlin modules and just have the plugin generate them on-the-fly during a build. But, as a first step, keeping them checked in and simply using the plugin to update them is wise.
from rxbinding.
Sure, I'll PR that separately.
I'm going to clean up the generator code this weekend, but not sure what the scope of it should be. It currently only supports the conditions that exist in the current binding java code. There are some areas that can be future proofed (java long -> kotlin Long, resolving nested levels of parameterized types, etc), but there's no guarantee that it'll work for all future situations. I'm happy to update it as new cases arise, but not sure if you'd prefer something more robust.
from rxbinding.
We can keep the generated code committed in that case. This will allow auditing the changes it makes. I'd rather get it in right away and iterate on it as things come up than wait to make sure every little thing works.
from rxbinding.
Alright! I'll PR both tomorrow or Monday sometime.
from rxbinding.
I'll just suck in that commit now. I might just fire off a 1.0 tonight...
from rxbinding.
Cool. Might want to get this one in too, as it also has generated bindings for some that weren't implemented before: ZacSweers@d19f7b6
from rxbinding.
Released a v0.1.0, FYI.
from rxbinding.
{@code view}
should become
`view`
from rxbinding.
{@link Foo}
becomes[Foo]
{@link Foo#bar}
becomes[Foo.bar]
{@linkplain Foo baz}
becomes[baz][Foo]
{@linkplain Foo#bar baz}
becomes[baz][Foo.bar]
from rxbinding.
There is one occurrence of {@link View#GONE View.GONE}
which I am removing because it ends up needed to become:
[`View.GONE`][View.GONE]
which is stupid because it could just be
[View.GONE]
but in order to keep things simple I'm changing it to {@code View.GONE}
.
from rxbinding.
Good examples, I wasn't sure how those references carried over in kotlin docs. I've been busier than expected this week, but planning to sit down and do those polishes tomorrow!
from rxbinding.
Cool. I didn't mean to imply there was a rush! I just want to document things that I noticed otherwise I'll never remember to follow-up on them.
from rxbinding.
haha no worries, I understand. Just wanted to give an update from my end as well!
from rxbinding.
ITSHAPPENING.gif
from rxbinding.
Related Issues (20)
- Idea - Coroutine Support HOT 3
- androidx.appcompat.widget.SearchView support HOT 3
- Migrate to GitHub actions HOT 1
- Failed to resolve: com.jakewharton.rxbinding4:rxbinding:4.0.0 HOT 2
- I use RxView By Kotlin ,no find RxView but Java is ok. HOT 2
- How detect long press in Rxview .Touches HOT 1
- View click throttleFirst another way HOT 1
- RecyclerView can't use itemClicks HOT 1
- RxView.clicks needs tow clicks HOT 1
- throttleFirst way to avoid multiple clicks invalid when app first launched HOT 1
- Bug in comment for TextView.editorActions(handled: (Int) -> Boolean = AlwaysTrue)
- Getting java.lang.IllegalStateException: Expected to be called on the main thread but was RxCachedThreadScheduler HOT 1
- How to control BottomNavigationView.onNavigationItemSelected click switch fragment HOT 3
- Kotlin cannot recognize rxview, rxtextview HOT 2
- Version correspondence HOT 1
- RxView.clicks needs tow clicks
- Quest
- Observable textChanges() rxBinding4 HOT 2
- Run cb cmd command....qds
- Exception: No static method checkUiThread HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxbinding.