This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin:'java' | |
repositories { | |
jcenter() | |
} | |
configurations { | |
manu // une conf qui servira à récupérer la dep sans polluer le classpath de compilation | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:connectedAndroidTest | |
Tests on Galaxy_Nexus(AVD) - 4.2 failed: Unable to find instrumentation info for: ComponentInfo{grooid.app.test/android.support.test.runner.AndroidJUnitRunner} | |
com.android.builder.testing.ConnectedDevice > hasTests[Galaxy_Nexus(AVD) - 4.2] FAILED | |
No tests found. | |
:connectedAndroidTest FAILED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CLICategory { | |
static Iterator getLines(String f) { new File(f).iterator() } | |
static int getLength(String s) { s.length() } | |
static def max(Iterator c,String property) { c.max { it."$property" } } | |
} | |
def propertyMissing(String p) { "$p" } | |
use (CLICategory) { | |
'quotes.txt'.lines.max length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run complete. Total time: 00:34:14 | |
Benchmark Mode Samples Score Error Units | |
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_cs avgt 30 1.961 ± 0.055 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.baseline_java_30 avgt 30 2.004 ± 0.084 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.baseline_java_boxing_30 avgt 30 5.504 ± 0.036 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.groovy_primitive_30 avgt 30 5.733 ± 0.024 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.groovy_indy_30 avgt 30 5.903 ± 0.033 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.golo_30 avgt 30 6.545 ± 0.060 ms/op | |
o.g.m.f.FibonacciMicroBenchmark.nashorn_30 avgt 30 7.812 ± 0.061 ms/op |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################ | |
# Dockerfile to run Groovy containers | |
# Based on Java 8 image | |
################################################ | |
FROM java:8u40-jdk | |
MAINTAINER Cédric Champeau | |
# Install GVM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testInlineMacroCombinationWithConstraints() { | |
use(ASTMatcher) { | |
def ast1 = macro { a + b } | |
def ast2 = macro { b + b } | |
def ast3 = macro { b + c } | |
def ast4 = macro { b - b } | |
def pattern = macro { | |
$v { macro { a }.withConstraints { placeholder a } } + b | |
}.withConstraints { | |
anyToken() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testRelaxedBinaryExpressionWithConstrainedToken() { | |
use(ASTMatcher) { | |
def ast1 = macro { a + b } | |
def ast2 = macro { a - b } | |
def ast3 = macro { a * b } | |
def ast4 = macro { a + c } | |
def pattern = macro { | |
a + b | |
}.withConstraints { | |
token { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Configurable<ConfigObject> { | |
ConfigObject configObject | |
void configure(Closure<Void> configSpec) { | |
configSpec.resolveStrategy = Closure.DELEGATE_FIRST | |
configSpec.delegate = configObject | |
configSpec() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.transform.CompileStatic | |
public <T> T configure(@DelegatesTo.Target Class<T> clazz, @DelegatesTo(genericTypeIndex = 0) Closure<Void> conf) { | |
def result = clazz.newInstance() | |
result.with(conf) | |
result | |
} | |
class Person { | |
String name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.util.ProxyGenerator | |
import groovy.transform.CompileStatic | |
// just for tests, can be replaed by any mocking framework | |
class Mock { | |
static <T> T f(Class<T> clazz, Closure cl) { | |
ProxyGenerator.INSTANCE.instantiateAggregateFromBaseClass(cl, clazz) | |
} | |
} |