1
1
buildscript {
2
2
dependencies {
3
3
classpath ' org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
4
- classpath ' junit:junit:4.12'
5
- classpath " com.gradle.publish:plugin-publish-plugin:0.9.7"
4
+ classpath " com.gradle.publish:plugin-publish-plugin:0.12.0"
6
5
}
7
6
repositories {
8
7
maven { url " http://repository.jboss.org/nexus/content/groups/public/" }
@@ -15,13 +14,14 @@ buildscript {
15
14
}
16
15
17
16
plugins {
18
- id ' java'
17
+ id ' java-gradle-plugin '
19
18
id ' groovy'
20
19
id ' maven'
21
20
id ' maven-publish'
22
21
id " org.datlowe.maven-publish-auth" version " 2.0.2"
23
- id " com.gradle.plugin-publish" version " 0.11 .0"
22
+ id " com.gradle.plugin-publish" version " 0.12 .0"
24
23
id ' signing'
24
+ id ' eclipse'
25
25
}
26
26
27
27
defaultTasks ' clean' , ' check' , ' assemble'
@@ -49,7 +49,22 @@ dependencies {
49
49
implementation localGroovy()
50
50
51
51
implementation group : ' org.jsweet' , name : ' jsweet-transpiler' , version : project. version
52
- implementation group : ' org.codehaus.plexus' , name : ' plexus-utils' , version :' 3.0.20'
52
+ implementation group : ' org.codehaus.plexus' , name : ' plexus-utils' , version :' 3.3.0'
53
+
54
+ // test kit
55
+ testImplementation gradleTestKit()
56
+
57
+ testImplementation " org.junit.jupiter:junit-jupiter-api:5.7.0"
58
+ testImplementation " org.junit.jupiter:junit-jupiter-params:5.7.0"
59
+
60
+ testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:5.7.0"
61
+ testRuntimeOnly " org.junit.platform:junit-platform-launcher:1.7.0"
62
+
63
+ }
64
+
65
+ test {
66
+ useJUnitPlatform()
67
+ testLogging. showStandardStreams = false
53
68
}
54
69
55
70
task sourceJar (type : Jar ) {
@@ -122,11 +137,60 @@ pluginBundle {
122
137
vcsUrl = ' https://github.com/cincheo/jsweet'
123
138
description = ' JSweet Gradle plugin'
124
139
tags = [' jsweet' , ' transpiler' , ' java' , ' web' , ' typescript' , ' typescript' , ' gradle' ]
140
+ }
141
+
142
+ gradlePlugin {
143
+ // Define the plugin
144
+ plugins {
145
+ jsweetPlugin {
146
+ id = ' org.jsweet.jsweet-gradle-plugin'
147
+ displayName = ' JSweet Gradle plugin'
148
+ implementationClass = ' org.jsweet.gradle.JSweetPlugin'
149
+ }
150
+ }
151
+ }
152
+
153
+ wrapper {
154
+ gradleVersion = " 6.7.1"
155
+ distributionType = Wrapper.DistributionType . ALL
156
+ }
125
157
126
- plugins {
127
- jsweetPlugin {
128
- id = ' org.jsweet.jsweet-gradle-plugin'
129
- displayName = ' JSweet Gradle plugin'
130
- }
131
- }
158
+ // This block is neccessary to get Gradle's source code available when working on this project. This helps the development process tremendously.
159
+ // See: http://stackoverflow.com/questions/22694199/gradle-api-sources-and-doc-when-writing-gradle-plugins/25305938#25305938
160
+ import org.gradle.plugins.ide.eclipse.model.*
161
+ eclipse {
162
+ classpath {
163
+ file {
164
+ whenMerged {Classpath cp ->
165
+ File gradleHome = gradle. getGradleHomeDir()
166
+ logger. warn " Using Gradle: ${ gradleHome} "
167
+
168
+ AbstractLibrary gradleApiLibrary = cp. entries. find { it. path. contains ' gradle-api' }
169
+ if (gradleApiLibrary != null ) {
170
+ File gradleSrc = new File (gradleHome, ' src' )
171
+ if (! gradleSrc. exists()) {
172
+ // Eclipse launched gradle with the bin distribution, look for the all distribution.
173
+ File gradleAll = new File (gradle. getGradleHomeDir(). getParentFile(). getParentFile(). absolutePath. replace(' -bin' , ' -all' ))
174
+ if (gradleAll. exists()) {
175
+ logger. debug " Found gradle-all: ${ gradleAll} "
176
+ File gradleAllCurrent = gradleAll. listFiles(). iterator(). next()
177
+ if (gradleAllCurrent. exists()) {
178
+ logger. debug " Found gradle-all current: ${ gradleAllCurrent} "
179
+ gradleSrc = new File (gradleAllCurrent, " gradle-${ gradle.gradleVersion} /src" )
180
+ }
181
+ }
182
+ }
183
+
184
+ if (gradleSrc. exists()) {
185
+ gradleApiLibrary. sourcePath = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory (). fromFile(gradleSrc)
186
+ logger. warn " Gradle's source found and included from: ${ gradleSrc} "
187
+ logger. debug " Updated library entry: ${ gradleApiLibrary} "
188
+ } else {
189
+ logger. warn " Gradle's source not included as it was not found at: ${ gradleSrc} "
190
+ logger. warn " Update to the 'all' distribution with:\n > gradlew :wrapper --gradle-version=${ gradle.gradleVersion} --distribution-type=all"
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
132
196
}
0 commit comments