From 2a3e6d2056c3e89929a5254edea1f04c27ef3575 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Fri, 2 Nov 2018 13:28:31 +0100 Subject: [PATCH] Add gradle config --- app/build.gradle | 55 ++++++++++++++++++++++++++++++++++++ build.gradle | 71 +++++++++++++++++++++++++++++++++++++++++++++++ gradle.properties | 15 ++++++++++ settings.gradle | 2 ++ 4 files changed, 143 insertions(+) create mode 100644 app/build.gradle create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 settings.gradle diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 00000000..02194ec3 --- /dev/null +++ b/app/build.gradle @@ -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() + } +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..6861a803 --- /dev/null +++ b/build.gradle @@ -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 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..8de50581 --- /dev/null +++ b/gradle.properties @@ -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 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..d1ef5e37 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +include ':app' +include ':client' \ No newline at end of file