These are chat archives for Arasthel/SwissKnife

22nd
Apr 2015
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:36 UTC
@Arasthel I am keeping in mind that idea from first contribution, dsl methods can be separated into another lib/module, but I think it is not right time now for this. Lets wait while lib will be more widely used, then we can do this.
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:36 UTC
Ok
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:38 UTC
@Arasthel also I have a question about logging. How do you think I must transform method, that is calling super.someMethod as first expression?
before super call or after
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:40 UTC
I think I need a little more context to answer that
What would the logging transform exactly do?
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:40 UTC
@Profile
public void someMethod() {
// I can inject here
super.someMethod();
// or can start injection here
}
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:42 UTC
If you are also measuring time, maybe it should go before the super. call
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:43 UTC
ok, I will inject it before this super call :) thanks, will continue work
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:49 UTC
@Profile
public void someMethod(Long someLong, String someString, Person person) {
       super.someMethod()
       // another calls here
}
will be transformed to:
void someMethod(Long someLong, String someString, Person person) {
   def logMessage = "someMethod called: someLong=$someLong, someString=$someString, person=$person";
   Log.i("TAG", logMessage);
   long startTime = System.currentTimeMillis();
   super.someMethod();
   // another calls here
   long time = System.currentTimeMillis() - startTime;
   Log.i("TAG", "Method someMethod executed in: $time ms";
}
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:50 UTC
Nice :+1:
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:54 UTC
@Arasthel also wanted to ask, I just found that AST transforms are also packed into app, how we can exclude them after?
After compilation they are not needed anymore
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:55 UTC
You mean that they are included as part of the groovy sources?
You should use proguard to exclude them
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 08:55 UTC
Ok, then. I thought about it.
Maciej Górski
@mg6maciej
Apr 22 2015 08:56 UTC
I think better option is to use provided for dependency.
But then you need two deps. Some portions of SK still need to be in APK.
Most JSR 269 based libs do it like that.
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 08:58 UTC
I see... AST could be provided dependencies on a different module
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 09:24 UTC
@mg6maciej From my AST experience I never wrote tests like you do, only thing I made was alsways look at WHAT will actually groovy generate, because test can pass as well, but the bytecode will be full of redunant calls, from first view I cant understand will your ast-test-framework cover this problem?
Maciej Górski
@mg6maciej
Apr 22 2015 09:26 UTC
What I did there (and same with Lombok, which I based this idea on) is I perform transformation in tests, then compare transformed code with what you would normally write if you were into writing boilerplate code.
So it's comparing bytecode, instruction after instruction (on a high level of course).
There are of course things added normally by Groovy there, e.g. metaClass and stuff and it's also compared, but should be same in both cases.
I'll work next month on putting this AST tranformations test helping code as a jar on jcenter.
Eugene Kamenev
@eugene-kamenev
Apr 22 2015 09:32 UTC
@mg6maciej Thanks, keep me posted.
Andrew Reitz
@pieces029
Apr 22 2015 14:52 UTC
@Arasthel Looks like I can't setup CI on your repo. I'll set it up on mine and go from there. Do you want it to auto deploy snapshots? Also are you cool with snap? Ratpack uses it and it doesn't require me to check in a file that will have 1000 commits trying to get it working like travis or circle.
Also auto deploying of java/grovydocs/asciidocs is a thing we can do
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 14:53 UTC
Ok
Having snapshots can be handy
I have never used Snap, so we can give it a try, though @mg6maciej said he prefered Travis
Also, auto-deploying of asciidocs would be great, thanks
Maciej Górski
@mg6maciej
Apr 22 2015 14:55 UTC
@pieces029 How about Travis CI? It's simple to setup.
I can do a PR with that.
Andrew Reitz
@pieces029
Apr 22 2015 14:56 UTC
I personally hate travis
I feel like it never works and you end up with crazy git logs of the 100 different things you need to get it to eventually work.
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 15:01 UTC
I'm trying to find some good comparatives, but I didn't find any
Andrew Reitz
@pieces029
Apr 22 2015 15:02 UTC
/home/areitz/Projects/SwissKnife/SwissKnife/src/main/groovy/com/arasthel/swissknife/dsl/components/GAsyncTask.groovy: 72: [Static type checking] - No such property: before for class: com.arasthel.swissknife.dsl.components.GAsyncTask <T>
 @ line 72, column 9.
           this.before = closure
           ^
1 error
I'm seeing that on master, tried java 1.7 and 1.8 any ideas?
Jorge Martin Espinosa
@Arasthel
Apr 22 2015 15:04 UTC
Arasthel/SwissKnife@f3f7441
@eugene-kamenev just deleted before closure