forked from eriwen/gradle-js-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
214 lines (185 loc) · 5.49 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.eriwen:gradle-cobertura-plugin:1.1.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.3'
}
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'cobertura'
apply plugin: 'bintray'
sourceCompatibility = 1.6
targetCompatibility = 1.6
defaultTasks 'clean', 'build'
version = '1.12.1'
group = 'com.eriwen'
ext.archivesBaseName = 'gradle-js-plugin'
ext.isSnapshot = version.endsWith("-SNAPSHOT")
repositories {
mavenCentral()
}
dependencies {
compile localGroovy()
compile gradleApi()
compile ('com.google.javascript:closure-compiler:v20131014') {
exclude module: 'junit'
}
compile ('io.jdev.html2js:html2js:0.1')
testCompile ('org.spockframework:spock-core:0.7-groovy-1.8') {
exclude module: 'junit-dep'
exclude module: 'groovy-all'
}
}
idea.module {
ext.gradleCacheVariable = 'GRADLE_CACHE'
ext.downloadJavadoc = true
ext.downloadSource = true
outputDir = file('intellij/out')
testOutputDir = file('intellij/testOut')
}
idea.project.ipr.withXml { provider ->
def node = provider.asNode()
// Use git
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
vcsConfig.mapping[0].'@vcs' = 'Git'
// Set gradle home
def gradleSettings = node.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir.absolutePath])
// Add gradle IDE support
def gradleUISettings = node.appendNode('component', [name: 'GradleUISettings'])
gradleUISettings.appendNode('setting', [name: 'root'])
def gradleUISettings2 = node.appendNode('component', [name: 'GradleUISettings2'])
gradleUISettings2.appendNode('setting', [name: 'root'])
}
compileGroovy {
options.compilerArgs = ['-Xlint:deprecation', '-Xlint:unchecked']
}
task sourceJar(type: Jar) {
description = 'An archive of the source code for Maven Central'
classifier = 'sources'
from sourceSets.main.groovy
}
task groovydocJar(type: Jar) {
description = 'An archive of the GroovyDocs for Maven Central'
classifier = 'javadoc'
from groovydoc
}
cobertura {
format = 'html'
includes = ['**/*.java', '**/*.groovy']
excludes = ['**/commonJs/**/*.*']
}
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
artifacts {
archives groovydocJar, sourceJar
}
publishing {
publications {
mavenJava(MavenPublication) {
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}
artifact sourceJar {
classifier 'sources'
}
artifact groovydocJar {
classifier 'javadoc'
}
}
}
}
signing {
sign configurations.archives
}
bintray {
user = System.properties['bintrayUsername']
key = System.properties['bintrayApiKey']
publications = ['mavenJava']
pkg {
repo = 'gradle-plugins'
name = 'gradle-js-plugin'
desc = 'Gradle plugin for working with JS.'
licenses = ['Apache-2.0']
labels = ['gradle', 'js']
}
}
test {
testLogging {
stackTraceFilters 'truncate', 'groovy'
events 'passed', 'skipped', 'failed'
exceptionFormat = 'full'
}
}
// Only *require* signing if we are uploading a non snapshot version
gradle.taskGraph.whenReady { taskGraph ->
tasks.withType(org.gradle.plugins.signing.Sign).all {
required = taskGraph.hasTask(":uploadArchives") && !isSnapshot
}
}
install.repositories.mavenInstaller {
pom.project(pomConfiguration)
if (signing.signatory) {
beforeDeployment { signing.signPom(it) }
}
}
uploadArchives {
repositories.mavenDeployer {
if (signing.signatory) {
beforeDeployment { signPom(it) }
}
name = 'mavenCentralReleaseDeployer'
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: System.properties['mavenCentralUsername'], password: System.properties['mavenCentralPassword'])
releases(updatePolicy: 'always')
snapshots(updatePolicy: 'always')
}
pom.project(pomConfiguration)
}
}
/**
* Create POM config and return for use by other tasks.
*/
def getPomConfiguration() {
return {
name 'Gradle JS Plugin'
packaging 'jar'
description 'A Gradle plugin for working with JS.'
url 'https://github.com/eriwen/gradle-js-plugin'
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 'eriwen'
name 'Eric Wendelin'
email 'me@eriwen.com'
}
}
scm {
connection 'scm:https://eriwen@github.com/eriwen/gradle-js-plugin'
developerConnection 'scm:git@github.com:eriwen/gradle-js-plugin.git'
url 'https://github.com/eriwen/gradle-js-plugin'
}
}
}
// download dependencies all at once, keeps downloads out of travis output
task resolveAllDependencies {
doLast {
configurations.all { it.resolve() }
}
}