Skip to content

Commit

Permalink
update: gradle version
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemant-Mann committed Nov 6, 2021
1 parent 6e11fb6 commit f511cf4
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 95 deletions.
15 changes: 12 additions & 3 deletions TrackierSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ buildscript {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta06'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
}
}

Expand All @@ -21,9 +24,15 @@ allprojects {
mavenCentral()
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}

apply plugin: 'io.github.gradle-nexus.publish-plugin'
apply from: 'publish-root.gradle'

task clean(type: Delete) {
delete rootProject.buildDir
}
}
1 change: 1 addition & 0 deletions TrackierSDK/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ android.useAndroidX=true
android.enableJetifier=true
POM_DEVELOPER_ID=trackier
POM_DEVELOPER_NAME=Trackier
PUBLISH_DEVELOPER_EMAIL=[email protected]
POM_LICENCE_DIST=repo
VERSION_CODE=17
VERSION_NAME=1.6.14
Expand Down
2 changes: 1 addition & 1 deletion TrackierSDK/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
36 changes: 36 additions & 0 deletions TrackierSDK/publish-root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Create variables with empty default values
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
}

// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
7 changes: 6 additions & 1 deletion TrackierSDK/sdk-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ plugins {
id 'kotlin-android-extensions'
}

apply from: 'maven-push.gradle'
//apply from: 'maven-push.gradle'

repositories {
mavenCentral()
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}

apply from: 'publish-module.gradle'

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
Expand Down
180 changes: 90 additions & 90 deletions TrackierSDK/sdk-core/maven-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,93 +39,93 @@ def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

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())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

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
}
}
}
}
}
}

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

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

artifacts {
archives androidSourcesJar
}

publishToMavenLocal {
def groupId = "com.trackier.dev"
def artifactId = "android-sdk"

publishing {
publications {
release(MavenPublication) {
from components.release

setGroupId groupId
setArtifactId artifactId
version VERSION_NAME
}
}
publications.all {
pom.withXml {
asNode().dependencies.'*'
.findAll() {
it.scope.text() == 'runtime' &&
project.configurations.implementation.allDependencies.find {
dep -> dep.name == it.artifactId.text()
}
}.each { it.scope*.value = 'compile'}
}
}
}
}
}
//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())
// }
// snapshotRepository(url: getSnapshotRepositoryUrl()) {
// authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
// }
//
// 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
// }
// }
// }
// }
// }
// }
//
// signing {
// required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
// sign configurations.archives
// }
//
// task androidSourcesJar(type: Jar) {
// classifier = 'sources'
// from android.sourceSets.main.java.sourceFiles
// }
//
// artifacts {
// archives androidSourcesJar
// }
//
// publishToMavenLocal {
// def groupId = "com.trackier.dev"
// def artifactId = "android-sdk"
//
// publishing {
// publications {
// release(MavenPublication) {
// from components.release
//
// setGroupId groupId
// setArtifactId artifactId
// version VERSION_NAME
// }
// }
// publications.all {
// pom.withXml {
// asNode().dependencies.'*'
// .findAll() {
// it.scope.text() == 'runtime' &&
// project.configurations.implementation.allDependencies.find {
// dep -> dep.name == it.artifactId.text()
// }
// }.each { it.scope*.value = 'compile'}
// }
// }
// }
// }
//}
73 changes: 73 additions & 0 deletions TrackierSDK/sdk-core/publish-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
} else {
from sourceSets.main.java.srcDirs
}
}

artifacts {
archives androidSourcesJar
}

group = GROUP
version = VERSION_NAME

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
// The coordinates of the library, being set from variables that
// we'll set up later
from components.release
groupId GROUP
artifactId POM_ARTIFACT_ID
version VERSION_NAME



artifact androidSourcesJar

// Mostly self-explanatory metadata
pom {
name = POM_ARTIFACT_ID
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = PUBLISH_DEVELOPER_EMAIL
}
}

// Version control info - if you're using GitHub, follow the
// format as seen here
scm {
connection = POM_SCM_DEV_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
}
}
}
}
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

signing {
sign publishing.publications
}

0 comments on commit f511cf4

Please sign in to comment.