@@ -2,6 +2,7 @@ import * as os from 'os';
2
2
import * as fs from 'fs' ;
3
3
import * as path from 'path' ;
4
4
import { promisify } from 'util' ;
5
+ import { versionToNumeric } from '../ui/dafnyIntegration' ;
5
6
6
7
import { workspace , ExtensionContext , Uri , OutputChannel , FileSystemError , window } from 'vscode' ;
7
8
import { Utils } from 'vscode-uri' ;
@@ -212,25 +213,29 @@ export class DafnyInstaller {
212
213
and restart VSCode, which may reinstall Dafny.` ) ;
213
214
return false ;
214
215
}
215
- try {
216
- const process = await this . execLog ( 'javac -version' ) ;
217
- if ( ! ( / j a v a c \d + \. \d + / . exec ( process . stdout ) )
218
- && ! ( / j a v a c \d + \. \d + / . exec ( process . stderr ) ) ) {
219
- throw '' ;
216
+ const configuredVersion = await getConfiguredVersion ( this . context ) ;
217
+ if ( versionToNumeric ( configuredVersion ) < versionToNumeric ( '3.9.0' ) ) {
218
+ try {
219
+
220
+ const process = await this . execLog ( 'javac -version' ) ;
221
+ if ( ! ( / j a v a c \d + \. \d + / . exec ( process . stdout ) )
222
+ && ! ( / j a v a c \d + \. \d + / . exec ( process . stderr ) ) ) {
223
+ throw '' ;
224
+ }
225
+ } catch ( error : unknown ) {
226
+ const errorMsg = error === '' ? 'Javac not found' : `${ error } ` ;
227
+ this . writeStatus ( `${ errorMsg } . Javac is needed because you use a version of Dafny older than 3.9.0. Please install a valid JDK`
228
+ + ' and ensure that the path containing javac is in the PATH environment variable. '
229
+ + 'You can obtain a free open-source JDK 1.8 from here: '
230
+ + 'https://aws.amazon.com/corretto/' ) ;
231
+ return false ;
220
232
}
221
- } catch ( error : unknown ) {
222
- const errorMsg = error === '' ? 'Javac not found' : `${ error } ` ;
223
- this . writeStatus ( `${ errorMsg } . Please install a valid JDK`
224
- + ' and ensure that the path containing javac is in the PATH environment variable. '
225
- + 'You can obtain a free open-source JDK 1.8 from here: '
226
- + 'https://aws.amazon.com/corretto/' ) ;
227
- return false ;
228
233
}
229
234
await this . execLog ( `git clone --recurse-submodules ${ LanguageServerConstants . DafnyGitUrl } ` ) ;
230
235
processChdir ( Utils . joinPath ( installationPath , 'dafny' ) . fsPath ) ;
231
236
await this . execLog ( 'git fetch --all --tags' ) ;
232
- await this . execLog ( `git checkout v${ await getConfiguredVersion ( this . context ) } ` ) ;
233
- await this . execLog ( 'make exe ' ) ;
237
+ await this . execLog ( `git checkout v${ configuredVersion } ` ) ;
238
+ await this . execLog ( 'dotnet build Source/DafnyLanguageServer/DafnyLanguageServer.csproj ' ) ;
234
239
const binaries = Utils . joinPath ( installationPath , 'dafny' , 'Binaries' ) . fsPath ;
235
240
processChdir ( binaries ) ;
236
241
try {
0 commit comments