Skip to content

Commit 4b87106

Browse files
committed
Add gradle files to editorconfig
1 parent e2d5392 commit 4b87106

File tree

4 files changed

+138
-138
lines changed

4 files changed

+138
-138
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# see: http://EditorConfig.org
22
root = true
33

4-
[*.{java,css,js,json,ftl,txt,properties,xml}]
4+
[*.{gradle,java,css,js,json,ftl,txt,properties,xml}]
55
end_of_line = lf
66
insert_final_newline = true
77
trim_trailing_whitespace = true

build.gradle

+40-40
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
buildscript {
44
repositories {
5-
jcenter()
5+
jcenter()
66
}
77
}
88

99
plugins {
10-
id 'java'
11-
id 'maven'
12-
id 'signing'
13-
id 'eclipse'
14-
id 'idea'
15-
16-
// keep dependencies up-to-date!
17-
id 'com.github.ben-manes.versions' version '0.14.0'
18-
19-
// useful for creating immutable java beans
20-
id 'org.inferred.processors' version '1.2.3'
21-
22-
// to ensure clean code
23-
id "net.ltgt.errorprone" version "0.0.9"
24-
25-
// for deployment to Maven Central
26-
id "io.codearte.nexus-staging" version "0.6.1"
10+
id 'java'
11+
id 'maven'
12+
id 'signing'
13+
id 'eclipse'
14+
id 'idea'
15+
16+
// keep dependencies up-to-date!
17+
id 'com.github.ben-manes.versions' version '0.14.0'
18+
19+
// useful for creating immutable java beans
20+
id 'org.inferred.processors' version '1.2.3'
21+
22+
// to ensure clean code
23+
id "net.ltgt.errorprone" version "0.0.9"
24+
25+
// for deployment to Maven Central
26+
id "io.codearte.nexus-staging" version "0.6.1"
2727
}
2828

2929
group = 'com.arakelian'
@@ -34,34 +34,34 @@ apply from: "gradle/core.gradle"
3434
// only want to configure this if ~/.gradle/gradle.properties contains nexus username and password;
3535
// this snippet is used for deployment to Maven Central
3636
if (project.hasProperty('nexusUsername')) {
37-
// project-specific properties configured here; see core.gradle for general configuration
38-
uploadArchives {
39-
repositories {
40-
mavenDeployer {
41-
pom.project {
42-
url 'https://github.com/arakelian/docker-junit-rule'
43-
scm {
44-
connection 'scm:git:https://github.com/arakelian/docker-junit-rule.git'
45-
developerConnection 'scm:git:[email protected]:arakelian/docker-junit-rule.git'
46-
url 'https://github.com/arakelian/docker-junit-rule.git'
47-
}
48-
}
49-
}
50-
}
51-
}
37+
// project-specific properties configured here; see core.gradle for general configuration
38+
uploadArchives {
39+
repositories {
40+
mavenDeployer {
41+
pom.project {
42+
url 'https://github.com/arakelian/docker-junit-rule'
43+
scm {
44+
connection 'scm:git:https://github.com/arakelian/docker-junit-rule.git'
45+
developerConnection 'scm:git:[email protected]:arakelian/docker-junit-rule.git'
46+
url 'https://github.com/arakelian/docker-junit-rule.git'
47+
}
48+
}
49+
}
50+
}
51+
}
5252
}
5353

