forked from zxhr/gradle-xtext-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
177 lines (163 loc) · 6.13 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
plugins {
id 'maven-publish'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.12.0'
}
group = 'com.github.zxhr'
version = '0.2.0-SNAPSHOT'
description = 'Plugins for seamlessly using the Xtext DSL language generator with Gradle'
ext {
xtextVersion = '2.22.0'
}
repositories {
jcenter()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
configurations {
testImplementation.extendsFrom compileOnly
}
dependencies {
api(platform('org.eclipse.xtext:xtext-dev-bom')) {
version {
require '[2.17.0,3.0.0)'
prefer xtextVersion
}
}
implementation 'org.eclipse.emf:org.eclipse.emf.mwe2.launch'
api 'org.eclipse.xtext:org.eclipse.xtext.xtext.generator'
runtimeOnly 'org.eclipse.xtext:xtext-antlr-generator'
compileOnly "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:$xtextVersion"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
gradlePlugin {
plugins {
xtextRoot {
id = 'com.github.zxhr.xtext-generator-root-project'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextRootProjectPlugin'
displayName = 'Xtext DSL root project plugin'
description = 'Plugin for generating an Xtext DSL language with MWE2'
}
xtextRuntime {
id = 'com.github.zxhr.xtext-generator-runtime'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextRuntimePlugin'
displayName = 'Xtext DSL runtime project plugin'
description = 'Plugin for configuring the runtime project of an Xtext DSL language'
}
xtextRuntimeTest {
id = 'com.github.zxhr.xtext-generator-runtime-test'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextRuntimeTestPlugin'
displayName = 'Xtext DSL runtime test project plugin'
description = 'Plugin for configuring the runtime test project of an Xtext DSL language'
}
xtextGenericIde {
id = 'com.github.zxhr.xtext-generator-generic-ide'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextGenericIdePlugin'
displayName = 'Xtext DSL generic ide project plugin'
description = 'Plugin for configuring the generic ide project of an Xtext DSL language'
}
xtextEclipsePlugin {
id = 'com.github.zxhr.xtext-generator-eclipse-plugin'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextEclipsePluginPlugin'
displayName = 'Xtext DSL eclipse plugin project plugin'
description = 'Plugin for configuring the eclipse plugin project of an Xtext DSL language'
}
xtextEclipsePluginTest {
id = 'com.github.zxhr.xtext-generator-eclipse-plugin-test'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextEclipsePluginTestPlugin'
displayName = 'Xtext DSL eclipse plugin test project plugin'
description = 'Plugin for configuring the eclipse plugin test project of an Xtext DSL language'
}
xtextWeb {
id = 'com.github.zxhr.xtext-generator-web'
implementationClass = 'com.github.zxhr.gradle.xtext.XtextWebPlugin'
displayName = 'Xtext DSL web project plugin'
description = 'Plugin for configuring the web project of an Xtext DSL language'
}
}
pluginSourceSet sourceSets.create('ignore')
}
pluginBundle {
website = 'https://github.com/zxhr/gradle-xtext-generator'
vcsUrl = website
tags = ['xtext', 'mwe2']
}
publishing {
publications.withType(MavenPublication) {
pom {
description = project.description
url = pluginBundle.website
licenses {
license {
name = 'MIT License'
url = "${pluginBundle.website}/blob/master/LICENSE.md"
distribution = 'repo'
}
}
}
}
repositories {
maven {
name = 'test'
url "${buildDir}/m2"
}
}
}
tasks.named(JavaPlugin.TEST_TASK_NAME) {
def repository = publishing.repositories.test
dependsOn "publishAllPublicationsTo${repository.name.capitalize()}Repository"
useJUnitPlatform()
systemProperty 'testdir', temporaryDir
systemProperty 'm2', file(repository.url)
systemProperty 'pluginVersion', version
systemProperty 'xtextVersion', xtextVersion
if (findProperty('gradleVersions') != null) {
systemProperty 'gradleVersions', gradleVersions
}
doFirst {
mkdir temporaryDir
}
}
tasks.named(JavaPlugin.JAVADOC_TASK_NAME) {
options.source = '8'
def offlineLinks =
['https://docs.oracle.com/javase/8/docs/api/' :
['java.lang',
'java.util.function'],
"https://www.javadoc.io/doc/org.eclipse.xtext/org.eclipse.xtext.xtext.generator/${xtextVersion}/" :
['org.eclipse.xtext.xtext.generator',
'org.eclipse.xtext.xtext.generator.model',
'org.eclipse.xtext.xtext.generator.model.project'],
"https://docs.gradle.org/${gradle.gradleVersion}/javadoc/" :
['org.gradle.api',
'org.gradle.api.file',
'org.gradle.api.model',
'org.gradle.api.plugins',
'org.gradle.api.provider',
'org.gradle.api.tasks',
'org.gradle.util'],
'https://javaee.github.io/javaee-spec/javadocs/' :
['javax.inject']]
doFirst {
offlineLinks.eachWithIndex { url, packages, index ->
def javadocsDir = file("${temporaryDir}/javadocs-${index}")
javadocsDir.mkdirs()
file("${javadocsDir}/package-list").text = packages.join('\n') + '\n'
options.linksOffline(url, javadocsDir.path)
}
}
}
tasks.withType(Jar).configureEach {
metaInf {
from 'LICENSE.md'
}
}
dependencyLocking {
lockAllConfigurations()
}