@@ -43,26 +43,43 @@ async function synchronizeRepositoryWithNewVersionNumber() {
4343 } else {
4444 await bumpVersionNumber ( version ) ;
4545 }
46- //# * Compile Dafny to ensure you have the right version number.
47- await execute ( "make exe" ) ;
48-
49- //# * Compile the standard libraries and update their binaries which are checked in
50- await executeWithTimeout ( "make -C Source/DafnyStandardLibraries update-binary" , 50 * minutes ) ;
46+ //# * Update standard library doo files instead of rebuilding to avoid Z3 timeout issues
47+ const standardLibraryDooFiles = [
48+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries.doo" ,
49+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-js.doo" ,
50+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-cs.doo" ,
51+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-py.doo" ,
52+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-notarget.doo" ,
53+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-java.doo" ,
54+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-go.doo" ,
55+ "Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries-arithmetic.doo"
56+ ] ;
57+
58+ for ( const dooFile of standardLibraryDooFiles ) {
59+ if ( fs . existsSync ( dooFile ) ) {
60+ await updateDooVersion ( dooFile , version ) ;
61+ }
62+ }
5163
5264 // Verify that binaries have been updated.
5365 await sanityCheckStandardLibraries ( version ) ;
5466
55- //# * Recompile Dafny so that standard libraries are in the executable.
56- await execute ( "make exe" ) ;
57-
5867 //# * In the test directory `Source/IntegrationTests/TestFiles/LitTests/LitTest`,
59- await execute (
60- //# * Rebuild `pythonmodule/multimodule/PythonModule1.doo` from `pythonmodule/multimodule/dafnysource/helloworld.dfy`
61- `bash Scripts/dafny build -t:lib ${ TestDirectory } /pythonmodule/multimodule/dafnysource/helloworld.dfy -o ${ TestDirectory } /pythonmodule/multimodule/PythonModule1.doo` ,
62- //# * Rebuild `pythonmodule/nestedmodule/SomeNestedModule.doo` from `pythonmodule/nestedmodule/dafnysource/SomeNestedModule.dfy`
63- `bash Scripts/dafny build -t:lib ${ TestDirectory } /pythonmodule/nestedmodule/dafnysource/SomeNestedModule.dfy -o ${ TestDirectory } /pythonmodule/nestedmodule/SomeNestedModule.doo` ,
64- //# * Rebuild `gomodule/multimodule/test.doo` from `gomodule/multimodule/dafnysource/helloworld.dfy`
65- `bash Scripts/dafny build -t:lib ${ TestDirectory } /gomodule/multimodule/dafnysource/helloworld.dfy -o ${ TestDirectory } /gomodule/multimodule/test.doo` ) ;
68+ //# * Update test doo files instead of rebuilding
69+ //# * Update `pythonmodule/multimodule/PythonModule1.doo` version
70+ //# * Update `pythonmodule/nestedmodule/SomeNestedModule.doo` version
71+ //# * Update `gomodule/multimodule/test.doo` version
72+ const testDooFiles = [
73+ `${ TestDirectory } /pythonmodule/multimodule/PythonModule1.doo` ,
74+ `${ TestDirectory } /pythonmodule/nestedmodule/SomeNestedModule.doo` ,
75+ `${ TestDirectory } /gomodule/multimodule/test.doo`
76+ ] ;
77+
78+ for ( const dooFile of testDooFiles ) {
79+ if ( fs . existsSync ( dooFile ) ) {
80+ await updateDooVersion ( dooFile , version ) ;
81+ }
82+ }
6683
6784 //# * Search for `dafny_version = ` in checked-in `.dtr` files of the `<TestDirectory>`
6885 //# and update the version number.
@@ -100,6 +117,41 @@ async function synchronizeRepositoryWithNewVersionNumber() {
100117 `Source/DafnyRuntime/DafnyRuntime.csproj` , existingVersion ) ;
101118}
102119
120+ async function updateDooVersion ( dooPath , newVersion ) {
121+ const tempDir = `${ dooPath } _temp` ;
122+
123+ try {
124+ // Create temp directory
125+ await execAsync ( `mkdir -p "${ tempDir } "` ) ;
126+
127+ // Unzip doo file
128+ await execAsync ( `unzip -o "${ dooPath } " -d "${ tempDir } "` ) ;
129+
130+ // Read manifest.toml
131+ const manifestPath = `${ tempDir } /manifest.toml` ;
132+ let manifestContent = await fs . promises . readFile ( manifestPath , 'utf-8' ) ;
133+
134+ // Update version
135+ manifestContent = manifestContent . replace (
136+ / d a f n y _ v e r s i o n = " ( \d + \. \d + \. \d + ) \. 0 " / ,
137+ `dafny_version = "${ newVersion } .0"`
138+ ) ;
139+
140+ // Write updated manifest
141+ await fs . promises . writeFile ( manifestPath , manifestContent ) ;
142+
143+ // Rezip
144+ const fileName = dooPath . split ( '/' ) . pop ( ) ;
145+ await execAsync ( `cd "${ tempDir } " && zip -r "../${ fileName } _new" *` ) ;
146+ await execAsync ( `mv "${ tempDir } /../${ fileName } _new" "${ dooPath } "` ) ;
147+
148+ console . log ( `Updated ${ dooPath } to version ${ newVersion } ` ) ;
149+ } finally {
150+ // Cleanup
151+ await execAsync ( `rm -rf "${ tempDir } "` ) . catch ( ( ) => { } ) ;
152+ }
153+ }
154+
103155// Unzips the file Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries.doo (it's actually a zip file)
104156// Fetch the content of Source/DafnyStandardLibraries/binaries/DafnyStandardLibraries/manifest.toml
105157// Verify that dafny_version = "Major.Minor.Patch.0" corresponds ot the version that is provided
0 commit comments