@@ -8,6 +8,7 @@ import org.gradle.api.GradleException
8
8
import org.gradle.api.Plugin
9
9
import org.gradle.api.Project
10
10
import org.gradle.api.artifacts.Configuration
11
+ import org.gradle.api.file.FileCollection
11
12
import org.gradle.api.plugins.BasePlugin
12
13
import org.gradle.api.plugins.JavaBasePlugin
13
14
import org.gradle.api.plugins.JavaPluginConvention
@@ -16,13 +17,13 @@ import org.gradle.api.tasks.compile.JavaCompile
16
17
import org.gradle.plugins.ide.eclipse.EclipsePlugin
17
18
import org.gradle.plugins.ide.eclipse.model.EclipseModel
18
19
import org.xtext.gradle.tasks.Outlet
20
+ import org.xtext.gradle.tasks.XtextClasspathInferrer
19
21
import org.xtext.gradle.tasks.XtextEclipseSettings
20
22
import org.xtext.gradle.tasks.XtextExtension
21
23
import org.xtext.gradle.tasks.XtextGenerate
22
24
23
25
import static extension org.xtext.gradle.GradleExtensions.*
24
- import org.gradle.api.file.FileCollection
25
- import org.xtext.gradle.tasks.XtextClasspathInferrer
26
+ import static org.xtext.gradle.XtextBuilderPluginVersion.*
26
27
27
28
class XtextBuilderPlugin implements Plugin<Project > {
28
29
@@ -54,7 +55,7 @@ class XtextBuilderPlugin implements Plugin<Project> {
54
55
xtextClasspath = project. files(new Callable<FileCollection > () {
55
56
FileCollection inferredClasspath
56
57
override call() throws Exception {
57
- if (inferredClasspath == null ) {
58
+ if (inferredClasspath == = null ) {
58
59
inferredClasspath = inferXtextClasspath(classpath)
59
60
}
60
61
inferredClasspath
@@ -81,14 +82,14 @@ class XtextBuilderPlugin implements Plugin<Project> {
81
82
private def automaticallyInferXtextCoreClasspath () {
82
83
xtext. classpathInferrers + = new XtextClasspathInferrer () {
83
84
override inferXtextClasspath(FileCollection xtextClasspath, FileCollection classpath) {
84
- val xtextBuilder = project. dependencies. externalModule(' ' ' org.xtext:xtext-gradle-builder:«pluginVersion »' ' ' )
85
+ val xtextBuilder = project. dependencies. externalModule(' ' ' org.xtext:xtext-gradle-builder:«PLUGIN_VERSION »' ' ' )
85
86
val xtextTooling = project. configurations. detachedConfiguration(xtextBuilder)
86
87
xtext. makeXtextCompatible(xtextTooling)
87
88
xtext. forceXtextVersion(xtextTooling, new Function0<String > () {
88
89
String version = null
89
90
90
91
override apply() {
91
- if (version == null ) {
92
+ if (version == = null ) {
92
93
version = xtext. getXtextVersion(classpath) ?: xtext. getXtextVersion(xtextClasspath)
93
94
if (version == = null ) {
94
95
throw new GradleException (' ' ' Could not infer Xtext classpath, because xtext.version was not set and no xtext libraries were found on the «classpath» classpath' ' ' )
@@ -102,10 +103,6 @@ class XtextBuilderPlugin implements Plugin<Project> {
102
103
}
103
104
}
104
105
105
- private def String getPluginVersion () {
106
- XtextBuilderPlugin . package . implementationVersion
107
- }
108
-
109
106
private def configureOutletDefaults () {
110
107
xtext. languages. all [ language |
111
108
language. generator. outlets. create(Outlet . DEFAULT_OUTLET )
0 commit comments