Add gradle config

This commit is contained in:
Jannis Mattheis
2018-11-02 13:28:31 +01:00
parent 8b74c27bf3
commit 2a3e6d2056
4 changed files with 143 additions and 0 deletions

55
app/build.gradle Normal file
View File

@@ -0,0 +1,55 @@
plugins {
id "com.diffplug.gradle.spotless" version "3.15.0"
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.gotify"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
lintOptions {
disable 'GoogleAppIndexingWarning'
}
}
dependencies {
implementation project(':client')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.hypertrack:hyperlog:0.0.10'
implementation 'com.squareup.picasso:picasso:2.71828'
}
spotless {
java {
target '**/*.java'
googleJavaFormat().aosp()
}
}

71
build.gradle Normal file
View File

@@ -0,0 +1,71 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'org.hidetake.swagger.generator' version '2.14.0'
}
ext {
gotifyVersion = '1.1.7'
specLocation = "$buildDir/gotify.spec.json"
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
def download( String url, String filename ) {
new URL( url ).openConnection().with { conn ->
new File( filename ).withOutputStream { out ->
conn.inputStream.with { inp ->
out << inp
inp.close()
}
}
}
}
task downloadSpec {
inputs.property 'version', gotifyVersion
doFirst {
buildDir.mkdirs()
download("https://raw.githubusercontent.com/gotify/server/v${gotifyVersion}/docs/spec.json", specLocation)
}
}
swaggerSources {
gotify {
inputFile = specLocation as File
code {
configFile = "$projectDir/swagger.config.json" as File
language = 'java'
outputDir = "$projectDir/client" as File
}
}
}
dependencies {
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.3.1'
}
generateSwaggerCode.dependsOn downloadSpec

15
gradle.properties Normal file
View File

@@ -0,0 +1,15 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

2
settings.gradle Normal file
View File

@@ -0,0 +1,2 @@
include ':app'
include ':client'