diff --git a/build.gradle b/build.gradle index 8804c49..cc20382 100644 --- a/build.gradle +++ b/build.gradle @@ -22,61 +22,61 @@ allprojects { } } -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 - } - } -} +//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 +// } +// } +//} \ No newline at end of file diff --git a/circleindicator/build.gradle b/circleindicator/build.gradle index ab06f82..382e5eb 100644 --- a/circleindicator/build.gradle +++ b/circleindicator/build.gradle @@ -27,4 +27,69 @@ dependencies { } //apply from: "upload-jcenter.gradle" -//apply from: "upload-maven.gradle" \ No newline at end of file +//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 + } + } +}