-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
179 lines (150 loc) · 4.66 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
// mavenLocal()
}
dependencies {
classpath 'org.standardout:gradle-eclipseconfig:1.1.0'
classpath "com.gradle.publish:plugin-publish-plugin:0.9.6"
}
}
// Apply the groovy plugin to add support for Groovy
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'com.gradle.plugin-publish'
apply plugin: 'org.standardout.eclipseconfig' // applies 'eclipse' plugin automatically
eclipseconfig {
// codeTemplates = rootProject.file('codetemplates.xml')
jdtUI { properties ->
// make private fields final on save, if possible
properties.'sp_cleanup.make_variable_declarations_final' = true
properties.'sp_cleanup.make_private_fields_final' = true
}
}
group = 'org.standardout'
version = '1.2.0-SNAPSHOT'
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
repositories {
jcenter()
}
dependencies {
compile gradleApi()
compile localGroovy()
// right now uses artifact published on a different group,
// until an official artifact is available
// see https://github.com/editorconfig/editorconfig-core-java/issues/6
// compile 'org.editorconfig:editorconfig-core:0.12.1.Final-SNAPSHOT'
compile 'org.standardout.org.editorconfig:editorconfig-core:0.12.1.Final'
testCompile 'junit:junit:4.12'
}
// package groovydoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'groovydoc') {
from groovydoc.destinationDir
classifier = 'javadoc'
}
// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
// define artifacts for upload
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
def configurePom(def pom) {
// ensure correct artifact ID
pom.artifactId = 'gradle-eclipseconfig'
// pom file details
pom.project {
name 'gradle-eclipseconfig'
packaging 'jar'
description 'Gradle plugin for configuring basic editor settings for your Gradle generated Eclipse project, based on EditorConfig plus a couple of Eclipse specific settings like code templates.'
url 'https://github.com/stempler/gradle-eclipseconfig'
scm {
url 'scm:git:https://github.com/stempler/gradle-eclipseconfig.git'
connection 'scm:git:https://github.com/stempler/gradle-eclipseconfig.git'
developerConnection 'scm:git:https://github.com/stempler/gradle-eclipseconfig.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'stempler'
name 'Simon Templer'
email '[email protected]'
}
}
}
}
install {
repositories.mavenInstaller {
// ensure correct artifact ID when installing locally
configurePom(pom)
}
}
// sign all artifacts
signing {
required {
// NOTE: skipping does only work if no gradle properties specifying the key are present
gradle.taskGraph.hasTask('uploadArchives')
}
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
// sign artifacts before upload
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// upload to sonatype OSS (snapshot/release)
repository(url: this.version.endsWith('-SNAPSHOT') ?
'https://oss.sonatype.org/content/repositories/snapshots' :
'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: this.hasProperty('sonatypeUsername') ? sonatypeUsername : '',
password: this.hasProperty('sonatypePassword') ? sonatypePassword : '')
}
configurePom(pom)
}
}
}
// groovydoc task work-around
configurations {
jansi.extendsFrom(runtime)
}
groovydoc {
groovyClasspath = project.configurations.jansi
}
dependencies {
jansi 'org.fusesource.jansi:jansi:1.11'
}
// Gradle plugin publishing
pluginBundle {
website = 'https://github.com/stempler/gradle-eclipseconfig'
vcsUrl = 'https://github.com/stempler/gradle-eclipseconfig'
description = 'Plugin for configuring basic editor settings for your Gradle generated Eclipse project, based on EditorConfig plus a couple of Eclipse specific settings like code templates.'
tags = ['eclipse', 'editorconfig']
plugins {
eclipseconfigPlugin {
id = 'org.standardout.eclipseconfig'
displayName = 'Gradle Eclipse project configuration plugin'
}
}
mavenCoordinates {
groupId = 'org.standardout'
artifactId = 'gradle-eclipseconfig'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.0'
}