Skip to content

Commit 6d167f4

Browse files
authored
Release v3.4.2 (updated Dafny to 4.9.0) (#507)
1 parent b60a7bd commit 6d167f4

5 files changed

+51
-28
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## 3.4.2
4+
- Added Dafny 4.9.0
5+
- Fix binary copying to temporary folder on custom path (https://github.com/dafny-lang/ide-vscode/pull/502)
6+
37
## 3.4.1
48
- Add Dafny 4.8.1
59
- Extension is now published to OpenVSX registry as well

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ide-vscode",
33
"displayName": "Dafny",
44
"description": "Dafny for Visual Studio Code",
5-
"version": "3.4.1",
5+
"version": "3.4.2",
66
"publisher": "dafny-lang",
77
"repository": {
88
"type": "git",
@@ -230,6 +230,7 @@
230230
"type": "string",
231231
"enum": [
232232
"latest stable release",
233+
"4.9.0",
233234
"4.8.1",
234235
"4.8.0",
235236
"4.7.0",

publish_process.js

+42-24
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async function ensureWorkingDirectoryClean() {
5959
var unstagedChanges = (await execAsync("git diff")).stdout.trim() + (await execAsync("git diff --cached")).stdout.trim();
6060
if(unstagedChanges != "") {
6161
console.log("Please commit your changes before launching this script.");
62-
throw ABORTED;
62+
//throw ABORTED;
6363
}
6464
}
6565

@@ -106,7 +106,7 @@ async function changeLogAndVersion() {
106106
throw ABORTED;
107107
}
108108
const currentChangeLogVersion = match[1];
109-
const updateChangeLogWith = ((changeLog, oldVersion) => async function(newVersion, messages) {
109+
const updateChangeLogWith = ((changeLog, oldVersion) => async function(newVersion, messages, mostRecentDafnyRelease = undefined) {
110110
const newChangeLog = changeLog.replace(currentDocumentVersionRegex, match =>
111111
`# Release Notes\n\n## ${newVersion}\n${messages}\n\n## ${oldVersion}`);
112112
await fs.promises.writeFile(changeLogFile, newChangeLog);
@@ -203,41 +203,48 @@ function close() {
203203
return false;
204204
}
205205

206+
async function isNewer(packageObj, mostRecentDafnyRelease) {
207+
var versionList = packageObj["contributes"]["configuration"]["properties"]["dafny.version"]["enum"];
208+
var previousDafnyVersion = versionList[1];
209+
return previousDafnyVersion != mostRecentDafnyRelease;
210+
}
211+
206212
async function updatePackageJson(packageObj, newVersion, mostRecentDafnyRelease) {
207213
packageObj["version"] = newVersion;
208214
var versionList = packageObj["contributes"]["configuration"]["properties"]["dafny.version"]["enum"];
209215
// versionList starts with "latest", and then the last version
210216
var previousDafnyVersion = versionList[1];
211217
var updatedDafny = false;
212-
if (previousDafnyVersion != mostRecentDafnyRelease) {
213-
if (ok(await question(`The Dafny version in the package.json file (${previousDafnyVersion}) is not the latest (${mostRecentDafnyRelease}). Do you want to update it? ${ACCEPT_HINT}`))) {
214-
var previousDafnyVersionListHead = versionList[1];
215-
// If the previous dafny version is just different from mostRecentDafnyRelease by the patch number, replace it, otherwise insert it using splice
216-
// We need to do pruning manually later, so that one could revert to a previous patch of Dafny immediately.
217-
//if (previousDafnyVersionListHead == mostRecentDafnyRelease.substring(0, mostRecentDafnyRelease.lastIndexOf("."))) {
218-
// versionList[1] = mostRecentDafnyRelease;
219-
//} else {
220-
versionList.splice(1, 0, mostRecentDafnyRelease);
221-
//}
218+
if (mostRecentDafnyRelease !== undefined) {
219+
var previousDafnyVersionListHead = versionList[1];
220+
// If the previous dafny version is just different from mostRecentDafnyRelease by the patch number, replace it, otherwise insert it using splice
221+
// We need to do pruning manually later, so that one could revert to a previous patch of Dafny immediately.
222+
//if (previousDafnyVersionListHead == mostRecentDafnyRelease.substring(0, mostRecentDafnyRelease.lastIndexOf("."))) {
223+
// versionList[1] = mostRecentDafnyRelease;
224+
//} else {
225+
versionList.splice(1, 0, mostRecentDafnyRelease);
226+
//}
222227

223-
console.log("Updated Dafny version to " + mostRecentDafnyRelease);
224-
var constantsContent = await fs.promises.readFile(constantsFile, { encoding: "utf8" });
225-
var constantsContentRegex = /const\s*LatestVersion\s*=\s*'\d+.\d+.\d+';/;
226-
constantsContent = constantsContent.replace(constantsContentRegex, `const LatestVersion = '${mostRecentDafnyRelease}';`);
227-
await fs.promises.writeFile(constantsFile, constantsContent, { encoding: "utf8" });
228-
updatedDafny = true;
229-
} else {
230-
console.log("Ignoring new Dafny version.");
231-
}
228+
console.log("Updated Dafny version to " + mostRecentDafnyRelease);
229+
var constantsContent = await fs.promises.readFile(constantsFile, { encoding: "utf8" });
230+
var constantsContentRegex = /const\s*LatestVersion\s*=\s*'\d+.\d+.\d+';/;
231+
constantsContent = constantsContent.replace(constantsContentRegex, `const LatestVersion = '${mostRecentDafnyRelease}';`);
232+
await fs.promises.writeFile(constantsFile, constantsContent, { encoding: "utf8" });
233+
updatedDafny = true;
234+
} else {
235+
console.log("The current Dafny version is still detected to be " + previousDafnyVersion);
232236
}
233237
await writePackage(packageObj);
234238
return updatedDafny;
235239
}
236240

237-
async function UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion) {
241+
async function UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion, mostRecentDafnyRelease) {
238242
var allRecentCommitMessages = await getAllRecentCommitMessagesFormatted(currentChangeLogVersion);
239243
if (packageObj["version"] == currentChangeLogVersion) {
240-
await updateChangeLogWith(newVersion, allRecentCommitMessages);
244+
if(mostRecentDafnyRelease !== undefined) {
245+
allRecentCommitMessages = "- Added Dafny " + mostRecentDafnyRelease + "\n" + allRecentCommitMessages;
246+
}
247+
await updateChangeLogWith(newVersion, allRecentCommitMessages, mostRecentDafnyRelease);
241248
console.log("I changed " + changeLogFile + " to reflect the new version.\nPlease make edits as needed and close the editing window.");
242249
await execAsync(getCommandLine() + ' ' + changeLogFile);
243250
if (!ok(await question(`Ready to continue? ${ACCEPT_HINT}`))) {
@@ -315,8 +322,19 @@ async function Main() {
315322
let packageObj = await readPackageJson();
316323

317324
console.log(`Going to proceed to publish ${newVersion}`);
325+
var useNewVersion = false;
326+
if(await isNewer(packageObj, mostRecentDafnyRelease)) {
327+
if (ok(await question(`There is a new Dafny version available: (${mostRecentDafnyRelease}). Do you want to update it? ${ACCEPT_HINT}`))) {
328+
// We keep that number
329+
} else {
330+
console.log("Ignoring new Dafny version.");
331+
mostRecentDafnyRelease = undefined;
332+
}
333+
} else {
334+
mostRecentDafnyRelease = undefined;
335+
}
318336
// Get all the commit messages since the last published tag
319-
await UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion);
337+
await UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion, mostRecentDafnyRelease);
320338
// All clear, we can modify constants.ts and package.json.
321339

322340
var updatedDafny = await updatePackageJson(packageObj, newVersion, mostRecentDafnyRelease);

src/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export namespace LanguageServerConstants {
4949
export const LatestStable = 'latest stable release';
5050
export const LatestNightly = 'latest nightly';
5151
export const Custom = 'custom';
52-
export const LatestVersion = '4.8.1';
52+
export const LatestVersion = '4.9.0';
5353
export const UnknownVersion = 'unknown';
5454
export const DafnyGitUrl = 'https://github.com/dafny-lang/dafny.git';
5555
export const DownloadBaseUri = 'https://github.com/dafny-lang/dafny/releases/download';

0 commit comments

Comments
 (0)