WeTheInternet / xapi

XApi - The Extremely Extensible Cross Platform API.
Other
33 stars 8 forks source link

is this project still working with latest gwt version? #3

Closed doggie1989 closed 9 years ago

doggie1989 commented 9 years ago

@JamesXNelson

Hi Nelson Could please release latest version to maven repo? Thanks a lot Your project is magnificent.

Regards

JamesXNelson commented 9 years ago

Yessir; I will start a release tonight. I've been heavily distracted at work, but will make time to make this work.

doggie1989 commented 9 years ago

@JamesXNelson

Hi Nelson Thank you very much. I will be waiting for you. once I use your project in my project,it will solve a lots of problems which I was keeping finding the solution for 3 years...

Regards

doggie1989 commented 9 years ago

@JamesXNelson

Could you release a 0.5 version to maven repo ?it almost works well now.~

Thank you very much

JamesXNelson commented 9 years ago

Hi.

I actually worked on it this weekend to get Gwt reflection supported properly in 2.7, and got it finished up last night. I will be finishing code cleanup tonight, and then will start the release process.

I promise I will notify you the moment the Jars are uploaded. :-)

JamesXNelson commented 9 years ago

My apologies on the lateness... it is quarterly release season at work, so I'm putting out a lot of fires during the day, and it's pretty draining. :-)

doggie1989 commented 9 years ago

Hi Nelson

Yes,I saw you are hard working in commits. Due to the reason that your project is really a HUGE idea,it is hard to me to start help this project in some days...Sorry for push you.... :-)

Regards

JamesXNelson commented 9 years ago

Ah, no no, it's good! I'm glad you're pushing. It helps me to focus. I'm going to first push my fork of the Gwt SDK, with the reflection support from here, and then I'll follow it up with 0.5, and an announcement. Following that, I want to spend a little time implementing my own site, where I will be using the web component support to build a content site where I can write articles about how to use the framework (and other stuff I am interested in).

If you don't mind, may I ask what your goals are, so I can see about helping you out?

doggie1989 commented 9 years ago

Hi Mate,

My Goal is almost same as your goal,Long time ago I want to do client side Spring Framework. and in Gwt we can reuse almost all server side code(gwt can not do reflection and there are no live reflection projects except yours.) To use your project ,I can solve like this issue https://github.com/ekuefler/gwt-supereventbus/issues/7 And finally all the same api no matter client or server.

Regards.

doggie1989 commented 9 years ago

Hi Nelson

I have seen your post on https://github.com/ekuefler/gwt-supereventbus/issues/7 Really helpful.

Regards

JamesXNelson commented 9 years ago

Ahh, cool. Glad to be of assistance. I really enjoy code generation and optimizing projects at compile time. If you do use spring bean config classes, you should be able to spider that metadata. As much as I've enjoyed building reflection support, I actually don't really use it anywhere... Everywhere I need it I can usually accomplish the same thing in a more efficient way. Well, more code, but less runtime processing. Really, for me, reflection support is all about interop with existing libraries that already use reflection in ways we can't (easily) replace. Feel free to tag me anywhere you are working on codegen. :-)

doggie1989 commented 9 years ago

Hi Nelson

I fully agree with you,but nowadays development cost is much more than machines,I think the target of xapi is to dramatically reduce dev cost(all platforms use same api). Like that issue,if we can automatically scan all the classes and register them,we do not need to remember to write the same code repeatedly, and the App we made is still fast to user,like 0.0001 to 0.001 difference ,still acceptable.

JamesXNelson commented 9 years ago

That is very true. I still love to optimize for performance anyway, but you are right; developer time is the most expensive. :-)

I like things which can scan all the classes and register them via generated code, so that the runtime has the correct information compiled into the most readily accessible form. But, of course, I would prefer to just pay a little runtime latency while prototyping, and only optimize when it is necessary.

doggie1989 commented 9 years ago

Hi Nelson

Yes,Nelson, like GWT reflection, you have defined different weight which is from fly to heavy. Performance is very important,especially on mobile platform(less cpu,less battery),we may prototype first and them optimize it if the performance is no good.

You can see, like gwt-supereventbus,uibinder,we need to define and write a lot of boilerplate code before we use it,and what your project can solve is more and more useless code and maintenance cost....

