Skip to content

Instantly share code, notes, and snippets.

View leonschreuder's full-sized avatar

Leon Schreuder leonschreuder

View GitHub Profile
@leonschreuder
leonschreuder / syncr
Created July 14, 2022 14:50
aosp helper script for syncing files built using mm
#!/bin/bash
# little application
main() {
assertCorrectAdb
assertAdbConnected
remountAsRootIfRequired
@leonschreuder
leonschreuder / RunCommandBuilder.groovy
Last active May 7, 2019 14:11
execute command in groovy.
package de.esolutions.gradle.plugin
import java.util.concurrent.TimeUnit
/** Running a command should be a simple "command".execute() in groovy, but reading
* output and making the command time-out at the same time, is somehow buggy and the
* process won't quit if it hangs.
* Thanks: https://stackoverflow.com/a/33265110/3968618
* */
@leonschreuder
leonschreuder / gradle_robolectric_commandline_output_formatting.groovy
Last active August 29, 2015 14:15
Gradle Robolectric commandline output formatting
//Add this to build.gradle
robolectric {
// Output and format the test results for vim-grand
afterTest { descriptor, result ->
//This part prints the class name with short result notation
def resultChar = ''
switch (result.resultType) {
case TestResult.ResultType.SUCCESS:
resultChar = '+'
break
@leonschreuder
leonschreuder / shell_gradle_class_specifier.groovy
Last active August 29, 2015 14:15
Robolectric test specification from the commandline:
// Add test classes on the command line. Examples:
// gradle test -Dclasses=SomeClassTest // runs test/java/com/bla/SomeClassTest.java
// gradle test -Dclasses=*ActivityTest // runs all classes who's name ends in ActivityTest.java
// gradle test || gradle test -DClasses=all // both notations include all classes
def suppliedClasses = System.getProperty('classes', 'all')
if (suppliedClasses == 'all') {
println "target: all"
include '**/*Test.class'
} else {
def targetClass = '**/'+suppliedClasses +'.class'