Skip to content

Commit

Permalink
GEODE-6237: Opt into publication rather than opting out. (apache#3038)
Browse files Browse the repository at this point in the history
* Remove 'disableMavenPublishing' declaration and use.
* Remove unused publication block that was otherwise disabled in :extensions:geode-modules-assembly.
* Flatten if/else:'if/else:"if/else:"' logic in publish.gradle
* Move askpass block to rootProject build.gradle
* Use relative pathing rather than ${rootDir} in Gradle apply from statements

Co-authored-by: Robert Houghton <[email protected]>
Co-authored-by: Patrick Rhomberg <[email protected]>
  • Loading branch information
PurelyApplied and robbadler authored Jan 4, 2019
1 parent 42c7659 commit 961c75f
Show file tree
Hide file tree
Showing 41 changed files with 232 additions and 267 deletions.
1 change: 0 additions & 1 deletion boms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
*/

jar.enabled = false
disableMavenPublishing()

3 changes: 2 additions & 1 deletion boms/geode-all-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ apply plugin: "java"
apply plugin: "maven-publish"

jar.enabled = false
apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/publish.gradle"


publishing {
Expand Down
1 change: 1 addition & 0 deletions boms/geode-client-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

apply plugin: "io.spring.dependency-management"
apply from: "${project.projectDir}/../../gradle/publish.gradle"

jar.enabled = false

Expand Down
38 changes: 37 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ apply from: "${scriptDir}/ide.gradle"
apply from: "${scriptDir}/dependency-resolution.gradle"
apply from: "${scriptDir}/test.gradle"
apply from: "${scriptDir}/test-by-category.gradle"
apply from: "${scriptDir}/publish.gradle"
apply from: "${scriptDir}/code-analysis.gradle"
apply from: "${scriptDir}/sonar.gradle"
apply from: "${scriptDir}/rat.gradle"
Expand Down Expand Up @@ -152,3 +151,40 @@ task generate() {
// injecting themselves as a task dependency into this task. E.g., via
// `afterEvaluate.rootProject.generate.dependsOn(generateProto)`
}

// Prompt the user for a publication passsword to sign archives or upload artifacts, if requested
if (project.hasProperty('askpass')) {
gradle.taskGraph.whenReady { taskGraph ->
if(taskGraph.allTasks.any {it instanceof Sign}) {
if(!project.hasProperty('signing.keyId') || !project.hasProperty('signing.secretKeyRingFile')) {
println "You must configure your signing.keyId and signing.secretKeyRingFile"
println "in ~/.gradle/gradle.properties in order to sign jars\n"
println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps"
throw new GradleException("Signing key/keyring is missing")
}

if(!project.hasProperty('signing.password')) {
def password = PasswordDialog.askPassword("Please enter your password to unlock your gpg keyring for signing artifacts")

subprojects { ext."signing.password" = password }
}
}

if(taskGraph.allTasks.any {it instanceof PublishToMavenRepository}) {
if(!project.hasProperty('mavenUsername')) {
println "You must configure your mavenUsername in ~/.gradle/gradle.properties in order to publish\n"
println "See https://cwiki.apache.org/confluence/display/GEODE/Release+Steps"
throw new GradleException("mavenUsername is missing")
}
if(!project.hasProperty('mavenPassword')) {
def getPassword = PasswordDialog.askPassword("Please enter your apache password to publish to Apache Maven")

taskGraph.allTasks.each {
if(it instanceof PublishToMavenRepository) {
(it as PublishToMavenRepository).repository.credentials.password = getPassword
}
}
}
}
}
}
3 changes: 1 addition & 2 deletions extensions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
* limitations under the License.
*/

disableMavenPublishing()
apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
15 changes: 1 addition & 14 deletions extensions/geode-modules-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ configurations {
slf4jDeps
}

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand All @@ -32,7 +32,6 @@ dependencies {

jar.enabled = true

disableMavenPublishing()

def getJarArtifact(module) {
project(module).configurations.archives.artifacts.findAll {
Expand Down Expand Up @@ -242,15 +241,3 @@ task distTcServer30(type: Zip, dependsOn: [':extensions:geode-modules:assemble',
task dist(type: Task, dependsOn: ['distTcServer', 'distTcServer30', 'distTomcat', 'distAppServer'])

build.dependsOn dist

publishing {
publications {
maven(MavenPublication) {
artifact distTcServer
artifact distTcServer30
artifact distAppServer
artifact distTomcat
}
}
}

3 changes: 1 addition & 2 deletions extensions/geode-modules-session-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand All @@ -32,4 +32,3 @@ jar {
baseName = 'geode-modules-session-internal'
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules-session/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

evaluationDependsOn(":geode-core")

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -64,4 +64,3 @@ jar {
baseName = 'geode-modules-session'
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -43,4 +43,3 @@ dependencies {
}
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules-tomcat7/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

evaluationDependsOn(":geode-core")

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -58,4 +58,3 @@ eclipse.classpath.file {
}
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules-tomcat8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

evaluationDependsOn(":geode-core")

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -59,4 +59,3 @@ eclipse.classpath.file {
}
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules-tomcat9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

evaluationDependsOn(":geode-core")

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -47,4 +47,3 @@ eclipse.classpath.file {
}
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/geode-modules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

evaluationDependsOn(":geode-core")

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand Down Expand Up @@ -61,4 +61,3 @@ dependencies {
}
}

disableMavenPublishing()
3 changes: 1 addition & 2 deletions extensions/session-testing-war/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
apply plugin: 'war'

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand All @@ -27,4 +27,3 @@ war {
version = ''
}

disableMavenPublishing()
4 changes: 2 additions & 2 deletions geode-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import java.nio.file.Paths
evaluationDependsOn(":geode-core")

apply plugin: 'distribution'
apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"

// disable artifact generation for this project
jar.enabled = false
Expand Down Expand Up @@ -394,7 +395,6 @@ distributions {
exclude relBuild
}
}

}
}

Expand Down
3 changes: 1 addition & 2 deletions geode-assembly/geode-assembly-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/


apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand All @@ -32,4 +32,3 @@ dependencies {
compileOnly('org.codehaus.cargo:cargo-core-uberjar')
}

disableMavenPublishing()
5 changes: 3 additions & 2 deletions geode-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
testCompile('junit:junit')
testCompile('org.assertj:assertj-core')
}
}
3 changes: 2 additions & 1 deletion geode-concurrency-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-connectors/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ repositories {
}
}

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

apply plugin: 'antlr'
apply plugin: 'me.champeau.gradle.jmh'
apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"

sourceSets {
jca {
Expand Down
3 changes: 2 additions & 1 deletion geode-cq/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-dunit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-experimental-driver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-json/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"
3 changes: 2 additions & 1 deletion geode-junit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 2 additions & 1 deletion geode-lucene/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
3 changes: 1 addition & 2 deletions geode-lucene/geode-lucene-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/


apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../../gradle/geode-dependency-management.gradle"


dependencies {
Expand All @@ -29,4 +29,3 @@ dependencies {
compile('org.mockito:mockito-core')
}

disableMavenPublishing()
3 changes: 2 additions & 1 deletion geode-old-client-support/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* limitations under the License.
*/

apply from: "${rootDir}/${scriptDir}/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/geode-dependency-management.gradle"
apply from: "${project.projectDir}/../gradle/publish.gradle"


dependencies {
Expand Down
1 change: 0 additions & 1 deletion geode-old-versions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

disableMavenPublishing()
def generatedResources = "$buildDir/generated-resources/main"
project.ext.installs = new Properties()

Expand Down
1 change: 1 addition & 0 deletions geode-protobuf-messages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

apply plugin: 'com.google.protobuf'
apply plugin: 'idea'
apply from: "${project.projectDir}/../gradle/publish.gradle"


buildscript {
Expand Down
Loading

0 comments on commit 961c75f

Please sign in to comment.