forked from wpilibsuite/GradleRIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
109 lines (88 loc) · 2.74 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
plugins {
id 'com.gradle.plugin-publish' version '0.12.0'
id 'java-gradle-plugin'
id 'idea'
id 'maven-publish'
id 'java'
id 'groovy'
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenLocal()
}
dependencies {
api 'com.google.code.gson:gson:2.8.6'
api 'edu.wpi.first:native-utils:2022.5.1'
api 'de.undercouch:gradle-download-task:4.1.2'
testImplementation('org.spockframework:spock-core:2.0-M4-groovy-3.0') {
exclude group: 'org.codehaus.groovy'
}
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation gradleTestKit()
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
archivesBaseName = "GradleRIO"
sourceCompatibility = 11
targetCompatibility = 11
allprojects {
group = "edu.wpi.first"
if (project.hasProperty('publishVersion')) {
version = project.publishVersion
}
}
pluginBundle {
website = 'https://github.com/wpilibsuite/GradleRIO'
vcsUrl = 'https://github.com/wpilibsuite/GradleRIO'
description = 'Managing FRC projects, the Gradle way (2019+)'
tags = ['frc', 'wpilib', 'gradlerio']
}
gradlePlugin {
plugins {
gradleRio {
id = 'edu.wpi.first.GradleRIO'
displayName = 'GradleRIO'
implementationClass = 'edu.wpi.first.gradlerio.GradleRIOPlugin'
}
}
}
apply from: 'versionupdates.gradle'
def examplesFolder = file("$rootDir/examples")
tasks.register('PatchExamples') {
doLast {
String regex = "(id\\s*?[\\\"|\\']edu\\.wpi\\.first\\.GradleRIO[\\\"|\\'].*?version\\s*?[\\\"|\\'])(.+?)([\\\"|\\'])";
examplesFolder.eachFile { File file ->
if (file.isDirectory() && file.name != '_archived') {
def buildGradleFile = new File(file, 'build.gradle')
if (buildGradleFile.exists() && buildGradleFile.isFile()) {
def text = buildGradleFile.text
text = text.replaceAll(regex, "id \"edu.wpi.first.GradleRIO\" version \"${version}\"")
buildGradleFile.text = text
}
}
}
}
}
task zipExamples(dependsOn: PatchExamples)
examplesFolder.eachFile { File file ->
if (file.isDirectory() && file.name != '_archived') {
task "zipExample${file.name}"(type: Zip) {
from(file) {
archiveFileName = "${file.name}.zip"
exclude 'build/'
exclude '.gradle/'
}
zipExamples.dependsOn it
it.dependsOn PatchExamples
}
}
}
jar.finalizedBy zipExamples
wrapper {
gradleVersion = '7.2'
distributionType = Wrapper.DistributionType.BIN
}