Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Clean up Gradle build scripts, move config to root project #287

Merged
merged 2 commits into from Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 46 additions & 10 deletions build.gradle
@@ -1,29 +1,65 @@
import groovy.json.JsonSlurper
import groovy.transform.Canonical

plugins {
id "io.spring.dependency-management" version "1.0.3.RELEASE" apply false

id 'com.diffplug.gradle.spotless' version '2.4.1' apply false
id 'net.ltgt.apt' version '0.13' apply false
id 'com.commercehub.cucumber-jvm' version '0.12' apply false
}

group 'com.amazonaws.blox'
version '0.1-SNAPSHOT'
description "Blox: Open Source schedulers for Amazon ECS"

buildscript {
allprojects {
apply plugin: 'com.diffplug.gradle.spotless'

repositories {
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
}

subprojects {
apply plugin: 'io.spring.dependency-management'

dependencies {
classpath 'com.diffplug.gradle.spotless:spotless:2.4.1'
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.215'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need both sdk version or is this so we don't have to refactor code that doesn't use v2 now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is so that we don't have to refactor the parts of the dataservice that still depend on V1 now.


mavenBom 'software.amazon.awssdk:bom:2.0.0-preview-4'
}
dependencies {
// The software.amazon.awssdk:bom incorrectly exports an old
// version of Mockito, so we have to override it to the version we
// want here:
dependency 'org.mockito:mockito-core:2.10+'

dependencySet(group: 'org.springframework', version: '4.3.10.RELEASE') {
entry 'spring-core'
entry 'spring-beans'
entry 'spring-context'
entry 'spring-test'
}
dependencySet(group: 'org.slf4j', version: '1.7.+') {
entry 'slf4j-api'
entry 'jcl-over-slf4j'
}
dependencySet(group: 'org.mapstruct', version: '1.2.0.CR2') {
entry 'mapstruct-jdk8'
entry 'mapstruct-processor'
}

dependency 'org.projectlombok:lombok:1.16.18'
}
}
}

def unformattedProjects = [
'frontend-infrastructure',
'frontend-service-client'
]

allprojects {
apply plugin: 'com.diffplug.gradle.spotless'
}

configure(subprojects.findAll { !unformattedProjects.contains(it.name) }) {
spotless {
java {
Expand All @@ -34,7 +70,7 @@ configure(subprojects.findAll { !unformattedProjects.contains(it.name) }) {
}

wrapper {
gradleVersion = '4.0.2'
gradleVersion = '4.3'

// The 'all' distribution includes files that allow IntelliJ to provide
// additional context information in build.gradle files:
Expand Down
9 changes: 7 additions & 2 deletions buildSrc/build.gradle
@@ -1,6 +1,8 @@
description "Custom build logic for building Blox"
plugins {
id "java"
}

apply plugin: 'java'
description "Custom build logic for building Blox"

sourceCompatibility = 1.8

Expand All @@ -20,6 +22,9 @@ dependencies {
exclude group: 'com.github.jknack', module: 'handlebars'
}

// Since the `buildSrc` project must be configured and built before the
// main project, we can't rely on the dependencyManagement declared in the
// main build.gradle: specify all dependency versions explicitly.
compileOnly 'org.projectlombok:lombok:1.16.18'

testCompile group: 'junit', name: 'junit', version: '4.12'
Expand Down
10 changes: 3 additions & 7 deletions data-service-client/build.gradle
@@ -1,18 +1,14 @@
plugins {
id 'java'
id "java"
}

description 'Blox DataService Client'

repositories {
mavenCentral()
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.16.18'
compileOnly 'org.projectlombok:lombok'

compile(
project(":data-service-model"),
project(":json-rpc-lambda-client"),
)
}
}
14 changes: 6 additions & 8 deletions data-service-model/build.gradle
@@ -1,14 +1,12 @@
description 'Shared POJOs and interfaces for the Blox DataService'

apply plugin: 'java'

repositories {
mavenCentral()
plugins {
id "java"
}

description 'Shared POJOs and interfaces for the Blox DataService'

dependencies {
// Needed for serialization of JDK8's Instant data type
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:+'

compileOnly 'org.projectlombok:lombok:1.16.18'
}
compileOnly 'org.projectlombok:lombok'
}
37 changes: 5 additions & 32 deletions data-service/build.gradle
@@ -1,37 +1,10 @@
plugins {
id "java"
id 'net.ltgt.apt' version '0.11'
id "io.spring.dependency-management" version "1.0.3.RELEASE"
id 'net.ltgt.apt'
}

description "Implementation of the Blox DataService"

repositories {
mavenCentral()
}

dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.215'
}
dependencies {
dependencySet(group: 'org.springframework', version: '4.3.10.RELEASE') {
entry 'spring-core'
entry 'spring-beans'
entry 'spring-context'
entry 'spring-test'
}
dependencySet(group: 'org.slf4j', version: '1.7.+') {
entry 'slf4j-api'
entry 'jcl-over-slf4j'
}
dependencySet(group: 'org.mapstruct', version: '1.2.0.CR2') {
entry 'mapstruct-jdk8'
entry 'mapstruct-processor'
}
}
}

compileJava {
options.compilerArgs = [
'-Amapstruct.defaultComponentModel=spring'
Expand Down Expand Up @@ -71,7 +44,7 @@ dependencies {
'org.apache.logging.log4j:log4j-slf4j-impl:2.8.+',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move logging to dep management too? since there's no reason to use different versions across projects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; I'll do that as part of the bigger logging cleanup to move to slf4j everywhere.

'org.apache.commons:commons-lang3:3.6',

'org.projectlombok:lombok:1.16.18',
'org.projectlombok:lombok',

'org.mapstruct:mapstruct-jdk8',

Expand All @@ -85,7 +58,7 @@ dependencies {
testCompile(
'junit:junit:4.12',
'org.hamcrest:hamcrest-junit:2.+',
'org.mockito:mockito-core:2.10.+',
'org.mockito:mockito-core',
'org.slf4j:slf4j-api',
'org.slf4j:jcl-over-slf4j',
'org.springframework:spring-test'
Expand All @@ -104,7 +77,7 @@ dependencies {
)

apt 'org.mapstruct:mapstruct-processor'
apt 'org.projectlombok:lombok:1.16.18'
apt 'org.projectlombok:lombok'
}


Expand Down Expand Up @@ -138,4 +111,4 @@ task deploy {
"--capabilities", "CAPABILITY_IAM")
}
}
}
}
10 changes: 4 additions & 6 deletions end-to-end-tests/build.gradle
@@ -1,14 +1,12 @@
plugins {
id "java"
}

group 'com.amazonaws.blox'
version '0.1-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile project(":frontend-service-client")
compile project(":data-service-model")
Expand Down
16 changes: 7 additions & 9 deletions frontend-service/build.gradle
Expand Up @@ -5,12 +5,6 @@ import io.swagger.models.Info
import com.amazonaws.blox.swagger.ApiGatewayExtensionsFilter
import com.amazonaws.blox.swagger.SwaggerFilter

description "Lambda-backed API Gateway API for the Blox Frontend Service"

apply plugin: 'java'

sourceCompatibility = 1.8

buildscript {
repositories {
mavenCentral()
Expand All @@ -21,10 +15,14 @@ buildscript {
}
}

repositories {
mavenCentral()
plugins {
id 'java'
}

description "Lambda-backed API Gateway API for the Blox Frontend Service"

sourceCompatibility = 1.8

dependencies {
// basic Lambda handler support
compile 'com.amazonaws:aws-lambda-java-core:1.+'
Expand All @@ -36,7 +34,7 @@ dependencies {
// extra swagger annotations for defining API properties in code
compile "io.swagger:swagger-annotations:${swaggerVersion}"

compileOnly 'org.projectlombok:lombok:1.16.18'
compileOnly 'org.projectlombok:lombok'

testCompile group: 'junit', name: 'junit', version: '4.12'
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Tue Aug 15 13:21:19 PDT 2017
#Mon Nov 06 11:48:17 PST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
24 changes: 3 additions & 21 deletions integ-tests/build.gradle
@@ -1,32 +1,14 @@
plugins {
id 'java'
id "com.github.samueltbrown.cucumber" version "0.9"
id "io.spring.dependency-management" version "1.0.3.RELEASE"
id "com.commercehub.cucumber-jvm"
}

dependencyManagement {
imports {
mavenBom 'software.amazon.awssdk:bom:2.0.0-preview-4'
}
dependencies {
dependencySet(group: 'org.springframework', version: '4.3.10.RELEASE') {
entry 'spring-core'
entry 'spring-beans'
entry 'spring-context'
entry 'spring-test'
}
dependencySet(group: 'org.slf4j', version: '1.7.+') {
entry 'slf4j-api'
entry 'jcl-over-slf4j'
}
}
}


repositories {
mavenCentral()
}

addCucumberSuite 'cucumber'

cucumber {
tags = ["~@ignore"]
}
Expand Down
16 changes: 6 additions & 10 deletions json-rpc-lambda-client/build.gradle
@@ -1,17 +1,13 @@
description 'Blox DataService Client'

apply plugin: 'java'

repositories {
mavenCentral()
plugins {
id "java"
}

description 'Blox DataService Client'

dependencies {
compile "com.github.briandilley.jsonrpc4j:jsonrpc4j:+"

// TODO: Move dependencyManagement block to the root project so that
// we don't have to depend on a specific SDK version here:
compile "software.amazon.awssdk:lambda:+"
compile "software.amazon.awssdk:lambda"

compileOnly "org.projectlombok:lombok:1.16.18"
compileOnly "org.projectlombok:lombok"
}
10 changes: 4 additions & 6 deletions json-rpc-lambda-server/build.gradle
@@ -1,14 +1,12 @@
plugins {
id "java"
}

group 'com.amazonaws.blox'
version '0.1-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile "com.github.briandilley.jsonrpc4j:jsonrpc4j:+"
compile 'com.amazonaws:aws-lambda-java-core:1.+'
Expand Down
10 changes: 4 additions & 6 deletions lambda-spring/build.gradle
@@ -1,14 +1,12 @@
plugins {
id "java"
}

group 'com.amazonaws.blox'
version '0.1-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
// TODO: Move dependencyManagement blocks to root project so we can
// omit version number for these dependencies:
Expand Down