forked from jiakuan/gwt-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
197 lines (170 loc) · 5.3 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
import org.gradle.plugins.ide.eclipse.model.AbstractLibrary
import org.gradle.plugins.ide.eclipse.model.ClasspathEntry
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'eclipse'
// https://plugins.gradle.org/plugin/net.researchgate.release
id 'net.researchgate.release' version '3.0.0'
// For publishing the plugin to the Gradle Plugin Portal
id 'java-gradle-plugin'
// https://plugins.gradle.org/plugin/com.gradle.plugin-publish
id "com.gradle.plugin-publish" version "1.0.0"
}
group = 'org.docstr'
version = "$version"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories { mavenCentral() }
dependencies {
implementation gradleApi()
testImplementation group: 'junit', name: 'junit', version: '4.11'
}
ext {
encoding = 'UTF-8'
}
// Change the output directory for the main source set back to the old path
sourceSets.main.java.outputDir = new File(buildDir, "classes/main")
sourceSets.test.java.outputDir = new File(buildDir, "classes/test")
pluginBundle {
website = 'http://gwt-gradle-plugin.documentnode.io'
vcsUrl = 'https://github.com/jiakuan/gwt-gradle-plugin'
tags = ['gwt', 'gwt-gradle']
}
gradlePlugin {
plugins {
gwtGradlePlugin {
id = 'org.docstr.gwt'
displayName = 'GWT Gradle Plugin'
description = 'Gradle plugin to support GWT related tasks.'
implementationClass = 'org.docstr.gradle.plugins.gwt.GwtPlugin'
}
gwtBaseGradlePlugin {
id = 'org.docstr.gwt.base'
displayName = 'GWT Base Gradle Plugin'
description = 'Gradle plugin to support GWT related tasks.'
implementationClass = 'org.docstr.gradle.plugins.gwt.GwtBasePlugin'
}
gwtCompilerGradlePlugin {
id = 'org.docstr.gwt.compiler'
displayName = 'GWT Compiler Gradle Plugin'
description = 'Gradle plugin to support GWT related tasks.'
implementationClass = 'org.docstr.gradle.plugins.gwt.GwtCompilerPlugin'
}
gwtWarGradlePlugin {
id = 'org.docstr.gwt.war'
displayName = 'GWT War Gradle Plugin'
description = 'Gradle plugin to support GWT related tasks.'
implementationClass = 'org.docstr.gradle.plugins.gwt.GwtWarPlugin'
}
}
}
eclipse {
classpath {
file {
whenMerged { org.gradle.plugins.ide.eclipse.model.Classpath cp ->
String gradleHome = gradle.getGradleHomeDir().absolutePath.replace(File.separator, '/')
String gradleSrc = "${gradleHome}/src"
cp.entries.each { ClasspathEntry entry ->
if ((entry in AbstractLibrary) && (entry.library.file.name.startsWith('gradle-'))) {
entry.sourcePath = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory().fromPath(gradleSrc)
}
}
}
}
}
}
ext.userHome = System.getProperty("user.home")
javadoc {
// Avoid error: cannot access external classes
options.addStringOption("sourcepath", "")
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
java {
withJavadocJar()
withSourcesJar()
}
artifacts {
archives sourcesJar
archives javadocJar
}
signing {
sign publishing.publications
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
def ossrU = project.hasProperty("ossrhUsername") ? ossrhUsername : ""
def ossrP = project.hasProperty("ossrhPassword") ? ossrhPassword : ""
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'GWT Gradle Plugin'
description = 'Gradle plugin to support GWT (http://www.gwtproject.org/) related tasks.'
url = 'https://github.com/jiakuan/gwt-gradle-plugin/'
packaging = 'jar'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'jiakuan'
name = 'Jiakuan Wang'
email = '[email protected]'
organization = 'Document Node'
organizationUrl = 'https://documentnode.io'
}
}
scm {
connection = 'scm:git:[email protected]:jiakuan/gwt-gradle-plugin.git'
developerConnection = 'scm:git:[email protected]:jiakuan/gwt-gradle-plugin.git'
url = '[email protected]:jiakuan/gwt-gradle-plugin.git'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrU
password = ossrP
}
}
}
}
tasks.eclipse.doLast {
File prefs = project.file('.settings/org.eclipse.core.resources.prefs');
if (!prefs.exists()) {
prefs.parentFile.mkdirs()
project.file('.settings/org.eclipse.core.resources.prefs') << "eclipse.preferences.version=1\nencoding/<project>=$encoding\n";
}
}
tasks['eclipse'].doLast {
mkdir 'build/pluginUnderTestMetadata'
}