How to use xapi to scan all the class? Shall I do it one by one?

doggie1989 commented 9 years ago

Hi Nelson

How is going with gwt-reflection?Any difficulties? we can discuss.

Regards

JamesXNelson commented 9 years ago

Yes, actually, a rather massive difficulty; incremental recompiles in superdevmode were busted. I've been working on it every weekend and most weeknights, and am getting closer to a solution; it's a difficult problem, and one I may wind up sacrificing performance to get correct results. I'm worried that part of my problem is that I have inherited some incomplete work from upstream, so I'm not sure if the problems are from me or them... ...Either way, I hope to get it finished this weekend. If I have to, I will reduce the efficiency of incremental compile to make it work. :-(

ltearno commented 9 years ago

Hi James and Doggie,

If you are in a hurry using reflection in GWT, i also developped a module which allows to provide runtime type informations in a GWT application (almost iso with java.reflect).

It is based on the official GWT and only uses the public mechanism aka deferred binding.

The project is part of a bigger one whichh is here : https://github.com/ltearno/hexa.tools

And the main classes to handle reflection in GWT are here : https://github.com/ltearno/hexa.tools/tree/master/hexa.core/src/main/java/fr/lteconsulting/hexa/client/classinfo

Basically you have to declare which classes you want reflection on with the ClazzBundle marker interface.

Then you register those bundle and then you will be able to use reflection like this :

Clazz c = ClassInfo.Clazz( MyReflectedClass.class );

Then you can call those methods on the instance of c :

Clazz<? super T> getSuperclass(); List getAllFields(); Field getAllField( String fieldName ); List getFields(); Field getField( String fieldName ); List getDeclaredFields(); Field getDeclaredField( String fieldName ); List getMethods(); Method getMethod( String methodName ); T NEW();

Then on the Method instances, you can make dynamic calls. And on the Fields, you can get or set.

It uses an heuristic to work with best performance.

Ah also, it works also with JavaScriptObject instances...

It's used a lot of times in the HexaTools library but there is not an explicit sample. I can provide one if you want.

You may be interested to look at those classes which use the reflection mechanism :

I didn't have the intention to release this project today because it lacks documentation, but you might get interested so here i am !

James : maybe we could collaborate on elaborating a complete solution.

Thanks Arnaud Tournier www.lteconsulting.fr/hexacss

Le mer. 22 avr. 2015 à 22:39, James Nelson notifications@github.com a écrit :

Yes, actually, a rather massive difficulty; incremental recompiles in superdevmode were busted. I've been working on it every weekend and most weeknights, and am getting closer to a solution; it's a difficult problem, and one I may wind up sacrificing performance to get correct results. I'm worried that part of my problem is that I have inherited some incomplete work from upstream, so I'm not sure if the problems are from me or them... ...Either way, I hope to get it finished this weekend. If I have to, I will reduce the efficiency of incremental compile to make it work. :-(

— Reply to this email directly or view it on GitHub https://github.com/WeTheInternet/xapi/issues/3#issuecomment-95328175.

doggie1989 commented 9 years ago

Hi @JamesXNelson

Agree with you!!! You could release minimum functional version and leave some small issues and bugs. I almost never use superdevmode in my project... I am using gwtmokito and WebDriver to test my project and always do a full compile...like this.. I am using gradle for my gwt-client. task gwtc (dependsOn: classes, type: JavaExec) {

description = "GWT compile to JavaScript (production mode)"

main = 'com.google.gwt.dev.Compiler'

classpath {
    [
        sourceSets.main.java.srcDirs,
        // Java source
        sourceSets.main.output.classesDir,
        // Generated classes
        sourceSets.main.compileClasspath,
        configurations.compile
    ]}

args = [
    gwtModule,
    '-war',
    gwtWarPath,
    '-logLevel',
    'INFO',
    '-strict',
    '-localWorkers',
    '4',
    '-draftCompile'
]

maxHeapSize = '2048M'

}

JamesXNelson commented 9 years ago

I got it!!

At long last! hahaha, finally...
Full support for magic method injection with the incremental compiler.

It does a little more invalidation and rebuilding than I would like, but it appears to be stable and still runs in under a second. I'm glad I powered through... short circuiting incremental was taking 3-4 seconds to recompile the reflection test app, but now that I've got everything wired up just right, it's back down to ~0.8 seconds for a larger change, and 0.3 seconds for a trivial change!

:dancer: :trophy: :100: :+1: :+1: :+1:

JamesXNelson commented 9 years ago

I'm going to get everything cleaned up and tested out on my web component pilot project, and will be pushing jars to maven central asap! (for real this time, this was the only real blocker left).

Thanks again for encouraging me to get this release finished!

doggie1989 commented 9 years ago

Great Job!!! I will use and test it in my project once it is pushed to maven.

Thank you very much.

JamesXNelson commented 9 years ago

Also, Arnaud, I would be happy to collaborate on any interesting projects!

I had support for plain GWT.create in mind, so the heavy weight solution does not rely on any JJS AST. In other words, it can run off an ext JClassType as accessible to the standard generator type oracle.

I'm not sure what sort of limits you put on metadata in your implementation, but I aimed to give complete control over how much extra data was included by specifying detailed levels of retention which the generator (is supposed to) obey.

I haven't done full testing that everything which is supposed to be elided is elided, but I will get to that when / if it is in demand.

For the record, the implementation I speak of is the "class enhancing method", which essentially fills in a dictionary of reflection members on the class object. This is what allows referential reflection to work.

I do, however, also include lightweight and flyweight implementations. These rely entirely on magic method injection (backed by the same classes generated by the heavyweight enhancer technique). These methods replace all-literal accessors of members with individual Method/Field/Constructor objects (lightweight), or just directly invoke those members using a GwtReflect utility class which, in JVMs, performs standard reflection (flyweight).

I believe that adding a no-magic standard-generator implementation would be valuable and would be glad to work on it... ...once I do an iteration or two on web components, so I can release my site :-)

doggie1989 commented 9 years ago

Hi @JamesXNelson

Great release of version 0.5,But I cannot found it in maven central,did you push it to maven? I want to be the first mice to test latest version of xapi.

JamesXNelson commented 9 years ago

There was a problem with the source jars for the uber modules. Fixing it tonight. Will post here the second it goes live!

It is currently in the sonatype snapshot repo, but I will have the full thing live tonight.

JamesXNelson commented 9 years ago

@doggie1989 It is done!

I have closed the repo and pushed to central. The jars should be there in an hour or two!

I am going to put together some release notes so I can make a proper announcement to the community.

In the meanwhile, please feel free to file any issues with anything you find; there is a lot of work left to be done, but the framework is in a good enough state that I will be using it for production code. :-)

