Skip to content

Instantly share code, notes, and snippets.

@breskeby
breskeby / myleodailywod.scriptable
Last active May 31, 2022 23:11
MyLeo Daily WOD Script
let widget = await createWidget();
// Check where the script is running
if (config.runsInWidget) {
// Runs inside a widget so add it to the homescreen widget
Script.setWidget(widget);
} else {
// Show the large widget inside the app
widget.presentLarge();
}
println 'from remote'
@breskeby
breskeby / build.gradle
Created August 8, 2019 13:11
non input system properties for test tasks
tasks.withType(Test).configureEach { Test testTask ->
def nonInputs = new InconsequentialSystemProperty()
testTask.jvmArgumentProviders.add(nonInputs)
def nonInputSystemProperty = { String key, value ->
nonInputs.props.put(key, value)
}
testTask.extensions.extraProperties.set("nonInputSystemProperty", nonInputSystemProperty)
@breskeby
breskeby / multiproject-with-deprecations.gradle
Last active February 6, 2019 15:00
Example gradle multiproject with deprecated usage
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.gradle:build-scan-plugin:2.1'
}
}
apply plugin: 'com.gradle.build-scan'
@breskeby
breskeby / multipleTestExecution
Created February 20, 2011 21:16
run the same test multiple times with gradle
class LoadTest extends Test{
private numberOfClients = 2
public LoadTest(){
super()
}
public FileTree getCandidateClassFiles() {
FileTree candidateTimes = super.getCandidateClassFiles()
for(int client = 1; client<numberOfClients;client++){
candidateTimes = candidateTimes + super.getCandidateClassFiles()
@breskeby
breskeby / gist:7858657
Last active August 3, 2018 23:37
dos2unix on some text files with gradle
task convertFiles <<{
fileTree("someFolder").matching{ include "**/*.txt"}.each{ aFile ->
exec{
commandLine 'dos2unix'
args aFile.absolutePath
}
}
}
@breskeby
breskeby / build.gradle
Created February 14, 2018 13:55
multiple failures in composites
apply plugin: 'java'
group "org.sample"
version "1.0"
dependencies {
compile "org.sample:included-Sub1:1.0"
compile "org.sample:included-Sub2:1.0"
}
gradle.buildFinished {
@breskeby
breskeby / build.gradle
Created February 10, 2018 14:34
accessing java targetCompatibility
import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.provider.Property;
import java.util.concurrent.Callable;
public class AcmePlugin implements Plugin<Project> {
@breskeby
breskeby / gist:b6b6d4cdd03cf5c79e222a3e7d8ea5b9
Last active April 20, 2017 10:03
slow gradle distribution debugging
please provide output of
- Running “time curl -svo /dev/null https://downloads.gradle.org/distributions/gradle-3.5-all.zip”
- Running “time curl -svo /dev/null https://d2ueg53gsd9z3m.cloudfront.net/distributions/gradle-3.5-all.zip”
- Running “mtr --report https://downloads.gradle.org/distributions/”
- http://gradle.org/cdn-cgi/trace
@breskeby
breskeby / get-help.groovy
Last active November 9, 2016 16:30
buildscan recipe gist for creating topic on gradle forum
buildScan.buildFinished { result ->
if(result.failure){
if(result.failure instanceof org.gradle.internal.exceptions.LocationAwareException){
if(result.failure.reportableCauses.size() >= 1) {
def reportMessage = result.failure.reportableCauses[0].message
buildScan.link("Create Gradle Forum Topic", createForumLink(reportMessage))
}
}
}
}