Last active
May 24, 2016 15:57
-
-
Save ZakTaccardi/af96c5bbed048b9465c5fa3db19cfe0b to your computer and use it in GitHub Desktop.
This file contains 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
//build.gradle for "server" module | |
buildscript { | |
repositories { | |
maven { | |
url "https://plugins.gradle.org/m2/" | |
} | |
} | |
} | |
plugins { | |
id 'java' | |
id 'idea' | |
id 'jvm-component' | |
id 'java-lang' | |
id "de.fuerstenau.buildconfig" version "1.1.2" | |
id 'net.ltgt.apt' version "0.6" | |
id 'me.tatarka.retrolambda' version "3.2.5" | |
} | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
retrolambda { | |
oldJdk "/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home" | |
} | |
dependencies { | |
compile fileTree(include: ['*.jar'], dir: 'libs') | |
//testing | |
// RxJava: | |
compile "io.reactivex:rxjava:$rxJavaVersion" | |
compile "com.google.dagger:dagger:$daggerVersion" | |
compile "com.squareup.retrofit2:retrofit:$retrofitVersion" | |
compile "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion" | |
compile "com.squareup.okhttp3:logging-interceptor:$okHttpVersion" | |
compile "com.google.auto.value:auto-value:$autoValueVersion" | |
compile "com.squareup.moshi:moshi:$moshiVersion" | |
compile "com.squareup.retrofit2:converter-moshi:$retrofitVersion" | |
apt "com.google.dagger:dagger-compiler:$daggerVersion" | |
apt "com.squareup.auto.value:auto-value-redacted:$redactedVersion" | |
apt "com.ryanharter.auto.value:auto-value-moshi:$autoValueExtensionMoshiVersion" | |
apt "org.jetbrains:annotations:$jetbrainsAnnotationVersion" | |
compileOnly "org.jetbrains:annotations:$jetbrainsAnnotationVersion" | |
//Testing | |
testCompile "org.hamcrest:hamcrest-junit:$hamcrestJunitVersion" | |
testCompile "junit:junit:$junitVersion" | |
testCompile "org.mockito:mockito-core:$mockitoVersion" | |
} | |
def flavors = ['fake', 'staging', 'prod'] | |
flavors.each { String flavor -> | |
SourceSet sourceSet = sourceSets.create(flavor) | |
sourceSet.java { | |
srcDirs 'src/main/java', "src/$flavor/java" | |
} | |
sourceSet.resources { | |
srcDirs 'src/main/resources', "src/$flavor/resources" | |
} | |
Task jarTask = tasks.create(name: "${flavor}Jar", type: Jar) { | |
from sourceSet.output | |
classifier flavor | |
} | |
Configuration config = configurations.create(flavor) | |
config.extendsFrom(configurations.runtime) | |
configurations.getByName("${config.name}CompileOnly").extendsFrom(configurations.compileOnly) | |
configurations.getByName("${config.name}Apt").extendsFrom(configurations.apt) | |
configurations.getByName("${config.name}Compile").extendsFrom(configurations.compile) | |
artifacts.add(flavor, jarTask) | |
assemble.dependsOn jarTask | |
} | |
buildConfig { | |
version = '1.0-alpha' | |
buildConfigField 'String', 'ENVIRONMENT_URL', '?' | |
//noinspection all | |
sourceSets { | |
//noinspection all | |
main { | |
buildConfigField 'String', 'ENVIRONMENT_URL', '?main' | |
} | |
fake { | |
buildConfigField 'String', 'ENVIRONMENT_URL', '?fake' | |
} | |
staging { | |
buildConfigField 'String', 'ENVIRONMENT_URL', '?staging' | |
} | |
prod { | |
buildConfigField 'String', 'ENVIRONMENT_URL', '?prod' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment