Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3.4.2 (updated Dafny to 4.9.0) #507

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 3.4.2
- Added Dafny 4.9.0
- Fix binary copying to temporary folder on custom path (https://github.com/dafny-lang/ide-vscode/pull/502)

## 3.4.1
- Add Dafny 4.8.1
- Extension is now published to OpenVSX registry as well
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ide-vscode",
"displayName": "Dafny",
"description": "Dafny for Visual Studio Code",
"version": "3.4.1",
"version": "3.4.2",
"publisher": "dafny-lang",
"repository": {
"type": "git",
Expand Down Expand Up @@ -230,6 +230,7 @@
"type": "string",
"enum": [
"latest stable release",
"4.9.0",
"4.8.1",
"4.8.0",
"4.7.0",
Expand Down
66 changes: 42 additions & 24 deletions publish_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function ensureWorkingDirectoryClean() {
var unstagedChanges = (await execAsync("git diff")).stdout.trim() + (await execAsync("git diff --cached")).stdout.trim();
if(unstagedChanges != "") {
console.log("Please commit your changes before launching this script.");
throw ABORTED;
//throw ABORTED;
}
}

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

async function isNewer(packageObj, mostRecentDafnyRelease) {
var versionList = packageObj["contributes"]["configuration"]["properties"]["dafny.version"]["enum"];
var previousDafnyVersion = versionList[1];
return previousDafnyVersion != mostRecentDafnyRelease;
}

async function updatePackageJson(packageObj, newVersion, mostRecentDafnyRelease) {
packageObj["version"] = newVersion;
var versionList = packageObj["contributes"]["configuration"]["properties"]["dafny.version"]["enum"];
// versionList starts with "latest", and then the last version
var previousDafnyVersion = versionList[1];
var updatedDafny = false;
if (previousDafnyVersion != mostRecentDafnyRelease) {
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}`))) {
var previousDafnyVersionListHead = versionList[1];
// If the previous dafny version is just different from mostRecentDafnyRelease by the patch number, replace it, otherwise insert it using splice
// We need to do pruning manually later, so that one could revert to a previous patch of Dafny immediately.
//if (previousDafnyVersionListHead == mostRecentDafnyRelease.substring(0, mostRecentDafnyRelease.lastIndexOf("."))) {
// versionList[1] = mostRecentDafnyRelease;
//} else {
versionList.splice(1, 0, mostRecentDafnyRelease);
//}
if (mostRecentDafnyRelease !== undefined) {
var previousDafnyVersionListHead = versionList[1];
// If the previous dafny version is just different from mostRecentDafnyRelease by the patch number, replace it, otherwise insert it using splice
// We need to do pruning manually later, so that one could revert to a previous patch of Dafny immediately.
//if (previousDafnyVersionListHead == mostRecentDafnyRelease.substring(0, mostRecentDafnyRelease.lastIndexOf("."))) {
// versionList[1] = mostRecentDafnyRelease;
//} else {
versionList.splice(1, 0, mostRecentDafnyRelease);
//}

console.log("Updated Dafny version to " + mostRecentDafnyRelease);
var constantsContent = await fs.promises.readFile(constantsFile, { encoding: "utf8" });
var constantsContentRegex = /const\s*LatestVersion\s*=\s*'\d+.\d+.\d+';/;
constantsContent = constantsContent.replace(constantsContentRegex, `const LatestVersion = '${mostRecentDafnyRelease}';`);
await fs.promises.writeFile(constantsFile, constantsContent, { encoding: "utf8" });
updatedDafny = true;
} else {
console.log("Ignoring new Dafny version.");
}
console.log("Updated Dafny version to " + mostRecentDafnyRelease);
var constantsContent = await fs.promises.readFile(constantsFile, { encoding: "utf8" });
var constantsContentRegex = /const\s*LatestVersion\s*=\s*'\d+.\d+.\d+';/;
constantsContent = constantsContent.replace(constantsContentRegex, `const LatestVersion = '${mostRecentDafnyRelease}';`);
await fs.promises.writeFile(constantsFile, constantsContent, { encoding: "utf8" });
updatedDafny = true;
} else {
console.log("The current Dafny version is still detected to be " + previousDafnyVersion);
}
await writePackage(packageObj);
return updatedDafny;
}

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

console.log(`Going to proceed to publish ${newVersion}`);
var useNewVersion = false;
if(await isNewer(packageObj, mostRecentDafnyRelease)) {
if (ok(await question(`There is a new Dafny version available: (${mostRecentDafnyRelease}). Do you want to update it? ${ACCEPT_HINT}`))) {
// We keep that number
} else {
console.log("Ignoring new Dafny version.");
mostRecentDafnyRelease = undefined;
}
} else {
mostRecentDafnyRelease = undefined;
}
// Get all the commit messages since the last published tag
await UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion);
await UpdateChangeLog(currentChangeLogVersion, packageObj, updateChangeLogWith, newVersion, mostRecentDafnyRelease);
// All clear, we can modify constants.ts and package.json.

var updatedDafny = await updatePackageJson(packageObj, newVersion, mostRecentDafnyRelease);
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export namespace LanguageServerConstants {
export const LatestStable = 'latest stable release';
export const LatestNightly = 'latest nightly';
export const Custom = 'custom';
export const LatestVersion = '4.8.1';
export const LatestVersion = '4.9.0';
export const UnknownVersion = 'unknown';
export const DafnyGitUrl = 'https://github.com/dafny-lang/dafny.git';
export const DownloadBaseUri = 'https://github.com/dafny-lang/dafny/releases/download';
Expand Down
Loading