File tree Expand file tree Collapse file tree 3 files changed +79
-2
lines changed
Expand file tree Collapse file tree 3 files changed +79
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ install:
1919cache : C:\Users\appveyor\.gradle
2020build_script :
2121- ps : >-
22- ./gradlew build --continue --no-daemon
22+ ./gradlew build updateVersions --continue --no-daemon
2323
2424 if ($lastexitcode -ne 0) {
2525 throw ("Exec: " + $errorMessage)
Original file line number Diff line number Diff line change 11plugins {
22 id ' java-gradle-plugin'
33 id ' maven-publish'
4+ id " edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin" version " 2.0"
45 id " com.gradle.plugin-publish" version " 0.9.10"
56}
67
8+ // Ensure that the WPILibVersioningPlugin is setup by setting the release type, if releaseType wasn't
9+ // already specified on the command line
10+ if (! hasProperty(' releaseType' )) {
11+ WPILibVersion {
12+ releaseType = ' dev'
13+ }
14+ }
15+
16+ ext. pubVersion = ' '
17+ if (project. hasProperty(" publishVersion" )) {
18+ pubVersion = project. publishVersion
19+ } else {
20+ pubVersion = WPILibVersion . version
21+ }
22+
23+ if (pubVersion == ' ' ) {
24+ pubVersion = ' 0.0.1-unknown'
25+ }
26+
727group ' edu.wpi.first'
8- version ' 0.0.4 '
28+ version pubVersion
929
1030repositories {
1131 maven {
@@ -59,6 +79,8 @@ gradlePlugin {
5979 }
6080}
6181
82+ apply from : ' versions.gradle'
83+
6284task wrapper (type : Wrapper ) {
6385 gradleVersion = ' 4.7'
6486}
Original file line number Diff line number Diff line change 1+ def versionFiles = [new File (' extension/package.json' )]
2+ def oldVersionFile = new File (" $buildDir /existingVersions.json" )
3+
4+ task updateVersions (type : Task ) {
5+ doLast {
6+ def existingVersions = []
7+
8+ versionFiles. each {
9+ def file = it
10+
11+ def parsedJson = new groovy.json.JsonSlurper (). parseText(file. text)
12+
13+ def existingVersion = new Expando ();
14+ existingVersion. version = parsedJson. version
15+
16+ existingVersion. file = file. toString()
17+
18+ existingVersions << existingVersion
19+
20+ parsedJson. version = pubVersion
21+
22+ def converted = groovy.json.JsonOutput . prettyPrint(groovy.json.JsonOutput . toJson(parsedJson))
23+
24+ file. text = converted
25+ }
26+ if (oldVersionFile. exists()) {
27+ return
28+ }
29+
30+ oldVersionFile. parentFile. mkdirs()
31+
32+ oldVersionFile. text = groovy.json.JsonOutput . prettyPrint(groovy.json.JsonOutput . toJson(existingVersions))
33+ }
34+ }
35+
36+ task resetVersions (type : Task ) {
37+ doLast {
38+ def oldVersions = new groovy.json.JsonSlurper (). parseText(oldVersionFile. text)
39+ versionFiles. each {
40+ def file = it
41+
42+ def parsedJson = new groovy.json.JsonSlurper (). parseText(file. text)
43+ for (Object oldv : oldVersions) {
44+ if (file. toString(). equals(oldv. file)) {
45+ parsedJson. version = oldv. version
46+ break
47+ }
48+ }
49+ def converted = groovy.json.JsonOutput . prettyPrint(groovy.json.JsonOutput . toJson(parsedJson))
50+
51+ file. text = converted
52+ }
53+ oldVersionFile. delete()
54+ }
55+ }
You can’t perform that action at this time.
0 commit comments