16
16
* specific language governing permissions and limitations
17
17
* under the License.
18
18
*/
19
+
19
20
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
21
+ import org.apache.tools.ant.taskdefs.condition.Os
20
22
import org.elasticsearch.gradle.BuildPlugin
21
23
import org.elasticsearch.gradle.LoggedExec
22
24
import org.elasticsearch.gradle.Version
23
25
import org.elasticsearch.gradle.VersionCollection
24
26
import org.elasticsearch.gradle.VersionProperties
27
+ import org.elasticsearch.gradle.plugin.PluginBuildPlugin
25
28
import org.gradle.plugins.ide.eclipse.model.SourceFolder
26
- import org.gradle.util.GradleVersion
27
- import org.gradle.util.DistributionLocator
28
- import org.apache.tools.ant.taskdefs.condition.Os
29
- import org.apache.tools.ant.filters.ReplaceTokens
30
29
31
30
import java.nio.file.Files
32
31
import java.nio.file.Path
33
- import java.security.MessageDigest
34
32
35
33
plugins {
36
34
id ' com.gradle.build-scan' version ' 1.13.2'
@@ -87,8 +85,15 @@ subprojects {
87
85
}
88
86
}
89
87
}
88
+ repositories {
89
+ maven {
90
+ name = ' localTest'
91
+ url = " ${ rootProject.buildDir} /local-test-repo"
92
+ }
93
+ }
90
94
}
91
95
}
96
+
92
97
plugins. withType(BuildPlugin ). whenPluginAdded {
93
98
project. licenseFile = project. rootProject. file(' licenses/APACHE-LICENSE-2.0.txt' )
94
99
project. noticeFile = project. rootProject. file(' NOTICE.txt' )
@@ -228,6 +233,7 @@ subprojects {
228
233
" org.elasticsearch.client:elasticsearch-rest-high-level-client:${ version} " : ' :client:rest-high-level' ,
229
234
" org.elasticsearch.client:test:${ version} " : ' :client:test' ,
230
235
" org.elasticsearch.client:transport:${ version} " : ' :client:transport' ,
236
+ " org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${ version} " : ' :modules:lang-painless:spi' ,
231
237
" org.elasticsearch.test:framework:${ version} " : ' :test:framework' ,
232
238
" org.elasticsearch.distribution.integ-test-zip:elasticsearch:${ version} " : ' :distribution:archives:integ-test-zip' ,
233
239
" org.elasticsearch.distribution.zip:elasticsearch:${ version} " : ' :distribution:archives:zip' ,
@@ -296,7 +302,7 @@ subprojects {
296
302
// org.elasticsearch:elasticsearch must be the last one or all the links for the
297
303
// other packages (e.g org.elasticsearch.client) will point to server rather than
298
304
// their own artifacts.
299
- if (project. plugins. hasPlugin(BuildPlugin )) {
305
+ if (project. plugins. hasPlugin(BuildPlugin ) || project . plugins . hasPlugin( PluginBuildPlugin ) ) {
300
306
String artifactsHost = VersionProperties . elasticsearch. isSnapshot() ? " https://snapshots.elastic.co" : " https://artifacts.elastic.co"
301
307
Closure sortClosure = { a , b -> b. group <=> a. group }
302
308
Closure depJavadocClosure = { shadowed , dep ->
@@ -314,13 +320,6 @@ subprojects {
314
320
*/
315
321
project. evaluationDependsOn(upstreamProject. path)
316
322
project. javadoc. source + = upstreamProject. javadoc. source
317
- /*
318
- * Do not add those projects to the javadoc classpath because
319
- * we are going to resolve them with their source instead.
320
- */
321
- project. javadoc. classpath = project. javadoc. classpath. filter { f ->
322
- false == upstreamProject. configurations. archives. artifacts. files. files. contains(f)
323
- }
324
323
/*
325
324
* Instead we need the upstream project's javadoc classpath so
326
325
* we don't barf on the classes that it references.
@@ -337,16 +336,16 @@ subprojects {
337
336
project. configurations. compile. dependencies
338
337
.findAll()
339
338
.toSorted(sortClosure)
340
- .each({ c -> depJavadocClosure(hasShadow , c) })
339
+ .each({ c -> depJavadocClosure(false , c) })
341
340
project. configurations. compileOnly. dependencies
342
341
.findAll()
343
342
.toSorted(sortClosure)
344
- .each({ c -> depJavadocClosure(hasShadow , c) })
343
+ .each({ c -> depJavadocClosure(false , c) })
345
344
if (hasShadow) {
346
- project. configurations. shadow . dependencies
345
+ project. configurations. bundle . dependencies
347
346
.findAll()
348
347
.toSorted(sortClosure)
349
- .each({ c -> depJavadocClosure(false , c) })
348
+ .each({ c -> depJavadocClosure(true , c) })
350
349
}
351
350
}
352
351
}
@@ -510,30 +509,33 @@ allprojects {
510
509
tasks. cleanEclipse. dependsOn(wipeEclipseSettings)
511
510
// otherwise the eclipse merging is *super confusing*
512
511
tasks. eclipse. dependsOn(cleanEclipse, copyEclipseSettings)
512
+
513
+ // work arround https://github.com/gradle/gradle/issues/6582
514
+ tasks. eclipseProject. mustRunAfter tasks. cleanEclipseProject
515
+ tasks. matching { it. name == ' eclipseClasspath' }. all {
516
+ it. mustRunAfter { tasks. cleanEclipseClasspath }
517
+ }
518
+ tasks. matching { it. name == ' eclipseJdt' }. all {
519
+ it. mustRunAfter { tasks. cleanEclipseJdt }
520
+ }
521
+ tasks. copyEclipseSettings. mustRunAfter tasks. wipeEclipseSettings
513
522
}
514
523
515
524
allprojects {
516
525
/*
517
526
* IntelliJ and Eclipse don't know about the shadow plugin so when we're
518
- * in "IntelliJ mode" or "Eclipse mode" add "runtime" dependencies
519
- * eveywhere where we see a "shadow" dependency which will cause them to
520
- * reference shadowed projects directly rather than rely on the shadowing
521
- * to include them. This is the correct thing for it to do because it
522
- * doesn't run the jar shadowing at all. This isn't needed for the project
527
+ * in "IntelliJ mode" or "Eclipse mode" switch "bundle" dependencies into
528
+ * regular "compile" dependencies. This isn't needed for the project
523
529
* itself because the IDE configuration is done by SourceSets but it is
524
530
* *is* needed for projects that depends on the project doing the shadowing.
525
531
* Without this they won't properly depend on the shadowed project.
526
532
*/
527
533
if (isEclipse || isIdea) {
528
- configurations. all { Configuration configuration ->
529
- dependencies. all { Dependency dep ->
530
- if (dep instanceof ProjectDependency ) {
531
- if (dep. getTargetConfiguration() == ' shadow' ) {
532
- configuration. dependencies. add(project. dependencies. project(path : dep. dependencyProject. path, configuration : ' runtime' ))
533
- }
534
- }
535
- }
536
- }
534
+ project. plugins. withType(ShadowPlugin ). whenPluginAdded {
535
+ project. afterEvaluate {
536
+ project. configurations. compile. extendsFrom project. configurations. bundle
537
+ }
538
+ }
537
539
}
538
540
}
539
541
0 commit comments