Skip to content

Commit

Permalink
Handle autodeploy to maven repository
Browse files Browse the repository at this point in the history
  • Loading branch information
kormateusz-apl committed Apr 2, 2024
1 parent 57ae17b commit 5c8a274
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 56 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.22.0'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.27.0'
}
}

Expand All @@ -22,6 +22,6 @@ allprojects {
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
16 changes: 3 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
# 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
SONATYPE_CONNECT_TIMEOUT_SECONDS=180
SONATYPE_CLOSE_TIMEOUT_SECONDS=900

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Sep 08 11:31:21 CEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
58 changes: 45 additions & 13 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

ext {
PUBLISH_GROUP_ID = 'com.applandeo'
PUBLISH_ARTIFACT_ID = 'material-calendar-view'
PUBLISH_VERSION = '1.9.1'
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id "com.android.library"
id "kotlin-android"
id "kotlin-android-extensions"
id "com.vanniktech.maven.publish"
}

apply from: 'buildtools.gradle'

android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 15
compileSdk 33
targetSdkVersion 33
versionCode 4
versionName PUBLISH_VERSION
versionName project.ext.getVersionName()

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -29,18 +30,49 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()

coordinates("com.applandeo", "material-calendar-view", project.ext.getVersionName())

pom {
name = "Material-Calendar-View"
description = "Material-Calendar-View is a simple and customizable calendar widget for Android based on Material Design"
inceptionYear = "2017"
url = "https://github.com/Applandeo/Material-Calendar-View/"
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "applandeo"
name = "Applandeo"
url = "https://github.com/Applandeo"
}
}
scm {
url = "https://github.com/Applandeo/Material-Calendar-View"
connection = "scm:git:git:github.com/Applandeo/Material-Calendar-View.git"
developerConnection = "scm:git:ssh:github.com/Applandeo/Material-Calendar-View.git"
}
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.annimon:stream:1.2.1'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.core:core-ktx:1.9.0'
}

apply plugin: "com.vanniktech.maven.publish"
13 changes: 13 additions & 0 deletions library/buildtools.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
project.ext.getVersionName = {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (exception) {
println exception.fillInStackTrace()
return ext.getDebugVersionName()
}
}
40 changes: 17 additions & 23 deletions library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true

GROUP=com.applandeo
POM_ARTIFACT_ID=material-calendar-view
VERSION_NAME=1.9.1

POM_NAME=Material-Calendar-View
POM_DESCRIPTION=Material-Calendar-View is a simple and customizable calendar widget for Android based on Material Design
POM_INCEPTION_YEAR=2017
POM_URL=https://github.com/Applandeo/Material-Calendar-View/

POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_DIST=repo

POM_SCM_URL=https://github.com/Applandeo/Material-Calendar-View
POM_SCM_CONNECTION=scm:git:git:github.com/Applandeo/Material-Calendar-View.git
POM_SCM_DEV_CONNECTION=scm:git:ssh:github.com/Applandeo/Material-Calendar-View.git

POM_DEVELOPER_ID=applandeo
POM_DEVELOPER_NAME=Applandeo
POM_DEVELOPER_URL=https://github.com/Applandeo
## 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.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# 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
#Fri Mar 17 22:53:07 CET 2023
kotlin.code.style=official
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
android.useAndroidX=true
android.enableJetifier=true
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 33
defaultConfig {
applicationId "com.applandeo.materialcalendarsampleapp"
minSdkVersion 15
compileSdk 33
targetSdkVersion 33
versionCode 1
versionName "1.0"
Expand All @@ -30,7 +30,7 @@ dependencies {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.annimon:stream:1.2.1'
testImplementation 'junit:junit:4.13.2'
Expand Down

0 comments on commit 5c8a274

Please sign in to comment.