Skip to content

Commit

Permalink
Merge pull request #1 from Meesho/jfrog-migration
Browse files Browse the repository at this point in the history
Add publish Jfrog script to publish artifact
  • Loading branch information
saini2sandeep authored Jun 24, 2022
2 parents d516b25 + 3840c5b commit 6bae04d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ 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()
Expand Down
67 changes: 66 additions & 1 deletion circleindicator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,69 @@ dependencies {
}

//apply from: "upload-jcenter.gradle"
//apply from: "upload-maven.gradle"
//apply from: "upload-maven.gradle"

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()

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

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")
artifact androidSourcesJar

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 6bae04d

Please sign in to comment.