diff --git a/app/build.gradle b/app/build.gradle index 00c60b3..0a3d486 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,20 +1,20 @@ apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' buildscript { repositories { - jcenter() mavenCentral() } } android { - compileSdkVersion 28 + compileSdkVersion 31 buildToolsVersion '28.0.3' defaultConfig { applicationId "com.mutualmobile.barricade.sample" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -41,27 +41,27 @@ android { dependencies { - implementation "androidx.appcompat:appcompat:${SUPPORT_LIB_VERSION}" - implementation "androidx.cardview:cardview:${SUPPORT_LIB_VERSION}" + implementation "androidx.appcompat:appcompat:1.4.0-rc01" + implementation "androidx.cardview:cardview:1.0.0" implementation project(':barricade') annotationProcessor project(':barricade-compiler') - implementation "com.squareup.okhttp3:logging-interceptor:${OKHTTP_VERSION}" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.0" - implementation "com.squareup.retrofit2:retrofit:${RETROFIT_VERSION}" - implementation "com.squareup.retrofit2:converter-gson:${RETROFIT_VERSION}" + implementation "com.squareup.retrofit2:retrofit:2.9.0" + implementation "com.squareup.retrofit2:converter-gson:2.9.0" - testImplementation 'junit:junit:4.12' - testImplementation 'com.google.truth:truth:0.35' + testImplementation 'junit:junit:4.13.2' + testImplementation 'com.google.truth:truth:0.43' - androidTestImplementation "androidx.test.espresso:espresso-core:${ESPRESSO_VERSION}" - androidTestImplementation "androidx.test:runner:${RUNNER_VERSION}" - androidTestImplementation "androidx.annotation:annotation:${SUPPORT_LIB_VERSION}" + androidTestImplementation "androidx.test.espresso:espresso-core:3.5.0-alpha03" + androidTestImplementation "androidx.test:runner:1.4.1-alpha03" + androidTestImplementation "androidx.annotation:annotation:1.3.0" androidTestImplementation 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0' - androidTestImplementation "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}" - androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0-alpha4') { + androidTestImplementation "com.squareup.okhttp3:okhttp:5.0.0-alpha2" + androidTestImplementation('androidx.test.espresso:espresso-contrib:3.5.0-alpha03') { // Necessary to avoid version conflicts exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' @@ -69,6 +69,8 @@ dependencies { exclude module: 'recyclerview-v7' } implementation project(path: ':barricade-annotations') + implementation "androidx.core:core-ktx:1.7.0" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } @@ -80,3 +82,6 @@ configurations.all { cacheChangingModulesFor 0, 'seconds' } } +repositories { + mavenCentral() +} diff --git a/app/src/main/java/com/mutualmobile/barricade/sample/api/ChuckNorrisApiService.java b/app/src/main/java/com/mutualmobile/barricade/sample/api/ChuckNorrisApiService.java index 2b13567..8e49dff 100644 --- a/app/src/main/java/com/mutualmobile/barricade/sample/api/ChuckNorrisApiService.java +++ b/app/src/main/java/com/mutualmobile/barricade/sample/api/ChuckNorrisApiService.java @@ -5,15 +5,19 @@ import com.mutualmobile.barricade.sample.api.model.Joke; import java.util.List; + import retrofit2.Call; import retrofit2.http.GET; public interface ChuckNorrisApiService { - @GET("/jokes/random") @Barricade(endpoint = "random", responses = { - @Response(fileName = "success.json",isDefault = true), - @Response(fileName = "failure.json", statusCode = 401) - }) Call getRandomJoke(); + @GET("/jokes/random") + @Barricade(endpoint = "random", responses = { + @Response(fileName = "success.json", isDefault = true), + @Response(fileName = "failure.json", statusCode = 401) + }) + Call getRandomJoke(); - @GET("/jokes/categories") Call> getJokeCategories(); + @GET("/jokes/categories") + Call> getJokeCategories(); } diff --git a/barricade-compiler/build.gradle b/barricade-compiler/build.gradle index 7037d16..7cb6d1f 100644 --- a/barricade-compiler/build.gradle +++ b/barricade-compiler/build.gradle @@ -10,7 +10,9 @@ ext { dependencies { implementation 'com.google.auto.service:auto-service:1.0-rc2' - implementation 'com.squareup:javapoet:1.10.0' + annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2' + + implementation 'com.squareup:javapoet:1.13.0' implementation project(':barricade-annotations') } diff --git a/barricade/build.gradle b/barricade/build.gradle index 292eba7..1b233a1 100644 --- a/barricade/build.gradle +++ b/barricade/build.gradle @@ -1,17 +1,16 @@ apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' sourceCompatibility = 1.7 targetCompatibility = 1.7 android { - compileSdkVersion 28 + compileSdkVersion 31 buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 16 - targetSdkVersion 28 - versionCode 1 - versionName VERSION_NAME + targetSdkVersion 31 vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -37,15 +36,20 @@ ext { dependencies { implementation project(':barricade-annotations') - implementation "androidx.appcompat:appcompat:${SUPPORT_LIB_VERSION}" - implementation "androidx.legacy:legacy-support-v4:${SUPPORT_LIB_VERSION}" - implementation "androidx.recyclerview:recyclerview:${SUPPORT_LIB_VERSION}" + implementation "androidx.appcompat:appcompat:1.3.1" + implementation "androidx.legacy:legacy-support-v4:1.0.0" + implementation "androidx.recyclerview:recyclerview:1.2.1" - implementation "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}" + implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2" - androidTestImplementation "androidx.test.espresso:espresso-core:${ESPRESSO_VERSION}" - androidTestImplementation "androidx.test:runner:${RUNNER_VERSION}" - androidTestImplementation "androidx.annotation:annotation:${SUPPORT_LIB_VERSION}" + androidTestImplementation "androidx.test.espresso:espresso-core:3.5.0-alpha03" + androidTestImplementation "androidx.test:runner:1.4.1-alpha03" + androidTestImplementation "androidx.annotation:annotation:" + implementation "androidx.core:core-ktx:1.7.0" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } -apply from: '../bintray.gradle' \ No newline at end of file +apply from: '../bintray.gradle' +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/bintray.gradle b/bintray.gradle index 47e1035..4c1d86f 100644 --- a/bintray.gradle +++ b/bintray.gradle @@ -1,53 +1,57 @@ -apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'maven-publish' -group = GROUP // Maven Group ID for the artifact +afterEvaluate { + publishing { + publications { + mavenJava(MavenPublication) { + groupId = GROUP + artifactId = 'barricade' + version = VERSION_NAME + pom { + packaging 'aar' + groupId GROUP + artifactId bintrayName -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - groupId GROUP - artifactId bintrayName + // Add your description here + name = libraryName + description POM_DESCRIPTION + url = POM_SITE_URL - // Add your description here - name libraryName - description POM_DESCRIPTION - url POM_SITE_URL - - // Set your license - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL + // Set your license + licenses { + license { + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + } } - } - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - email POM_DEVELOPER_EMAIL + developers { + developer { + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + email = POM_DEVELOPER_EMAIL + } + } + scm { + connection = POM_GIT_URL + developerConnection = POM_GIT_URL + url = POM_SITE_URL } } - scm { - connection POM_GIT_URL - developerConnection POM_GIT_URL - url POM_SITE_URL - } + + } + } + repositories { + maven { + url "$buildDir/releases" } } } } -apply plugin: 'com.jfrog.bintray' - -version = VERSION_NAME - if (project.hasProperty("android")) { // Android libraries task sourcesJar(type: Jar) { - classifier = 'sources' + classifier("sources") from android.sourceSets.main.java.srcDirs } @@ -58,13 +62,13 @@ if (project.hasProperty("android")) { } else { // Java libraries task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + classifier("sources") from sourceSets.main.allSource } } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + classifier("javadoc") from javadoc.destinationDir } @@ -73,34 +77,3 @@ artifacts { archives sourcesJar } -// Bintray -Properties properties = new Properties() -if (project.rootProject.file('local.properties').exists()) { - properties.load(project.rootProject.file('local.properties').newDataInputStream()) -} - -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = POM_REPO - name = bintrayName - desc = POM_DESCRIPTION - websiteUrl = POM_SITE_URL - userOrg = POM_ORG - vcsUrl = POM_GIT_URL - licenses = POM_LICENCES - publish = true - publicDownloadNumbers = true - version { - desc = POM_DESCRIPTION - gpg { - sign = true //Determines whether to GPG sign the files. The default is false - passphrase = properties.getProperty("bintray.gpg.password") - //Optional. The passphrase for GPG signing' - } - } - } -} diff --git a/build.gradle b/build.gradle index 4f10e86..f41738b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,35 +1,29 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - repositories { - jcenter() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } + ext.kotlin_version = '1.5.31' + repositories { + google() + jcenter() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.0.3' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } } allprojects { - repositories { - google() - jcenter() - } + repositories { + google() + jcenter() + + } } task clean(type: Delete) { - delete rootProject.buildDir + delete rootProject.buildDir } -ext { - OKHTTP_VERSION = "3.8.0" - SUPPORT_LIB_VERSION = '1.0.0-beta01' - RETROFIT_VERSION = "2.4.0" - ESPRESSO_VERSION = '3.1.0-alpha4' - RUNNER_VERSION = '1.1.0-alpha4' -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 13372ae..1948b90 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 723083b..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jan 02 13:42:50 IST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/gradlew b/gradlew index 9d82f78..cccdd3d 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -150,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..f955316 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line