forked from wpilibsuite/vscode-wpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
144 lines (114 loc) · 3.8 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
plugins {
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '2024.0.0'
id "de.undercouch.download" version "4.1.2"
id "base"
}
if (project.hasProperty('buildServer')) {
wpilibVersioning.buildServerMode = true
}
ext.addedRelease = false
wpilibVersioning.useAllTags = true
def azureRelease = System.getenv('GITHUB_REF')
if (azureRelease != null) {
println azureRelease
if (azureRelease.startsWith('refs/tags/')) {
wpilibVersioning.releaseMode = true
wpilibRepositories.addAllReleaseRepositories(project)
ext.addedRelease = true
println 'tagged build'
}
}
if (!ext.addedRelease) {
wpilibRepositories.addAllDevelopmentRepositories(project)
}
configurations {
cppSource
javaSource
}
dependencies {
cppSource 'edu.wpi.first.wpilibc:examples:+:@zip'
javaSource 'edu.wpi.first.wpilibj:examples:+:@zip'
cppSource 'edu.wpi.first.wpilibc:templates:+:@zip'
javaSource 'edu.wpi.first.wpilibj:templates:+:@zip'
cppSource 'edu.wpi.first.wpilibc:commands:+:@zip'
javaSource 'edu.wpi.first.wpilibj:commands:+:@zip'
}
task extractCppDependencies(type: Copy) {
dependsOn configurations.cppSource
from {
configurations.cppSource.collect { it }
configurations.cppSource.collect { zipTree(it) }
}
into 'vscode-wpilib/resources/cpp/src'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task extractJavaDependencies(type: Copy) {
dependsOn configurations.javaSource
from {
configurations.javaSource.collect { zipTree(it) }
}
into 'vscode-wpilib/resources/java/src'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
def downloadNewCommands = tasks.register('downloadNewCommands', Download) {
src 'https://raw.githubusercontent.com/wpilibsuite/allwpilib/main/wpilibNewCommands/WPILibNewCommands.json'
dest 'vscode-wpilib/resources/vendordeps/WPILibNewCommands.json'
overwrite true
}
def downloadRomiVendordep = tasks.register('downloadRomiVendordep', Download) {
src 'https://raw.githubusercontent.com/wpilibsuite/allwpilib/main/romiVendordep/RomiVendordep.json'
dest 'vscode-wpilib/resources/vendordeps/RomiVendordep.json'
overwrite true
}
def downloadXRPVendordep = tasks.register('downloadXRPVendordep', Download) {
src 'https://raw.githubusercontent.com/wpilibsuite/allwpilib/main/xrpVendordep/XRPVendordep.json'
dest 'vscode-wpilib/resources/vendordeps/XRPVendordep.json'
overwrite true
}
task copyFromVsCodeToStandaloneResources(type: Copy) {
dependsOn extractCppDependencies
dependsOn extractJavaDependencies
dependsOn downloadNewCommands
dependsOn downloadRomiVendordep
dependsOn downloadXRPVendordep
from ('vscode-wpilib/resources/java') {
into 'java'
}
from ('vscode-wpilib/resources/cpp') {
into 'cpp'
}
from ('vscode-wpilib/resources/gradle') {
into 'gradle'
}
from ('vscode-wpilib/resources/vendordeps') {
into 'vendordeps'
}
into 'wpilib-utility-standalone/resources'
}
task copyFromVsCodeToStandaloneSrc(type: Copy) {
from ('vscode-wpilib/src/riolog/shared') {
into 'riolog/shared'
}
from ('vscode-wpilib/src/shared') {
into 'shared'
}
into 'wpilib-utility-standalone/src'
}
apply from: 'templatebuilder.gradle'
task updateAllDependencies() {
dependsOn copyFromVsCodeToStandaloneResources
dependsOn copyFromVsCodeToStandaloneSrc
}
if (project.hasProperty("publishVersion")) {
wpilibVersioning.version.set(project.publishVersion)
}
wpilibVersioning.version.finalizeValue()
ext.pubVersion = wpilibVersioning.version.get()
if (pubVersion == '') {
pubVersion = '0.0.1-unknown'
}
apply from: 'versions.gradle'
wrapper {
gradleVersion = '8.10.2'
}