1 buildscript { 2 repositories { 3 jcenter() 4 } 5 dependencies { 6 classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0" 7 } 8 } 9 10 // apply the plugin with its class name rather than its Id to work around gradle limitation of 11 // not being able to find the plugin by Id despite the dependencies being added right above. Gradle 12 // is currently not capable of loading plugins by Id if the dependency is anywhere else than 13 // in the main project build.gradle. This file is "imported" into the project's build.gradle 14 // through a "apply from:". 15 apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin 16 apply plugin: 'maven-publish' 17 18 def bintrayInfoFilePath = "$buildDir/outputs/bintray-descriptor.bintray-info.json" 19 20 project.ext.version = '1.1.0-SNAPSHOT' 21 22 task sourcesJar(type: Jar) { 23 classifier = 'sources' 24 from android.sourceSets.main.java.srcDirs 25 } 26 27 task javadoc(type: Javadoc) { 28 source = android.sourceSets.main.java.srcDirs 29 classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 30 } 31 32 task javadocJar(type: Jar, dependsOn: javadoc) { 33 classifier = 'javadoc' 34 from javadoc.destinationDir 35 } 36 37 task bintrayInfoFile { 38 outputs.file(bintrayInfoFilePath) 39 doLast { 40 println 'Creating bintray-info.json' 41 String fileContent = new File("$rootDir/bintray-info-template.json").getText('UTF-8') 42 fileContent = fileContent.replace('$VERSION$', project.ext.version) 43 ((new File(bintrayInfoFilePath))).write(fileContent) 44 } 45 } 46 47 artifacts { 48 archives javadocJar 49 archives sourcesJar 50 } 51 52 publishing { 53 publications { 54 library(MavenPublication) { 55 groupId 'com.android.volley' 56 artifactId 'volley' 57 version project.ext.version 58 pom { 59 packaging 'aar' 60 } 61 62 // Release AAR, Sources, and JavaDoc 63 artifact "$buildDir/outputs/aar/volley-release.aar" 64 artifact sourcesJar 65 artifact javadocJar 66 artifact(bintrayInfoFilePath) { 67 builtBy bintrayInfoFile 68 extension "bintray-info.json" 69 } 70 } 71 } 72 } 73 74 artifactory { 75 contextUrl = "https://oss.jfrog.org" 76 publish { 77 repository { 78 repoKey = 'oss-snapshot-local' 79 username = System.env.CI_DEPLOY_USERNAME 80 password = System.env.CI_DEPLOY_PASSWORD 81 } 82 defaults { 83 publications('library') 84 publishArtifacts = true 85 } 86 } 87 resolve { 88 repoKey = 'jcenter' 89 } 90 } 91