|
| 1 | +def getBintrayUser() { |
| 2 | + if (System.getenv('BINTRAY_USER')) { |
| 3 | + logger.lifecycle(System.getenv('BINTRAY_USER')) |
| 4 | + return System.getenv('BINTRAY_USER') |
| 5 | + } else if (rootProject.file('local.properties').exists()) { |
| 6 | + Properties properties = new Properties() |
| 7 | + properties.load(rootProject.file('local.properties').newDataInputStream()) |
| 8 | + return properties.getProperty('bintray.user') |
| 9 | + } else { |
| 10 | + logger.lifecycle("Warning: Could not find BINTRAY_USER in environment or local.properties") |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +def getBintrayKey() { |
| 15 | + if (System.getenv('BINTRAY_KEY')) { |
| 16 | + logger.lifecycle(System.getenv('BINTRAY_KEY')) |
| 17 | + return System.getenv('BINTRAY_KEY') |
| 18 | + } else if (rootProject.file('local.properties').exists()) { |
| 19 | + Properties properties = new Properties() |
| 20 | + properties.load(rootProject.file('local.properties').newDataInputStream()) |
| 21 | + return properties.getProperty('bintray.key') |
| 22 | + } else { |
| 23 | + logger.lifecycle("Warning: Could not find BINTRAY_KEY in environment or local.properties") |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +apply plugin: 'com.jfrog.bintray' |
| 28 | + |
| 29 | +bintray { |
| 30 | + user = getBintrayUser() |
| 31 | + key = getBintrayKey() |
| 32 | + configurations = ['archives'] |
| 33 | + pkg { |
| 34 | + repo = 'other' |
| 35 | + name = 'blurkit-android' |
| 36 | + userOrg = 'camerakit' |
| 37 | + vcsUrl = 'https://github.com/CameraKit/blurkit-android.git' |
| 38 | + licenses = ['MIT'] |
| 39 | + |
| 40 | + version { |
| 41 | + name = project.version |
| 42 | + released = new Date() |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +task cleanForDeployment { |
| 48 | + doLast { |
| 49 | + logger.lifecycle('BlurKit: Deployment: Cleaning...') |
| 50 | + logger.lifecycle('Deleting: ' + project.buildDir) |
| 51 | + delete project.buildDir |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +task buildForDeployment { |
| 56 | + logger.lifecycle('BlurKit: Deployment: Building...') |
| 57 | + shouldRunAfter(cleanForDeployment) |
| 58 | + finalizedBy assemble |
| 59 | + |
| 60 | + doFirst { |
| 61 | + android.variantFilter { variant -> |
| 62 | + if (variant.buildType.name == 'debug') { |
| 63 | + variant.setIgnore(true) |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +task deployRelease { |
| 70 | + logger.lifecycle('BlurKit - Starting Release Deployment') |
| 71 | + shouldRunAfter(buildForDeployment) |
| 72 | + |
| 73 | + dependsOn cleanForDeployment |
| 74 | + dependsOn buildForDeployment |
| 75 | + finalizedBy bintrayUpload |
| 76 | + |
| 77 | + doLast { |
| 78 | + logger.lifecycle(bintrayUpload.getVersionName()) |
| 79 | + bintrayUpload.setVersionName(bintrayUpload.getVersionName()) |
| 80 | + bintrayUpload.setUserOrg('camerakit') |
| 81 | + bintrayUpload.setRepoName('other') |
| 82 | + |
| 83 | + logger.lifecycle('Deploying version ' + bintrayUpload.getVersionName() + ' in ' + bintrayUpload.getRepoName()) |
| 84 | + } |
| 85 | +} |
0 commit comments