forked from cdietrich/xtext-languageserver-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
125 lines (104 loc) · 2.81 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
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.xtext:xtext-gradle-plugin:4.0.0'
classpath 'com.github.node-gradle:gradle-node-plugin:7.1.0'
classpath 'net.researchgate:gradle-release:3.0.2'
}
}
apply plugin: 'net.researchgate.release'
// Configuration for Xtext projects
configure(subprojects.findAll { it.name.startsWith('org.xtext') }) {
ext.xtextVersion = '2.37.0'
repositories {
mavenCentral()
}
apply plugin: 'java-library'
dependencies {
api platform("org.eclipse.xtext:xtext-dev-bom:${xtextVersion}")
}
apply plugin: 'org.xtext.xtend'
apply from: "${rootDir}/gradle/source-layout.gradle"
apply plugin: 'eclipse'
apply plugin: 'idea'
group = 'org.xtext.example.mydsl'
version = '1.0.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
configurations.all {
exclude group: 'asm'
}
}
// Configuration for vscode projects
configure(subprojects.findAll { it.name.startsWith('vscode') }) {
apply plugin: 'com.github.node-gradle.node'
node {
version = '20.16.0'
npmVersion = '10.8.1'
download = true
}
def inputFiles = fileTree(
dir: projectDir,
excludes: [ 'out/**', '.gitignore', '.gradle/**', 'build/**', '*.gradle' ]
)
npmInstall {
inputs.files(inputFiles)
outputs.dir('out')
}
task vscodeExtension(dependsOn: [npmInstall], type: NodeTask) {
ext.destDir = new File(buildDir, 'vscode')
ext.archiveName = "$project.name-${project.version}.vsix"
ext.destPath = "$destDir/$archiveName"
outputs.dir destDir
doFirst {
destDir.mkdirs()
}
script = file("node_modules/.bin/vsce")
args = [ 'package', '--out', destPath ]
execOverrides {
workingDir = projectDir
}
}
task clean {
doLast {
delete vscodeExtension.destDir
delete 'out' // output of npmInstall - don't want to delete node_modules
}
}
}
plugins.withType(com.github.gradle.node.NodePlugin) {
node {
workDir = file("$rootProject.buildDir/nodejs")
}
}
updateVersion {
doLast {
// custom code
def versionPattern = /\d+.\d+(.\d+)?/
def encoding = 'UTF-8'
def filesToUpdate = [
new File('vscode-extension', 'package.json'),
new File('vscode-extension-self-contained', 'package.json'),
]
// String replacements - isn't long enough to justify advanced code ;)
filesToUpdate.forEach { file ->
String text = file.getText(encoding)
text = text.replaceAll("\"version\": \"$versionPattern\",", "\"version\": \"$project.version\",")
file.setText(text, encoding)
}
}
}
release {
tagTemplate = 'v${version}'
preTagCommitMessage = '[release] pre tag commit: '
tagCommitMessage = '[release] creating tag: '
newVersionCommitMessage = '[release] new version commit: '
failOnSnapshotDependencies = false
}