specs/stx-jv.rbspec
branchfeature-block-in-context
changeset 159 cbc152f322a8
parent 99 394937f3f608
parent 110 da2585640b0c
child 160 95149f95cb5c
--- a/specs/stx-jv.rbspec	Tue Dec 06 21:32:24 2016 +0000
+++ b/specs/stx-jv.rbspec	Sat Dec 31 22:47:53 2016 +0000
@@ -1,3 +1,6 @@
+def build_platform_id() 
+  return "#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}"
+end
 # A helper function to download and unpack pre-built stc and librun
 # for those who are not lucky enough to have an access to sources
 def download_blob_matching(pattern, directory)
@@ -11,9 +14,10 @@
   else        
     error_unsupported_platform()
   end
-  build = Jenkins::Build.new(%Q{https://swing.fit.cvut.cz/jenkins/job/stx_jv/ARCH=#{ARCH},PLATFORM=#{plat}N/lastSuccessfulBuild})
-  build.artifacts.each do | artifact |
-    if pattern =~ artifact.name then
+  build = Jenkins::Build.new(%Q{https://swing.fit.cvut.cz/jenkins/job/stx_jv/lastSuccessfulBuild})
+  platform = build_platform_id()
+  build.artifacts.each do | artifact |    
+    if (pattern =~ artifact.name) and (artifact.name.include? platform) then
       if artifact.name.end_with? '.sha256' then
         sha256 = artifact
       else
@@ -42,6 +46,41 @@
   # applications that needs some JV-branch features.
   import :'stx:baseline'
 
+  # FORKED STC and librun
+  package "stx:stc", :repository => :'swing:private:hg', :branch => 'jv', revision: 'feature-block-in-context',
+    :checkout => (Proc.new do | pkg |
+    # Download pre-compiled binary if user has no access to source code    
+    if Rake::Stx::Configuration::Repository::find(pkg.repository) then
+          checkout pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
+    else
+        download_blob_matching(/prebuilt-stc/, BUILD_DIR / 'stx')
+      end
+    end),
+    :update => (Proc.new do | pkg |
+      if (File.exists? BUILD_DIR / 'stx' / 'stc' / '.hg' / 'hgrc') then
+        update pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
+      else
+        warn "Not updating #{pkg.name} as no HG repository found in #{BUILD_DIR / 'stx' / 'stc'}"
+    end
+  end)
+
+  package "stx:librun", :repository => :'swing:private:hg', :branch => 'jv', revision: 'feature-block-in-context',
+    :checkout => (Proc.new do | pkg |
+    # Download pre-compiled binary if user has no access to source code
+    if Rake::Stx::Configuration::Repository::find(pkg.repository) then
+          checkout pkg.repository, 'stx/librun', :branch => pkg.branch, :revision => pkg.revision
+    else
+        download_blob_matching(/prebuilt-librun/, BUILD_DIR / 'stx')
+      end
+    end),
+    :update => (Proc.new do | pkg |
+      if (File.exists? BUILD_DIR / 'stx' / 'librun' / '.hg' / 'hgrc') then
+        update pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
+      else
+        warn "Not updating #{pkg.name} as no HG repository found in #{BUILD_DIR / 'stx' / 'librun'}"
+    end
+  end)
+
   # FORKED libraries
   # ======================================================================
   package "stx:libbasic", :repository => :'bitbucket:janvrany', :branch => 'jv'
@@ -82,22 +121,6 @@
       end
     end
 
-    redefine BUILD_DIR / 'stx' / 'stc' => BUILD_DIR do
-      if Rake::Stx::Configuration::Repository::find(:'swing:private:hg') then
-        checkout :'swing:private:hg', 'stx/stc', :branch => 'jv', :revision => 'feature-block-in-context'
-      else
-        download_blob_matching(/prebuilt-stc/, BUILD_DIR / 'stx')
-      end
-    end
-
-    redefine BUILD_DIR / 'stx' / 'librun' => BUILD_DIR do      
-      if Rake::Stx::Configuration::Repository::find(:'swing:private:hg') then
-        checkout :'swing:private:hg', 'stx/librun', :branch => 'jv', :revision => 'feature-block-in-context'
-      else        
-        download_blob_matching(/prebuilt-librun/, BUILD_DIR / 'stx')
-      end
-    end
-
     # Try execute run the VM if it starts up
     task :'compile:post' do
       if PROJECT == 'stx:jv-branch' then  
@@ -114,57 +137,40 @@
       end
     end
         
-  if win32_wine?
-
-    task :'stx:projects/smalltalk:pre' do   
-      chdir (BUILD_DIR / 'stx' / 'projects' / 'smalltalk') do   
-        make "buildDate.h"    
-      end
-    end
-
-    task :'stx:goodies/xmlsuite/xmlreaderimpl:pre' do
-      chdir (BUILD_DIR / 'stx' / 'goodies' / 'xmlsuite' / 'xmlreaderimpl') do
-        [
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'xmlwf',
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpat',
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpatw',
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpat_static',
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'libexpatw_static',
-          'support' / 'expat-2.0.1' / 'bcb5' / 'release' /'obj' / 'examples'
-        ].each do | f |
-          if not File.exists?(f)
-            mkdir_p f
-          end
+    if win32_wine?
+      task :'stx:projects/smalltalk:pre' do   
+        chdir (BUILD_DIR / 'stx' / 'projects' / 'smalltalk') do   
+          make "buildDate.h"    
         end
       end
-    end
+
     end
 
     # Hack for badly-named files in libtool
     task :'stx:libtool:post' do
       chdir (BUILD_DIR / 'stx' / 'libtool') do
-  # Windows does not support symlinks, copy the file
-  if win32?
-    if not File.exist? 'Tools_BrowserList.STH'
-      cp 'Tools__BrowserList.STH', 'Tools_BrowserList.STH'
-    end
-    if not File.exist? 'Tools_NavigatorModel.STH'
-      cp 'Tools__NavigatorModel.STH', 'Tools_NavigatorModel.STH'
-    end
-    if not File.exist? 'Tools_NavigationState.STH'
-      cp 'Tools__NavigationState.STH', 'Tools_NavigationState.STH'
-    end
-  else
-    if not File.exist? 'Tools_BrowserList.H'
-      ln_s 'Tools__BrowserList.H', 'Tools_BrowserList.H'
-    end
-    if not File.exist? 'Tools_NavigatorModel.H'
-      ln_s 'Tools__NavigatorModel.H', 'Tools_NavigatorModel.H'
-    end
-    if not File.exist? 'Tools_NavigationState.H'
-      ln_s 'Tools__NavigationState.H', 'Tools_NavigationState.H'
-    end
-  end
+        # Windows does not support symlinks, copy the file
+        if win32?
+          if not File.exist? 'Tools_BrowserList.STH'
+            cp 'Tools__BrowserList.STH', 'Tools_BrowserList.STH'
+          end
+          if not File.exist? 'Tools_NavigatorModel.STH'
+            cp 'Tools__NavigatorModel.STH', 'Tools_NavigatorModel.STH'
+          end
+          if not File.exist? 'Tools_NavigationState.STH'
+            cp 'Tools__NavigationState.STH', 'Tools_NavigationState.STH'
+          end
+        else
+          if not File.exist? 'Tools_BrowserList.H'
+            ln_s 'Tools__BrowserList.H', 'Tools_BrowserList.H'
+          end
+          if not File.exist? 'Tools_NavigatorModel.H'
+            ln_s 'Tools__NavigatorModel.H', 'Tools_NavigatorModel.H'
+          end
+          if not File.exist? 'Tools_NavigationState.H'
+            ln_s 'Tools__NavigationState.H', 'Tools_NavigationState.H'
+          end
+        end
       end
     end
   end
@@ -211,27 +217,17 @@
   package "stx:goodies/xmlsuite", :repository => :'bitbucket:janvrany'  
   package "stx:goodies/loggia", :repository => :'exept:public', :link => false
   package 'stx:goodies/smaCC',:repository => :'bitbucket:janvrany'
-  package 'stx:goodies/regression',:repository => :'bitbucket:janvrany', :branch => 'jv', :revision => 'feature-block-in-context', :link => false
+  package 'stx:goodies/regression',:repository => :'bitbucket:janvrany', :branch => 'jv', :link => false
   package "stx:goodies/builder", :repository => :'bitbucket:janvrany',:branch => 'jv', :link => false
   package "stx:goodies/builder/reports"
 
   # Define a "default" test suite, i.e., a set of tests that are run when
   # user does `rake test`. 
-  # The test suite is defined conditionally only when not running under SWING Jenkins. 
-  # Though this is hacky, I'd like a Jenkins job to build exactly the same 
-  # project as user to make sure they're in sync. However, under Jenkins I don't
-  # want them to run - for running tests we have other jobs which run them under
-  # different configurations. 
-  #
-  # This hack will go as soon as SWING Jenkins will switch to pipeline
-  #
-  if (ENV['USER'] != 'builder') and (ENV['USERNAME'] != 'builder') then
-    package 'stx:libview/tests', :test => true;
-    package 'stx:libjava', :test => true;
-    package 'stx:libjava/tools', :test => true;
-    package 'stx:goodies/regression', :test => true;
-    package 'stx:libscm/mercurial', :test => true;
-  end
+  package 'stx:libview/tests', :test => true;
+  package 'stx:libjava', :test => true;
+  package 'stx:libjava/tools', :test => true;
+  package 'stx:goodies/regression', :test => true;
+  package 'stx:libscm/mercurial', :test => true;
 
   tasks do
     # We need to checkout CharacterEncoderCodeGenerator from stx:goodies
@@ -302,14 +298,14 @@
       else
         # Be paranoid, do cleanup here. Should have been done, but who knows...
         cleanup_stc() 
-    	  zip BUILD_DIR / 'stx' / 'stc' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}_prebuilt-stc"
+    	  zip BUILD_DIR / 'stx' / 'stc' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{build_platform_id()}_prebuilt-stc"
       end
       if core_developer? || (File.exist? BUILD_DIR / 'stx' / 'librun' / '.hg') || (File.exist? BUILD_DIR / 'stx' / 'librun' / 'CVS') then
         puts  "WARNING: NOT CREATING librun archive since directory contains sources!!!"
       else
         # Be paranoid, do cleanup here. Should have been done, but who knows...
         cleanup_librun() 
-    	  zip BUILD_DIR / 'stx' / 'librun' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}_prebuilt-librun"
+    	  zip BUILD_DIR / 'stx' / 'librun' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{build_platform_id()}_prebuilt-librun"
       end
     end
   end
@@ -331,13 +327,21 @@
   ver = (ver.split(".")[0..2]).join(".")
   project.app_version "#{ver}_#{BUILD_ID}"
   # This is really ugly. We need to clean that up...
-  BUILD_NAME.replace "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}"
+  BUILD_NAME.replace "#{project.app_name}-#{project.app_version}_#{build_platform_id()}"
 end
 
 
 project :'stx:jv-branch:for-reports-only' do
   import :'stx:jv-branch'
 
+  # Sigh, if we're about to run tests only, we don't want to
+  # run standard tests so we need to clean test flag. 
+  package 'stx:libview/tests', :test => false;
+  package 'stx:libjava', :test => false;
+  package 'stx:libjava/tools', :test => false;
+  package 'stx:goodies/regression', :test => false;
+  package 'stx:libscm/mercurial', :test => false;
+
   tasks do
     task :'stx:projects/smalltalk:pre' do
       chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do