Skip to content

Instantly share code, notes, and snippets.

View hansd's full-sized avatar

Hans Dockter hansd

View GitHub Profile
@hansd
hansd / build.gradle
Created November 30, 2011 14:48
Autowiring with tasks
task analyzeTestJar(type: AnalyzeJar) {
jar = testJar
}
task copy(type:Copy) {
from testJar
into 'build/myJars'
}
class AnalyzeJar extends DefaultTask {
@hansd
hansd / report output
Created September 16, 2014 15:46
New Component Model Report
comp$ gradle components
:components
------------------------------------------------------------
Root project
------------------------------------------------------------
JVM library 'myLib'
-------------------
@hansd
hansd / build script new model
Created September 16, 2014 15:51
Build script that uses the new configuration/component model
apply plugin: 'jvm-component'
apply plugin: 'java-lang'
jvm {
libraries {
myLib
}
}
@hansd
hansd / gradle-build-spec
Created September 17, 2014 00:18
Build Spec
apply plugin: 'android'
android {
compileSdkVersion 15
buildToolsVersion "17.0"
flavorGroups "abi", "version"
productFlavors {
free {
package org.gradle.sample;
import org.gradle.tooling.BuildLauncher;
import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;
import java.io.File;
public class Main {
public static void main(String[] args) {
@hansd
hansd / codeQuality.gradle
Last active August 11, 2017 18:58
Kotlin plugin vs Groovy script
apply plugin: 'checkstyle'
apply plugin: 'codenarc'
plugins.withType(JavaBasePlugin) {
// Apply to all projects depending on :core
configurations.compile.dependencies.withType(ProjectDependency).matching { it.dependencyProject == project(":core") }.all {
project.apply from: "$rootDir/gradle/taskProperties.gradle"
}
}