SHARE
TWEET

build.gradle

a guest Jan 28th, 2016 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. apply plugin: 'com.android.library'
  2.  
  3. android {
  4.     compileSdkVersion 23
  5.     buildToolsVersion "23.0.2"
  6.  
  7.     defaultConfig {
  8.         minSdkVersion 12
  9.         targetSdkVersion 23
  10.         versionCode Integer.parseInt(VERSION_CODE)
  11.         versionName VERSION_NAME
  12.     }
  13.  
  14.     compileOptions {
  15.         sourceCompatibility JavaVersion.VERSION_1_7
  16.         targetCompatibility JavaVersion.VERSION_1_7
  17.     }
  18.     buildTypes {
  19.         release {
  20.             minifyEnabled false
  21.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  22.         }
  23.     }
  24. }
  25.  
  26. configurations {
  27.     javadocDeps
  28. }
  29.  
  30. dependencies {
  31.     compile 'com.android.support:recyclerview-v7:23.1.1'
  32.     compile 'com.android.support:support-annotations:22.2.0'
  33.     javadocDeps 'com.android.support:recyclerview-v7:23.1.1'
  34.     javadocDeps 'com.android.support:support-annotations:22.2.0'
  35. }
  36.  
  37.  
  38. /*
  39.  * Copyright 2013 Chris Banes
  40.  *
  41.  * Licensed under the Apache License, Version 2.0 (the "License");
  42.  * you may not use this file except in compliance with the License.
  43.  * You may obtain a copy of the License at
  44.  *
  45.  *     http://www.apache.org/licenses/LICENSE-2.0
  46.  *
  47.  * Unless required by applicable law or agreed to in writing, software
  48.  * distributed under the License is distributed on an "AS IS" BASIS,
  49.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  50.  * See the License for the specific language governing permissions and
  51.  * limitations under the License.
  52.  */
  53.  
  54. apply plugin: 'maven'
  55. apply plugin: 'signing'
  56.  
  57. def isReleaseBuild() {
  58.     return VERSION_NAME.contains("SNAPSHOT") == false
  59. }
  60.  
  61. def getReleaseRepositoryUrl() {
  62.     return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
  63.             : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
  64. }
  65.  
  66. def getSnapshotRepositoryUrl() {
  67.     return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
  68.             : "https://oss.sonatype.org/content/repositories/snapshots/"
  69. }
  70.  
  71. def getRepositoryUsername() {
  72.     return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
  73. }
  74.  
  75. def getRepositoryPassword() {
  76.     return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
  77. }
  78.  
  79. afterEvaluate { project ->
  80.     uploadArchives {
  81.         repositories {
  82.             mavenDeployer {
  83.                 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
  84.  
  85.                 pom.groupId = GROUP
  86.                 pom.artifactId = POM_ARTIFACT_ID
  87.                 pom.version = VERSION_NAME
  88.  
  89.                 repository(url: getReleaseRepositoryUrl()) {
  90.                     authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
  91.                 }
  92.                 snapshotRepository(url: getSnapshotRepositoryUrl()) {
  93.                     authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
  94.                 }
  95.  
  96.                 pom.project {
  97.                     name POM_NAME
  98.                     packaging POM_PACKAGING
  99.                     description POM_DESCRIPTION
  100.                     url POM_URL
  101.  
  102.                     scm {
  103.                         url POM_SCM_URL
  104.                         connection POM_SCM_CONNECTION
  105.                         developerConnection POM_SCM_DEV_CONNECTION
  106.                     }
  107.  
  108.                     licenses {
  109.                         license {
  110.                             name POM_LICENCE_NAME
  111.                             url POM_LICENCE_URL
  112.                             distribution POM_LICENCE_DIST
  113.                         }
  114.                     }
  115.  
  116.                     developers {
  117.                         developer {
  118.                             id POM_DEVELOPER_ID
  119.                             name POM_DEVELOPER_NAME
  120.                         }
  121.                     }
  122.                 }
  123.             }
  124.         }
  125.     }
  126.  
  127.     signing {
  128.         required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
  129.         sign configurations.archives
  130.     }
  131.  
  132.     task androidJavadocs(type: Javadoc) {
  133.         source = android.sourceSets.main.java.srcDirs
  134.         classpath += configurations.javadocDeps
  135.         classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  136.     }
  137.  
  138.     task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
  139.         classifier = 'javadoc'
  140.         from androidJavadocs.destinationDir
  141.     }
  142.  
  143.     task androidSourcesJar(type: Jar) {
  144.         classifier = 'sources'
  145.         from android.sourceSets.main.java.sourceFiles
  146.     }
  147.  
  148.     artifacts {
  149.         archives androidSourcesJar
  150.         archives androidJavadocsJar
  151.     }
  152. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top