:fireworks: :cake: :tada: :trophy: :+1: :smile:

JamesXNelson commented 9 years ago

If you use the google plugin for eclipse, do let me know, as I have had to tweak it as well to support maven projects using a non-standard groupdId.

I intend to merge a change to master that will detect and adapt, but in the meanwhile, I just use a custom zip with the groupId changed to net.wetheinter.

doggie1989 commented 9 years ago

@JamesXNelson Great News from you!!!

I am not starting test xapi,and our company will be using it in production code. Do you providing any enterprise level support for xapi or any donation port of your project? Our company is willing to pay and get extra support from you for your great project!!!

Regards

JamesXNelson commented 9 years ago

Well, I haven't really considered monetizing support right away, but I would be glad to talk more in email.

James -AT- WeTheInter -DOT- net

doggie1989 commented 9 years ago

@JamesXNelson

when I use Gradle to compile the project, it shows a error about SourceVersion.RELEASE_8 Do you know how to fix that ?

JamesXNelson commented 9 years ago

Hm. Are you using Java 8? The server and shared code will all run java 7, but the client code all runs java 8. If you can open a new issue with a stack trace and any kind of repro instructions I can have a look at it.

doggie1989 commented 9 years ago

@JamesXNelson

Now I am only want to use reflection in GWT side.I both try java7 and java8,let me try more settings,if it still fails.I will open a issue.-)

JamesXNelson commented 9 years ago

Send me an email. We can chat directly to get you up and running.

doggie1989 commented 9 years ago

worked! all test done!