diff --git a/CHANGELOG.md b/CHANGELOG.md index c13938c..49803b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## VERSION 1.2.0 +_20_01_2022_ +* Migrates to AndroidX +* Migrates to Gradle 6 +* Migrates to min api 21 and target 30 +* Migrates to nexus repository + ## VERSION 1.1.1 _XX_08_2020_ * No changes from 1.0.5 diff --git a/app/build.gradle b/app/build.gradle index 999adf4..12e72d7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,14 +3,17 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 28 + compileSdkVersion Versions.sdkVersion + buildToolsVersion Versions.buildToolsVersion + defaultConfig { applicationId "com.mercadolibre.android.picassodiskcache" - minSdkVersion 19 - targetSdkVersion 28 + minSdkVersion Versions.minSdkVersion + targetSdkVersion Versions.sdkVersion versionCode 1 versionName "1.0" } + buildTypes { release { minifyEnabled false @@ -26,5 +29,7 @@ dependencies { implementation Dependencies.kotlinStdlib implementation Dependencies.appCompat implementation Dependencies.constraintLayout - implementation Dependencies.picassoTestApp -} \ No newline at end of file + implementation(Dependencies.picassoTestApp) { + force true + } +} diff --git a/app/src/main/java/com/mercadolibre/android/picassodiskcache/example/SampleActivity.kt b/app/src/main/java/com/mercadolibre/android/picassodiskcache/example/SampleActivity.kt index b12bc05..96f0b62 100644 --- a/app/src/main/java/com/mercadolibre/android/picassodiskcache/example/SampleActivity.kt +++ b/app/src/main/java/com/mercadolibre/android/picassodiskcache/example/SampleActivity.kt @@ -1,7 +1,7 @@ package com.mercadolibre.android.picassodiskcache.example import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import com.mercadolibre.android.picassodiskcache.PicassoDiskLoader import com.mercadolibre.android.picassodiskcache.loadImage import kotlinx.android.synthetic.main.activity_main.* diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f3626d5..959a2f5 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index aabe15a..2567fae 100644 --- a/build.gradle +++ b/build.gradle @@ -3,28 +3,28 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath Dependencies.gradle + classpath Dependencies.gradleAndroid classpath Dependencies.gradleKotlin - classpath Dependencies.bintray classpath Dependencies.maven // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle.kts.kts files } } +ext { + dateNow = new Date().format("ddMMyyyyHHmmssS") +} + allprojects { repositories { google() - jcenter() + mavenCentral() } } task cleanBuildDir(type: Delete) { delete rootProject.buildDir } -repositories { - mavenCentral() -} \ No newline at end of file diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index d46a77a..5d6263c 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -1,22 +1,20 @@ object Dependencies { // Gradle - const val gradle = "com.android.tools.build:gradle:${Versions.gradle}" + const val gradleAndroid = "com.android.tools.build:gradle:${Versions.gradleAndroid}" const val gradleKotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.gradleKotlin}" // Deploy - const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4" - const val maven = "com.github.dcendents:android-maven-gradle-plugin:2.1" + const val maven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.mavenPublish}" // Kotlin const val kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.gradleKotlin}" // AppCompat - const val appCompat = "com.android.support:appcompat-v7:${Versions.appcompat}" + const val appCompat = "androidx.appcompat:appcompat:${Versions.appcompat}" // ConstraintLayout - const val constraintLayout = - "com.android.support.constraint:constraint-layout:${Versions.constraintLayout}" + const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" // Picasso const val picasso = "com.squareup.picasso:picasso:${Versions.picasso}" @@ -26,4 +24,4 @@ object Dependencies { const val okHttp = "com.squareup.okhttp3:okhttp:${Versions.okHttp}" const val okHttpUrlConnection = "com.squareup.okhttp3:okhttp-urlconnection:${Versions.okHttp}" const val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.okHttp}" -} \ No newline at end of file +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 9d97d3b..29ba18e 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -1,16 +1,17 @@ object Versions { - const val versionToDeploy = "1.1.1" + const val libraryVersion = "1.2.0" - const val compileSdkVersion = 28 - const val minSdkVersion = 19 - const val targetSdkVersion = 28 + const val minSdkVersion = 21 + const val sdkVersion = 30 + const val buildToolsVersion = "30.0.2" - const val constraintLayout = "1.1.3" - const val appcompat = "28.0.0" - const val gradle = "3.5.1" - const val gradleKotlin = "1.3.50" - const val okHttp = "3.11.0" + const val mavenPublish = "2.1" + const val constraintLayout = "2.0.4" + const val appcompat = "1.2.0" + const val gradleAndroid = "4.2.1" + const val gradleKotlin = "1.3.71" + const val okHttp = "3.14.9" const val picasso = "2.5.2" const val picassoTestApp = "2.71828" } diff --git a/gradle.properties b/gradle.properties index 2ffdac4..84f4dc2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,3 +15,5 @@ org.gradle.jvmargs=-Xmx1536m # Android operating system, and which are packaged with your app's APK # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +android.useAndroidX=true +android.enableJetifier=true diff --git a/gradle/base_deploy.gradle b/gradle/base_deploy.gradle index 7d7bc11..cfe0022 100644 --- a/gradle/base_deploy.gradle +++ b/gradle/base_deploy.gradle @@ -1,33 +1,40 @@ -apply plugin:'maven' -apply plugin:'signing' apply plugin:'maven-publish' -apply plugin:'com.jfrog.bintray' -apply plugin:'com.github.dcendents.android-maven' -def dateNow = project.hasProperty('production') ? "" : new Date().format("ddMMyyyyHHmmssS") -def versionToDeploy = Versions.versionToDeploy -versionToDeploy = project.hasProperty('production') ? versionToDeploy : 'EXPERIMENTAL-' + versionToDeploy + '-' + dateNow -version = versionToDeploy +def versionLocation = "build/last_deployed_version.txt" + +task javadoc(type:Javadoc) { + failOnError = false + options.encoding = 'UTF-8' + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + exclude '**/BuildConfig.java' + exclude '**/R.java' + exclude '**/internal/**' +} + +task androidJavadocsJar(type:Jar, dependsOn:javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} task androidSourcesJar(type:Jar) { classifier = 'sources' from android.sourceSets.main.java.sourceFiles } -task publishAar(dependsOn: bintrayUpload) { - doLast { - println "Deployed ${project.name} version: ${versionToDeploy}" - } -} - -task publishLocal(dependsOn: publishToMavenLocal) { +task printLastVersion { doLast { - println "Deployed ${project.name} version: ${versionToDeploy}" + try { + println file(versionLocation).text + } catch(Exception ignored) { + //nothing to do here + } } } artifacts { archives androidSourcesJar + archives androidJavadocsJar } def localProperties = new Properties() @@ -36,93 +43,81 @@ if (project.rootProject.file('local.properties').exists()) { localProperties.load(project.rootProject.file('local.properties').newDataInputStream()) } -install { - group = groupName - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - groupId group - artifactId artifactLib - - // Add your description here - name libraryName - description libraryDescription - url siteUrl - - // Set your license - licenses { - license { - name licenseName - url licenseUrl +afterEvaluate { + publishing { + publications { + maven(MavenPublication) { + from components.release + groupId = group + artifactId = artifactLib + + pom { + name = libraryName + description = libraryDescription + url = siteUrl + + licenses { + license { + name = licenseName + url = licenseUrl + } } - } - developers { - developer { - id 'jorge.gonzalez' - name 'Jorge Gonzalez' - email 'jorge.gonzalez@mercadolibre.com' + scm { + connection = gitUrl + developerConnection = gitUrl + url = siteUrl } } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl + } + } + + repositories { + maven { + name = 'releases' + url = 'https://artifacts.mercadolibre.com/repository/android-releases' + credentials { + username = "$System.env.NEXUS_DEPLOYER_USER" + password = "$System.env.NEXUS_DEPLOYER_PASSWORD" + } + } + maven { + name = 'experimental' + url = 'https://artifacts.mercadolibre.com/repository/android-experimental' + credentials { + username = "$System.env.NEXUS_DEPLOYER_USER" + password = "$System.env.NEXUS_DEPLOYER_PASSWORD" } } } - } -} -bintray { - version = versionToDeploy - user = "$System.env.BINTRAY_USER" - key = "$System.env.BINTRAY_API_KEY" - - override = true - - configurations = ['archives'] - pkg { - repo = project.hasProperty('production') ? 'android' : 'android-experimental' - name = libraryName - desc = libraryDescription - userOrg = 'mercadopago' - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = ["Apache-2.0"] - publish = true - publicDownloadNumbers = true - version { - name = versionToDeploy - desc = libraryDescription - vcsTag = versionToDeploy - released = project.hasProperty('production') ? new Date() : null + tasks.register("publishLocal") { + dependsOn publishMavenPublicationToMavenLocal + version = "LOCAL-$Versions.libraryVersion-$dateNow" + + doLast { + println "Deployed ${project.name} version: ${version}" + file(versionLocation).text = version + } } - } -} -// Local m2 repo publication -publishing { - publications { - aar(MavenPublication) { - groupId group - version = versionToDeploy - artifactId artifactLib - artifact("$buildDir/outputs/aar/${artifactLib}-release.aar") { - builtBy assemble + tasks.register("publishExperimental") { + dependsOn publishMavenPublicationToExperimentalRepository + version = "EXPERIMENTAL-$Versions.libraryVersion-$dateNow" + + doLast { + println "Deployed ${project.name} version: ${version}" + file(versionLocation).text = version } + } - // Necessary to include dependencies - pom.withXml { - def dependencies = asNode().appendNode('dependencies') - configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each { - def dependency = dependencies.appendNode('dependency') - dependency.appendNode('groupId', it.moduleGroup) - dependency.appendNode('artifactId', it.moduleName) - dependency.appendNode('version', it.moduleVersion) - } + tasks.register("publishRelease") { + dependsOn publishMavenPublicationToReleasesRepository + version = Versions.libraryVersion + + doLast { + println "Deployed ${project.name} version: ${version}" + file(versionLocation).text = version } } } -} \ No newline at end of file +} diff --git a/gradle/deploy_picasso_disk_cache.gradle b/gradle/deploy_picasso_disk_cache.gradle index 1702964..5fdd520 100644 --- a/gradle/deploy_picasso_disk_cache.gradle +++ b/gradle/deploy_picasso_disk_cache.gradle @@ -10,6 +10,5 @@ ext { } group = groupName -archivesBaseName = artifactLib -apply from:"$rootDir/gradle/base_deploy.gradle" \ No newline at end of file +apply from:"$rootDir/gradle/base_deploy.gradle" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f6b961f..5c2d1cf 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 2f242ea..1f3fdbc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Oct 19 11:32:03 ART 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/gradlew b/gradlew index cccdd3d..b0d6d0a 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ 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="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d..15e1ee3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ 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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/picasso-disk-cache/build.gradle b/picasso-disk-cache/build.gradle index 858ee81..b6161bb 100644 --- a/picasso-disk-cache/build.gradle +++ b/picasso-disk-cache/build.gradle @@ -4,12 +4,12 @@ apply plugin: 'kotlin-android-extensions' apply from:"$rootDir/gradle/deploy_picasso_disk_cache.gradle" android { - compileSdkVersion Versions.compileSdkVersion + compileSdkVersion Versions.sdkVersion + buildToolsVersion Versions.buildToolsVersion defaultConfig { minSdkVersion Versions.minSdkVersion - targetSdkVersion Versions.targetSdkVersion - versionName Versions.versionToDeploy + targetSdkVersion Versions.sdkVersion consumerProguardFiles 'consumer-rules.pro' } @@ -32,4 +32,4 @@ dependencies { implementation Dependencies.okHttp implementation Dependencies.okHttpUrlConnection implementation Dependencies.loggingInterceptor -} \ No newline at end of file +}