Rakefiles: update VM's symbol database after a package compiled
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 02 Aug 2017 20:21:39 +0100
changeset 133 8229af6e81df
parent 132 076776f79023
child 134 78f8c3f3390d
Rakefiles: update VM's symbol database after a package compiled ...with `+commonSymbols` is recompiled. If not done, the VM will crash or otherwise malfunction. This is done at the end of full build, this (together with previous two commits) allows user to recompile a package by simple: rake stx:libview This should do all the necessary steps to compile a package and setup newly compiled `.dll` / `.so` within the build tree. However, it *does not* recompile all packages depending on the one recompiled - if a class shape changed, one still must manually recompile all dependent packages.
rakelib/compile.rake
rakelib/setup.rake
--- a/rakelib/compile.rake	Wed Aug 02 09:32:08 2017 +0100
+++ b/rakelib/compile.rake	Wed Aug 02 20:21:39 2017 +0100
@@ -384,9 +384,35 @@
 end
 
 
+task "stx:librun:symbols"
+
 #
 # Various compilation hacks here and there (sigh)
 # 
+desc "Update the VM symbol database"
+task 'stx:librun:symbols' do | task |    
+  symbols_stc = BUILD_DIR / 'stx' / 'include' / 'symbols.stc'
+  if unix?
+    # UNIX VMs have the symbol database built into the binary as
+    # static data so we need to recompile the VM
+    stx_librun = project.package('stx:librun')
+    stx_librun_dll = BUILD_DIR / stx_librun.directory() / OBJ_DIR / stx_librun.dll_name()
+
+    if not uptodate?(stx_librun_dll, [ symbols_stc ]) then
+      Rake::Task["stx:librun"].reenable()
+      Rake::Task["stx:librun"].invoke()
+    end
+  elsif win32? 
+    # Windows VM reads the symbol database from a file `symbols.stc` located
+    # alongside the program executable so we need to copy that file
+    app = project.application
+    symbols_stc_in_app_directory = BUILD_DIR / app.directory() / 'symbols.stc'
+    if not uptodate?(symbols_stc_in_app_directory, [ symbols_stc ]) then
+      cp symbols_stc, symbols_stc_in_app_directory
+    end
+  end
+  task.reenable()
+end
 
 if unix?
   # A hack for Debian (and possibly other Linux distros) that does not ship
@@ -399,3 +425,4 @@
 
 
 
+
--- a/rakelib/setup.rake	Wed Aug 02 09:32:08 2017 +0100
+++ b/rakelib/setup.rake	Wed Aug 02 20:21:39 2017 +0100
@@ -212,6 +212,12 @@
     #end
 
     task "#{pkg.name}" => [ :'setup:dependencies' , "#{pkg.name}:dependencies", "#{pkg.name}:pre", "#{pkg.name}:main", "#{pkg.name}:post" ]
+    
+    # For Smalltalk class libraries, we have to update VM symbol database
+    # if changed...
+    if pkg.name != 'stx:stc' && pkg.name != 'stx:librun' then
+      task "#{pkg.name}" => [ 'stx:librun:symbols' ]  
+    end
 
     task "#{pkg.name}:dependencies"
     task "#{pkg.name}:pre"