5454
dependencies {
55-
processor 'org.immutables:value:2.4.6'
55+
processor 'org.immutables:value:2.4.6'
5656

5757
compile 'junit:junit:4.12'
58-
compile 'com.spotify:docker-client:8.2.0'
58+
compile 'com.spotify:docker-client:8.2.0'
5959

60-
// need 2.22.2+ to fix bug which prevents jersey from exiting
61-
// see: https://github.com/spotify/docker-client/issues/405
62-
compile 'org.glassfish.jersey.core:jersey-client:2.25'
60+
// need 2.22.2+ to fix bug which prevents jersey from exiting
61+
// see: https://github.com/spotify/docker-client/issues/405
62+
compile 'org.glassfish.jersey.core:jersey-client:2.25'
6363

64-
// logging
64+
// logging
6565
testCompile 'org.apache.logging.log4j:log4j-api:2.8.1'
6666
testCompile 'org.apache.logging.log4j:log4j-core:2.8.1'
6767
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:2.8.1'
@@ -71,5 +71,5 @@ dependencies {
7171

7272
// for unit testing
7373
testCompile 'com.github.rholder:guava-retrying:2.0.0'
74-
testCompile 'com.rabbitmq:amqp-client:4.1.0'
74+
testCompile 'com.rabbitmq:amqp-client:4.1.0'
7575
}

gradle/core.gradle

+95-95
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ tasks.withType(JavaCompile) {
1313
// have to declare parameter names with @JsonCreator
1414
options.compilerArgs << "-parameters"
1515

16-
// Eclipse code formatting removes extraneous parenthesis which errorprone complains about
16+
// Eclipse code formatting removes extraneous parenthesis which errorprone complains about
1717
if (project.plugins.hasPlugin('net.ltgt.errorprone')) {
18-
options.compilerArgs << '-Xep:OperatorPrecedence:OFF'
18+
options.compilerArgs << '-Xep:OperatorPrecedence:OFF'
1919
}
2020
}
2121

2222
ext {
2323
// list of dependencies that we want to replace with Eclipse project refs;
24-
// we automatically add all Gradle projects that are sibling directories to this project.
24+
// we automatically add all Gradle projects that are sibling directories to this project.
2525
// NOTE: dependencies list here that end with a hyphen match modules that starting with that prefix.
2626
use_eclipse_project_refs = []
27-
27+
2828
// useful shortcuts
2929
buildAliases = [
3030
'all' : ['clean', 'classpath', 'build', 'install'],
31-
'deploy' : ['upload', 'closeAndPromoteRepository']
32-
]
31+
'deploy' : ['upload', 'closeRepository']
32+
]
3333
}
3434

