Skip to content

Commit

Permalink
Make candidate default to the alt repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rspieldenner committed Aug 8, 2017
1 parent f0a9ae8 commit 85131f2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
4.0.0 / 2017-08-08
==================

* BREAKING: Swap candidate to default to publish to candidate repo

3.5.2 / 2016-11-11
==================

Expand Down
28 changes: 7 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ To include, add the following to your build.gradle
If using gradle 2.1 or newer:

plugins {
id 'nebula.netflixoss' version '3.5.2'
id 'nebula.netflixoss' version '4.0.0'
}

-or-

buildscript {
repositories { jcenter() }
dependencies { classpath 'com.netflix.nebula:gradle-netflixoss-project-plugin:3.5.2' }
dependencies { classpath 'com.netflix.nebula:gradle-netflixoss-project-plugin:4.0.0' }
}

allprojects {
Expand Down Expand Up @@ -106,11 +106,11 @@ We disable the devSnapshot task since we release to oss.jfrog.org with maven sty
-Prelease.travisci - takes a boolean, true disables the prepare checks and release tagging, false(the default) leaves the normal checks in place.
-Prelease.disableGitChecks - does the same as above

### Build Property to Use Alternative Publishing Repository
### Build Property to Disable Alternative Publishing Repository

if the following property is in place we will publish to a candidate repository which is not synced to
if the following property is in place and set to false we will publish to jcenter and mavenCentral instead of a staging candidate repo

./gradlew -PnetflixossAltCandidateRepo=true clean <snapshot|canidate|final>
./gradlew -PnetflixossAltCandidateRepo=false clean candidate

Gradle Compatibility Tested
---------------------------
Expand All @@ -120,26 +120,12 @@ Tested with Oracle JDK8

| Gradle Version | Works |
| :------------: | :---: |
| 2.2.1 | yes |
| 2.3 | yes |
| 2.4 | yes |
| 2.5 | yes |
| 2.6 | yes |
| 2.7 | yes |
| 2.8 | yes |
| 2.9 | yes |
| 2.10 | yes |
| 2.11 | yes |
| 2.12 | yes |
| 2.13 | yes |
| 2.14.1 | yes |
| 3.0 | yes |
| 3.1 | yes |
| 4.1 | yes |

LICENSE
=======

Copyright 2014-2016 Netflix, Inc.
Copyright 2014-2017 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ class PublishingPlugin implements Plugin<Project> {

BintrayExtension bintray = project.extensions.getByType(BintrayExtension)
bintray.pkg.with {
it.repo = 'maven'
if (project.hasProperty(NETFLIXOSS_ALT_CANDIDATE_REPO)) {
def altCandidate = project.property(NETFLIXOSS_ALT_CANDIDATE_REPO)
if ((altCandidate instanceof String) ? altCandidate.toBoolean() : altCandidate) {
it.repo = 'oss-candidate'
it.version.mavenCentralSync.sync = false
repo = 'maven'
project.gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
if (shouldUseCandidateRepo(project, graph)) {
repo = 'oss-candidate'
version.mavenCentralSync.sync = false
}
}
it.userOrg = 'netflixoss'
it.licenses = ['Apache-2.0']
it.labels = ['netflixoss']
userOrg = 'netflixoss'
licenses = ['Apache-2.0']
labels = ['netflixoss']
}

BintrayUploadTask bintrayUpload = (BintrayUploadTask) project.tasks.find { it instanceof BintrayUploadTask }
Expand Down Expand Up @@ -106,4 +105,17 @@ class PublishingPlugin implements Plugin<Project> {
String path = m[0][7] - '.git'
path.tokenize('/').last()
}

Boolean shouldUseCandidateRepo(Project project, TaskExecutionGraph graph) {
if (!graph.hasTask(':candidate')) {
return false
}

if (project.hasProperty(NETFLIXOSS_ALT_CANDIDATE_REPO)) {
def myproperty = project.property(NETFLIXOSS_ALT_CANDIDATE_REPO)
return (myproperty instanceof String) ? myproperty.toBoolean() : myproperty
}

return true
}
}

0 comments on commit 85131f2

Please sign in to comment.