Skip to content

Instantly share code, notes, and snippets.

@Lien
Lien / proguard_build.gradle
Created October 25, 2013 06:52
Simple gradle proguard task for use with the java-plugin.
ant.taskdef(resource: 'proguard/ant/task.properties',
classpath: "/usr/local/java/proguard/lib/proguard.jar")
task proguard << {
description = "Process classes and JARs with ProGuard"
group = "ProGuard"
def proguardDir = new File(getProguardDir(project))
proguardDir.mkdir()
@Lien
Lien / signJar_build.gradle
Created October 25, 2013 06:57
Simple gradle sign jar task using ant task.
task signJar << {
description = "Signs JAR"
def config = loadProperties(project.ext.keystorePropsFilename)
ant.signjar(jar: project.ext.jarToSign,
alias: config.key.alias,
keystore: config.key.store,
storepass: config.key.'store.password',
keypass: config.key.'alias.password')
}
@Lien
Lien / fatJar_build.gradle
Created October 25, 2013 07:03
Simple gradle task to create a fatJar that includes all dependencies except for specific jars. Snippet below doesn't include android.jar file.
task fatJar(type: Jar, dependsOn: 'compileJava') {
from {
sourceSets.main.output.classesDir
}
// Add all dependencies except for android.jar to the fat jar
from {
configurations.compile.findAll {
it.getName() != 'android.jar'
}.collect {
@Lien
Lien / log4j.xml
Created October 30, 2013 22:39
Sample log4j.xml file to turn on logging for HTTPBuilder and Apache HttpClient. Place log4j.xml file in your groovy home /conf directory.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c{1} - %m%n" />
</layout>
</appender>