3535
task javadocJar(type: Jar, dependsOn:classes) {
@@ -38,19 +38,19 @@ task javadocJar(type: Jar, dependsOn:classes) {
3838
}
3939

4040
task sourcesJar(type:Jar, dependsOn:classes) {
41-
classifier = 'sources'
42-
from sourceSets.main.allSource
41+
classifier = 'sources'
42+
from sourceSets.main.allSource
4343
}
4444

4545
task testJar(type:Jar, dependsOn:testClasses) {
46-
classifier = 'tests'
47-
from sourceSets.test.output
46+
classifier = 'tests'
47+
from sourceSets.test.output
4848
}
4949

5050
artifacts {
51-
archives javadocJar
52-
archives sourcesJar
53-
archives testJar
51+
archives javadocJar
52+
archives sourcesJar
53+
archives testJar
5454
}
5555

5656
repositories {
@@ -114,22 +114,22 @@ eclipse {
114114
// closure executed after .classpath content is loaded from existing file
115115
// and after gradle build information is merged
116116
whenMerged { classpath ->
117-
117+
118118
// build list of dependencies that we want to replace with Eclipse project refs
119-
println 'Finding local projects'
120-
def use_eclipse_project_refs = []
121-
new File("${projectDir}/..").eachDir {
122-
if(new File("${it}/build.gradle").exists()) {
123-
use_eclipse_project_refs += it.name
124-
}
125-
}
126-
127-
println 'Generating Eclipse .classpath file'
128-
def kindOrder = [ 'src':1, 'con':2, 'lib':3, 'output':0 ];
129-
classpath.entries.sort(true, { a,b ->
130-
def order = kindOrder[a.kind] <=> kindOrder[b.kind]
131-
order != 0 ? order : a.path <=> b.path
132-
} as Comparator).each { entry ->
119+
println 'Finding local projects'
120+
def use_eclipse_project_refs = []
121+
new File("${projectDir}/..").eachDir {
122+
if(new File("${it}/build.gradle").exists()) {
123+
use_eclipse_project_refs += it.name
124+
}
125+
}
126+
127+
println 'Generating Eclipse .classpath file'
128+
def kindOrder = [ 'src':1, 'con':2, 'lib':3, 'output':0 ];
129+
classpath.entries.sort(true, { a,b ->
130+
def order = kindOrder[a.kind] <=> kindOrder[b.kind]
131+
order != 0 ? order : a.path <=> b.path
132+
} as Comparator).each { entry ->
133133
if(entry.kind.equals('lib')) {
134134
use_eclipse_project_refs.each { name ->
135135
def regex = '/(' + ( name.endsWith('-') ?
@@ -166,76 +166,76 @@ task classpath(dependsOn: ['cleanEclipseClasspath', 'eclipseClasspath', 'eclipse
166166
}
167167

168168
task generateGitProperties {
169-
doLast {
170-
def branch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
171-
def revision = 'git rev-list --max-count 1 --timestamp --abbrev-commit HEAD'.execute().text.trim()
172-
def commitHash = revision.split(' ').last()
173-
def timestamp = revision ? new java.util.Date(java.util.concurrent.TimeUnit.SECONDS.toMillis(revision.split(' ').first() as long)).format("yyyy-MM-dd'T'HH:mm:ssZ") : null
174-
175-
File resourcesDir = new File(project.getBuildDir(), 'resources/main')
176-
File propertiesFile = new File(resourcesDir, 'git.properties')
177-
if(!propertiesFile.exists()) {
178-
resourcesDir.mkdirs()
179-
propertiesFile.createNewFile()
180-
}
181-
182-
def newline = System.getProperty('line.separator')
183-
propertiesFile.text = "git.branch=${branch}${newline}" +
184-
"git.commit.id=${commitHash}${newline}" +
185-
"git.commit.time=${timestamp}${newline}" +
186-
"api.version=${project.version}${newline}"
187-
}
169+
doLast {
170+
def branch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
171+
def revision = 'git rev-list --max-count 1 --timestamp --abbrev-commit HEAD'.execute().text.trim()
172+
def commitHash = revision.split(' ').last()
173+
def timestamp = revision ? new java.util.Date(java.util.concurrent.TimeUnit.SECONDS.toMillis(revision.split(' ').first() as long)).format("yyyy-MM-dd'T'HH:mm:ssZ") : null
174+
175+
File resourcesDir = new File(project.getBuildDir(), 'resources/main')
176+
File propertiesFile = new File(resourcesDir, 'git.properties')
177+
if(!propertiesFile.exists()) {
178+
resourcesDir.mkdirs()
179+
propertiesFile.createNewFile()
180+
}
181+
182+
def newline = System.getProperty('line.separator')
183+
propertiesFile.text = "git.branch=${branch}${newline}" +
184+
"git.commit.id=${commitHash}${newline}" +
185+
"git.commit.time=${timestamp}${newline}" +
186+
"api.version=${project.version}${newline}"
187+
}
188188
}
189189

190190
if (project.hasProperty('nexusUsername')) {
191-
signing {
192-
sign configurations.archives
193-
}
194-
195-
uploadArchives {
196-
repositories {
197-
// see: http://central.sonatype.org/pages/gradle.html
198-
mavenDeployer {
199-
beforeDeployment {
200-
MavenDeployment deployment -> signing.signPom(deployment)
201-
}
202-
203-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
204-
authentication(userName: nexusUsername, password: nexusPassword)
205-
}
206-
207-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
208-
authentication(userName: nexusUsername, password: nexusPassword)
209-
}
210-
211-
pom.project {
212-
name project.name
213-
packaging 'jar'
214-
description project.description
215-
216-
licenses {
217-
license {
218-
name 'Apache License 2.0'
219-
url 'https://www.apache.org/licenses/LICENSE-2.0'
220-
distribution 'repo'
221-
}
222-
}
223-
224-
developers {
225-
developer {
226-
id = 'arakelian'
227-
name = 'Greg Arakelian'
228-
229-
}
230-
}
231-
}
232-
}
233-
}
234-
}
235-
}
236-
237-
238-
// This code allows us to define aliases, such as "all", so that when we do "gradle all",
191+
signing {
192+
sign configurations.archives
193+
}
194+
195+
uploadArchives {
196+
repositories {
197+
// see: http://central.sonatype.org/pages/gradle.html
198+
mavenDeployer {
199+
beforeDeployment {
200+
MavenDeployment deployment -> signing.signPom(deployment)
201+
}
202+
203+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
204+
authentication(userName: nexusUsername, password: nexusPassword)
205+
}
206+
207+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
208+
authentication(userName: nexusUsername, password: nexusPassword)
209+
}
210+
211+
pom.project {
212+
name project.name
213+
packaging 'jar'
214+
description project.description
215+
216+
licenses {
217+
license {
218+
name 'Apache License 2.0'
219+
url 'https://www.apache.org/licenses/LICENSE-2.0'
220+
distribution 'repo'
221+
}
222+
}
223+
224+
developers {
225+
developer {
226+
id = 'arakelian'
227+
name = 'Greg Arakelian'
228+
229+
}
230+
}
231+
}
232+
}
233+
}
234+
}
235+
}
236+
237+
238+
// This code allows us to define aliases, such as "all", so that when we do "gradle all",
239239
// we can substitute in a series of other gradle tasks
240240
//
241241
// see: https://caffeineinduced.wordpress.com/2015/01/25/run-a-list-of-gradle-tasks-in-specific-order/

settings.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
buildscript {
2-
repositories {
2+
repositories {
33
maven {
44
url 'https://plugins.gradle.org/m2/'
55
}
6-
}
6+
}
77
dependencies {
88
classpath 'gradle.plugin.net.vivin:gradle-semantic-build-versioning:3.0.4'
99
}

0 commit comments

Comments
 (0)