@@ -43,14 +43,23 @@ plugins {
43
43
id(" org.jetbrains.changelog" ) version " 2.2.0" // Gradle Changelog Plugin
44
44
}
45
45
46
- var flutterPluginVersion = providers.gradleProperty(" flutterPluginVersion" ).get()
47
- if (project.hasProperty(" dev" )) {
46
+ // By default (e.g. when we call `runIde` during development), the plugin version is SNAPSHOT
47
+ var flutterPluginVersion = " SNAPSHOT"
48
+
49
+ // Otherwise, we will decide on the proper semver-formatted version from the CHANGELOG.
50
+ // Note: The CHANGELOG follows the style from https://keepachangelog.com/en/1.0.0/ so that we can use the gradle changelog plugin.
51
+ if (project.hasProperty(" release" )) {
52
+ // If we are building for a release, the changelog should be updated with the latest version.
53
+ flutterPluginVersion = changelog.getLatest().version
54
+ } else if (project.hasProperty(" dev" )) {
55
+ // If we are building the dev version, the version label will increment the latest version from the changelog and append the date.
48
56
val latestVersion = changelog.getLatest().version
49
57
val majorVersion = latestVersion.substringBefore(' .' ).toInt()
50
58
val nextMajorVersion = majorVersion + 1
51
59
val datestamp = DateTimeFormatter .ofPattern(" yyyyMMdd" ).format(LocalDate .now())
52
60
flutterPluginVersion = " $nextMajorVersion .0.0-dev.$datestamp "
53
61
}
62
+
54
63
val ideaVersion = providers.gradleProperty(" ideaVersion" ).get()
55
64
val dartPluginVersion = providers.gradleProperty(" dartPluginVersion" ).get()
56
65
val sinceBuildInput = providers.gradleProperty(" sinceBuild" ).get()
0 commit comments