Skip to content

Commit

Permalink
MC-9191: bump up targetSdkVersion, compileSdkVersion 31 -> 33, update…
Browse files Browse the repository at this point in the history
… deps versions

* MC-9191: update target sdk, AGP

* update publish-lib.gradle script

* clean up gradle scripts

* clean up gradle scripts & remove snapshot variant

* remove unnecessary ext prefix

* update changelog

* fix Javadoc formatting for successful androidJavadocsJar task run
  • Loading branch information
ANetyaga authored May 25, 2023
1 parent eb53a72 commit eb7c0db
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 216 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/merge_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ on:

jobs:
check:
uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.merge_request.yml@v1
with:
java_version: '8'
uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.merge_request.yml@v1
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
jobs:
publish:
uses: tinkoff-mobile-tech/workflows/.github/workflows/android_lib.publish.yml@v1
with:
java_version: '8'
secrets:
gpg_key: ${{ secrets.GPG_KEY }}
sign_ossrh_gradle_properties: ${{ secrets.SIGN_OSSRH_GRADLE_PROPERTIES }}
20 changes: 6 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
apply from: 'gradle/versions.gradle'

repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "com.android.tools.build:gradle:$androidPluginVersion"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,20 +18,10 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
minSdk = 14
targetSdk = 31

appCompatVersion = '1.4.1'
materialVersion = '1.3.0'
jUnitVersion = '4.12'
robolectricVersion = '3.1.2'
}
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.5.2

#### Fixed
#### Changes
- bump up targetSdkVersion, compileSdkVersion 31 -> 33, update dependencies versions
#### Additions

## 1.5.1

#### Fixed
Expand Down
10 changes: 6 additions & 4 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.targetSdk
compileSdkVersion rootProject.compileSdkVersion

defaultConfig {
applicationId "ru.tinkoff.formattingdemo"
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.targetSdk
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -21,5 +23,5 @@ android {
dependencies {
implementation project(':library')

implementation "com.google.android.material:material:$rootProject.materialVersion"
implementation "com.google.android.material:material:$materialVersion"
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true

VERSION_NAME=1.5.1
VERSION_CODE=19
GROUP=ru.tinkoff.decoro

POM_DESCRIPTION=Android library for text formatting
POM_URL=https://github.com/TinkoffCreditSystems/decoro
POM_SCM_URL=https://github.com/TinkoffCreditSystems/decoro
POM_SCM_CONNECTION=scm:[email protected]:TinkoffCreditSystems/decoro.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:TinkoffCreditSystems/decoro.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=tcs
POM_DEVELOPER_NAME=Tinkoff Credit Systems
POM_URL=https://github.com/tinkoff-mobile-tech/decoro
POM_SCM_URL=https://github.com/tinkoff-mobile-tech/decoro/tree/master
POM_SCM_CONNECTION=scm:git:git://github.com/tinkoff-mobile-tech/decoro.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:tinkoff-mobile-tech/decoro.git

VERSION_NAME=1.5.2
VERSION_CODE=20
GROUP=ru.tinkoff.decoro
208 changes: 50 additions & 158 deletions gradle/publish-lib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,14 @@
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return !VERSION_NAME.contains("SNAPSHOT")
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('ossrhUsername') ? ossrhUsername : ''
}
Expand All @@ -43,176 +31,80 @@ def getRepositoryPassword() {
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
publishing {
publications {
release(MavenPublication) {
groupId GROUP
artifactId POM_ARTIFACT_ID
version VERSION_NAME

from components.release

afterEvaluate {
artifact androidSourcesJar
artifact androidJavadocsJar
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
task install(type: Upload, dependsOn: assemble) {
repositories.mavenInstaller {
configuration = configurations.archives

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
repositories {
maven {
url = getReleaseRepositoryUrl()
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
} else {
install {
repositories.mavenInstaller {
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
task androidSourcesJar(type: Jar) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}

task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
}

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier.set("javadoc")
from androidJavadocs.destinationDir
}

artifacts {
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
archives androidSourcesJar
archives androidJavadocsJar
} else {
archives sourcesJar
archives javadocJar
}
signing {
required { gradle.taskGraph.hasTask("publish") }
sign publishing.publications.release
}
}
17 changes: 17 additions & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ext {
compileSdkVersion = 33
targetSdkVersion = 33
minSdkVersion = 14

decoroVersionCode = VERSION_CODE.toInteger()
decoroVersionName = VERSION_NAME

// android libs
appCompatVersion = '1.6.1'
materialVersion = '1.9.0'
androidPluginVersion = '7.4.2'

// testing automation libs
jUnitVersion = '4.13.2'
robolectricVersion = '4.9.2'
}
Loading

0 comments on commit eb7c0db

Please sign in to comment.