From 19b5d1526bed6e431fa5ff1362fa09ab5c5fae01 Mon Sep 17 00:00:00 2001 From: Mark Vulfson Date: Mon, 17 Jun 2019 15:20:30 -0700 Subject: [PATCH] feat(echo-bom): publish echo-bom (#578) publish `echo-bom` so we don't have to specify kork version in projects that depend on echo thus causing potential misconfigurations with different kork version --- build.gradle | 60 ++++++++++++++++++++------------------ echo-bom/echo-bom.gradle | 49 +++++++++++++++++++++++++++++++ gradle/buildViaTravis.sh | 2 +- gradle/init-publish.gradle | 13 --------- gradle/installViaTravis.sh | 2 +- settings.gradle | 3 +- 6 files changed, 85 insertions(+), 44 deletions(-) create mode 100644 echo-bom/echo-bom.gradle delete mode 100644 gradle/init-publish.gradle diff --git a/build.gradle b/build.gradle index ec9eb4576..2536d0c29 100644 --- a/build.gradle +++ b/build.gradle @@ -29,16 +29,18 @@ buildscript { } allprojects { - group = "com.netflix.spinnaker.echo" - apply plugin: "spinnaker.base-project" - if (Boolean.valueOf(enablePublishing)) { - apply plugin: "spinnaker.project" - } + group = "com.netflix.spinnaker.echo" + apply plugin: "spinnaker.base-project" + if (Boolean.valueOf(enablePublishing)) { + apply plugin: "spinnaker.project" + } + + group = "com.netflix.spinnaker.echo" + if (name != "echo-bom") { apply plugin: "java-library" apply plugin: "groovy" apply plugin: 'jacoco' - group = "com.netflix.spinnaker.echo" test { testLogging { @@ -51,39 +53,41 @@ allprojects { jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8189' } } - + } } subprojects { + if (name != "echo-bom") { jacoco { - toolVersion = '0.8.3' + toolVersion = '0.8.3' } dependencies { - implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") - annotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") - testAnnotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") - compileOnly "org.projectlombok:lombok" - annotationProcessor "org.projectlombok:lombok" - testAnnotationProcessor "org.projectlombok:lombok" + implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") + annotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") + testAnnotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion") + compileOnly "org.projectlombok:lombok" + annotationProcessor "org.projectlombok:lombok" + testAnnotationProcessor "org.projectlombok:lombok" - implementation "org.codehaus.groovy:groovy-all" - implementation "com.github.ben-manes.caffeine:guava" - implementation "com.netflix.spectator:spectator-api" - implementation "org.slf4j:slf4j-api" - implementation "net.logstash.logback:logstash-logback-encoder" - implementation "org.springframework.boot:spring-boot-properties-migrator" + implementation "org.codehaus.groovy:groovy-all" + implementation "com.github.ben-manes.caffeine:guava" + implementation "com.netflix.spectator:spectator-api" + implementation "org.slf4j:slf4j-api" + implementation "net.logstash.logback:logstash-logback-encoder" + implementation "org.springframework.boot:spring-boot-properties-migrator" - testImplementation "org.spockframework:spock-core" + testImplementation "org.spockframework:spock-core" - testImplementation "org.springframework.boot:spring-boot-starter-test" - testImplementation "org.spockframework:spock-core" - testImplementation "org.spockframework:spock-spring" - testImplementation "org.springframework:spring-test" - testImplementation "org.hamcrest:hamcrest-core" - testRuntimeOnly "cglib:cglib-nodep" - testRuntimeOnly "org.objenesis:objenesis" + testImplementation "org.springframework.boot:spring-boot-starter-test" + testImplementation "org.spockframework:spock-core" + testImplementation "org.spockframework:spock-spring" + testImplementation "org.springframework:spring-test" + testImplementation "org.hamcrest:hamcrest-core" + testRuntimeOnly "cglib:cglib-nodep" + testRuntimeOnly "org.objenesis:objenesis" } + } } defaultTasks ':echo-web:run' diff --git a/echo-bom/echo-bom.gradle b/echo-bom/echo-bom.gradle new file mode 100644 index 000000000..3e2c789cd --- /dev/null +++ b/echo-bom/echo-bom.gradle @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Netflix, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: "java-platform" +apply plugin: "maven-publish" + +// without this building the pom fails when using the Nebula publishing plugin +configurations { + create("compileOnly") +} + +javaPlatform { + allowDependencies() +} + + +if (Boolean.valueOf(enablePublishing)) { + publishing { + publications { + nebula(MavenPublication) { + from components.javaPlatform + } + } + } +} + +dependencies { + api(platform("com.netflix.spinnaker.kork:kork-bom:${korkVersion}")) + + constraints { + rootProject + .subprojects + .findAll { it != project } + .each { api(project(it.path)) } + } +} diff --git a/gradle/buildViaTravis.sh b/gradle/buildViaTravis.sh index ba4581ec7..753dd50e0 100755 --- a/gradle/buildViaTravis.sh +++ b/gradle/buildViaTravis.sh @@ -1,7 +1,7 @@ #!/bin/bash # This script will build the project. -GRADLE="./gradlew -I gradle/init-publish.gradle" +GRADLE="./gradlew -PenablePublishing=true" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]" diff --git a/gradle/init-publish.gradle b/gradle/init-publish.gradle deleted file mode 100644 index 874765f70..000000000 --- a/gradle/init-publish.gradle +++ /dev/null @@ -1,13 +0,0 @@ -initscript { - repositories { - mavenLocal() - jcenter() - maven { url 'https://dl.bintray.com/spinnaker/gradle/' } - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath 'com.netflix.spinnaker.gradle:spinnaker-gradle-project:5.1.4' - } -} -// Can't use the plugin ID (spinnaker.project) on init scripts for some reason. -apply plugin: com.netflix.spinnaker.gradle.project.SpinnakerProjectPlugin diff --git a/gradle/installViaTravis.sh b/gradle/installViaTravis.sh index de696583d..37516444f 100755 --- a/gradle/installViaTravis.sh +++ b/gradle/installViaTravis.sh @@ -1,7 +1,7 @@ #!/bin/bash # This script will build the project. -GRADLE="./gradlew -I gradle/init-publish.gradle" +GRADLE="./gradlew -PenablePublishing=true" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo -e "Assemble Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]" diff --git a/settings.gradle b/settings.gradle index 00f582c9a..01d953529 100644 --- a/settings.gradle +++ b/settings.gradle @@ -26,7 +26,8 @@ include 'echo-artifacts', 'echo-pubsub-core', 'echo-pubsub-aws', 'echo-pubsub-google', - 'echo-test' + 'echo-test', + 'echo-bom' rootProject.name = 'echo'