Skip to content

Commit

Permalink
Add jfrog publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
saini2sandeep committed Jun 20, 2022
1 parent d516b25 commit feea850
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
62 changes: 62 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,74 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.4.2'
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
// classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.28.3"
}
}

allprojects {
apply plugin: "com.jfrog.artifactory"
apply plugin: "maven-publish"
repositories {
google()
jcenter()
}
}

ext.versionName = { ->
def currentTag = 'git tag --points-at HEAD'.execute().in.text.toString().trim()
def currentBranch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.toString().trim()
def tagRegex = "[0-9.]*[0-9]"
if (!currentTag.isEmpty() && currentTag.matches(tagRegex)) {// is not empty and is in following format 8.0
return currentTag
} else {
return currentBranch + '-SNAPSHOT'
}
}

def libraryGroupId = 'com.meesho.android'
def libraryVersion = versionName()

project('circleindicator') {
artifactoryPublish.dependsOn('build')
publishing {
publications {
aar(MavenPublication) {
groupId = libraryGroupId
artifactId = 'circle-indicator'
version = libraryVersion
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

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)
}
}
}
}
}
}
artifactory {

//The base Artifactory URL if not overridden by the publisher/resolver
contextUrl = project.properties["JFROG_ARTIFACTORY_URL"]
publish {
repository {
repoKey = libraryVersion.endsWith('-SNAPSHOT') ? project.properties["SNAPSHOT_REPO_NAME"] :
project.properties["RELEASE_REPO_NAME"]
username = project.properties["JFROG_ARTIFACTORY_USERNAME"]
password = project.properties["JFROG_ARTIFACTORY_KEY"]
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
# 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
# org.gradle.parallel=true

0 comments on commit feea850

Please sign in to comment.