C. Sean Young | 8fffa0b | 2015-06-10 12:47:21 -0500 | [diff] [blame] | 1 | /* |
Alan Viverette | c333235 | 2017-03-10 13:29:30 -0500 | [diff] [blame] | 2 | * Copyright (C) 2017 The Android Open Source Project |
C. Sean Young | 8fffa0b | 2015-06-10 12:47:21 -0500 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Alan Viverette | 34a7a77 | 2016-12-09 11:45:15 -0500 | [diff] [blame] | 17 | import javax.tools.ToolProvider |
| 18 | |
Alan Viverette | c333235 | 2017-03-10 13:29:30 -0500 | [diff] [blame] | 19 | apply plugin: 'java' |
| 20 | apply plugin: 'maven' |
| 21 | |
| 22 | group = 'com.android' |
Alan Viverette | 2e3115d | 2017-07-24 15:43:33 -0400 | [diff] [blame] | 23 | version = '1.1.0' |
Alan Viverette | c333235 | 2017-03-10 13:29:30 -0500 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * With the build server you are given two env variables: |
| 27 | * 1. The OUT_DIR is a temporary directory you can use to put things during the build. |
| 28 | * 2. The DIST_DIR is where you want to save things from the build. |
| 29 | * |
| 30 | * The build server will copy the contents of DIST_DIR to somewhere and make it available. |
| 31 | */ |
| 32 | if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) { |
| 33 | buildDir = file("${System.env.OUT_DIR}/gradle/external/jdiff/build").getCanonicalFile() |
| 34 | ext.distDir = file(System.env.DIST_DIR).getCanonicalFile() |
| 35 | |
| 36 | // The distDir is conveniently named after the build ID. |
| 37 | version = "${version}.${ext.distDir.name}" |
| 38 | } else { |
| 39 | buildDir = file('../../out/host/gradle/external/jdiff/build') |
| 40 | ext.distDir = file('../../out/dist') |
| 41 | |
| 42 | // Local builds are not public release candidates. |
| 43 | version = "${version}-SNAPSHOT" |
| 44 | } |
| 45 | |
| 46 | dependencies { |
| 47 | // tools.jar required for com.sun.javadoc |
| 48 | compile files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs()) |
| 49 | } |
| 50 | |
C. Sean Young | 8fffa0b | 2015-06-10 12:47:21 -0500 | [diff] [blame] | 51 | sourceSets { |
| 52 | main { |
| 53 | java.srcDirs = ['src'] |
| 54 | } |
| 55 | } |
| 56 | |
Alan Viverette | c333235 | 2017-03-10 13:29:30 -0500 | [diff] [blame] | 57 | uploadArchives { |
| 58 | repositories { |
| 59 | mavenDeployer { |
| 60 | repository(url: uri("${buildDir}/repo")) |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | task dist(type: Zip, dependsOn: uploadArchives) { |
| 66 | group = BasePlugin.BUILD_GROUP |
| 67 | description 'Builds distribution artifacts.' |
| 68 | |
| 69 | from uploadArchives.artifacts |
| 70 | destinationDir distDir |
| 71 | |
| 72 | doLast { |
| 73 | logger.lifecycle "Compressed maven artifacts to ${archivePath}" |
| 74 | } |
C. Sean Young | 8fffa0b | 2015-06-10 12:47:21 -0500 | [diff] [blame] | 75 | } |