Renamed `dist` target to `install`. Added new target `artifacts` (mainly) for Jenkins builds.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 23 May 2016 22:31:14 +0100
changeset 4 48ec8a59ced4
parent 3 18c56730fabf
child 5 0e2993dac13e
Renamed `dist` target to `install`. Added new target `artifacts` (mainly) for Jenkins builds. As for Smalltalk/X jv-branch project, old tasks defined in `dist-jv.rake` are used. This is a mess, but will be cleaned later (well, I hope it will.)
.hgignore
Rakefile
rakelib/dist-jv.rake
rakelib/dist.rake
rakelib/info.rake
rakelib/install.rake
rakelib/setup.rake
specs/jv-branch.deps.rake
specs/stx-jv.rbspec
--- a/.hgignore	Mon May 23 19:46:10 2016 +0100
+++ b/.hgignore	Mon May 23 22:31:14 2016 +0100
@@ -1,6 +1,6 @@
 syntax: glob
 
 build
-dists
+artifacts
 reports
 .config.rake
--- a/Rakefile	Mon May 23 19:46:10 2016 +0100
+++ b/Rakefile	Mon May 23 22:31:14 2016 +0100
@@ -13,7 +13,7 @@
 import 'rakelib/checkout.rake'
 import 'rakelib/compile.rake'
 import 'rakelib/test.rake'
-import 'rakelib/dist.rake'
+import 'rakelib/install.rake'
 import 'rakelib/dist-jv.rake'
 import 'rakelib/clean.rake'
 
--- a/rakelib/dist-jv.rake	Mon May 23 19:46:10 2016 +0100
+++ b/rakelib/dist-jv.rake	Mon May 23 22:31:14 2016 +0100
@@ -25,13 +25,11 @@
 
 namespace :'dist:jv' do
   task :'variables' do
-
-
     app_name    = project.app_name      || (raise Exception.new("No app_name property specified"))
     app_version = project.app_version   || (raise Exception.new("No app_version property specified"))
     version = app_version.split('_').first
 
-    install_dir = DIST_DIR / 'dist' / "#{app_name}-#{app_version}_#{ARCH}-#{PLATFORM}"
+    install_dir = ARTIFACTS_DIR / BUILD_NAME
     bin_dir = install_dir / 'bin'
     pkg_dir = install_dir / 'lib' / 'smalltalkx' / version / 'packages'
     lib_dir = install_dir / 'lib' / 'smalltalkx' / version / 'lib'
@@ -39,14 +37,12 @@
     rc_dir  = win32? ? bin_dir : lib_dir
     libexec_dir = install_dir / 'lib' / 'smalltalkx' / version / 'bin'
 
-    # install_dir_doc = DIST_DIR / 'docs' / "#{app_name}-#{app_version}_docs"
+    # install_dir_doc = ARTIFACTS_DIR / 'docs' / "#{app_name}-#{app_version}_docs"
     # doc_dir = install_dir_doc / 'share' / 'doc' / 'smalltalkx' / version
 
     install_dir_doc = install_dir
     doc_dir = install_dir / 'lib' / 'smalltalkx' / version
 
-
-
     # HACK to make dirs globally available in 'post' rules...
     $install_jv_dirs = {
       :install_dir => install_dir,
@@ -63,8 +59,8 @@
 
 
 
-  desc "Installs jv-branch SDK into #{DIST_DIR}"
-  task :'all' => [:'pre', :'main',:'post', :'archive' ]
+  desc "Installs Smalltalk/X jv-branch into #{ARTIFACTS_DIR}/${BUILD_NAME}"
+  task :'all' => [:'pre', :'main',:'post']
 
   task :'pre'
   task :'post'
@@ -218,30 +214,6 @@
     end
   end
 
-  task :'archive' => :'variables' do
-    chdir File.dirname install_dir do
-      if win32?
-  sh *%W{zip -q -r  ..\\#{File.basename(install_dir)}.zip #{File.basename(install_dir)}}
-      else
-  sh *%W{tar cjf ../#{File.basename(install_dir)}.tar.bz2 #{File.basename(install_dir)}}
-      end
-    end
-  end
-
-
-  task :'archive-doc' => :'variables' do
-    if install_dir_doc != pkg_dir then
-      chdir File.dirname install_dir_doc do
-        if win32?
-          sh *%W{zip -q -r  ..\\#{File.basename(install_dir_doc)}.zip #{File.basename(install_dir_doc)}}
-        else
-          sh *%W{tar cjf ../#{File.basename(install_dir_doc)}.tar.bz2 #{File.basename(install_dir_doc)}}
-        end
-      end
-    end
-  end
-
-
   task :'doc' => :'variables' do
     mkdir_p doc_dir
     puts BUILD_DIR / 'stx' / 'doc'
--- a/rakelib/dist.rake	Mon May 23 19:46:10 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-require 'rbconfig'
-PLATFORM = win32? ? 'win32' : RbConfig::CONFIG['host_os']
-
-task :'dist' => [ :'compile',
-                  :'dist:pre',
-                  :'dist:main',
-                  :'dist:post' ]
-
-namespace :'dist' do
-  task :'pre'
-  task :'post'
-
-  task :'main'
-
-  directory DIST_DIR
-
-  task :'install-archive' => [ :'setup' , DIST_DIR, :'install' ] do
-    
-    install_dir = BUILD_NAME
-    chdir DIST_DIR do 
-      if win32? 
-        info "Archiving build tree in #{install_dir}.zip"
-        sh "..\\bin\\zip.exe -r  \"#{install_dir}.zip\" #{install_dir}"
-      else
-        info "Archiving build tree in #{install_dir}.tar.bz2"
-        sh *%W{tar cjf #{install_dir}.tar.bz2 #{install_dir}}
-      end
-    end
-    
-  end
-
-  
-  task :'install' => [ :'setup' , DIST_DIR ] do
-    install_dir = DIST_DIR / BUILD_NAME
-    build_dir = BUILD_DIR / project.application.directory    
-    executable = project.application.executable()
-    mkdir_p install_dir
-   
-    if win32?
-      cp build_dir / '*.dll' , install_dir
-      cp build_dir / "#{executable}.exe" , install_dir
-      cp build_dir / 'modules.stx' , install_dir
-      cp build_dir / 'symbols.stc' , install_dir
-    else
-      cp build_dir / '*.so' , install_dir
-      cp build_dir / executable, install_dir
-
-    end
-
-    cp_r build_dir / '*.rc', install_dir
-    cp_rx build_dir / 'resources', install_dir do | fname |
-      /\.hg|\.svn|CVS|\.cvsignore|tests/.match(fname) == nil
-    end
-    # Under Windows, bitmaps go to special directory rather than 
-    # into resources, so we need copy them too...
-
-    if win32? then
-      cp_rx build_dir / 'bitmaps', install_dir do | fname |
-        /\.hg|\.svn|CVS|\.cvsignore|tests/.match(fname) == nil
-      end
-    end
-
-  end
-
-
-  task :'build-tree' => [ :'setup' , DIST_DIR ] do
-             
-    #fname = File.expand_path(DIST_DIR / "#{BUILD_NAME}_build-tree")
-    #error "no archive name" if not fname
-
-    #if (File.expand_path('.') == File.dirname(File.expand_path(DIST_DIR))) 
-    #  dir_to_archive = File.basename(File.expand_path("."))
-    #  dir_where_archive = File.dirname(File.expand_path("."))
-    #else
-    #  dir_to_archive = File.basename(File.expand_path(DIST_DIR))
-    #  dir_where_archive = File.dirname(File.expand_path(DIST_DIR))
-    #end
-
-    #hdir dir_where_archive do 
-    #  if win32? 
-    #    info "Archiving build tree in #{File.basename(fname)}.zip"
-    #    sh "zip -r  \"#{fname}.zip\" *"
-    #  else
-    #    info "Archiving build tree in #{File.basename(fname)}.tar.bz2"
-    #    sh *%W{tar cjf #{fname}.tar.bz2} + Dir.glob('*')
-    #  end
-    #end
-  end
-
-
-end
--- a/rakelib/info.rake	Mon May 23 19:46:10 2016 +0100
+++ b/rakelib/info.rake	Mon May 23 22:31:14 2016 +0100
@@ -122,15 +122,8 @@
 
 ##### STX_RAKEFILES stuff ends here ######
 
-
-
 namespace :'info' do
 
-  desc "Print current platform (win32/linux)"
-  task :'platform' do
-    puts PLATFORM
-  end
-
   namespace :'project' do
     
     desc "Print project name"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rakelib/install.rake	Mon May 23 22:31:14 2016 +0100
@@ -0,0 +1,32 @@
+
+task :'install' => [ :'compile',
+                     :'install:pre',
+                     :'install:main',
+                     :'install:post' ]
+
+namespace :'install' do
+  task :'pre'
+  task :'post'
+  task :'main'  
+end
+
+task :'artifacts' => [ :'install',
+                     :'artifacts:pre',
+                     :'artifacts:main',
+                     :'artifacts:post' ]
+
+namespace :'artifacts' do
+  task :'pre'
+  task :'post'
+  task :'main' => :'setup' do 
+    if File.exist? ARTIFACTS_DIR / BUILD_NAME then
+      chdir ARTIFACTS_DIR do
+        if win32?
+          sh *%W{zip -q -r #{BUILD_NAME}.zip #{BUILD_NAME}}
+        else
+          sh *%W{tar cjf #{BUILD_NAME}.tar.bz2 #{BUILD_NAME}}
+        end
+      end        
+    end
+  end
+end
--- a/rakelib/setup.rake	Mon May 23 19:46:10 2016 +0100
+++ b/rakelib/setup.rake	Mon May 23 22:31:14 2016 +0100
@@ -1,5 +1,5 @@
 defined? BUILD_DIR or BUILD_DIR = 'build'
-defined? DIST_DIR or DIST_DIR = 'dists'
+defined? ARTIFACTS_DIR or ARTIFACTS_DIR = 'artifacts'
 defined? REPORT_DIR or REPORT_DIR = 'reports'
 defined? DEBUG or DEBUG = nil
 
@@ -23,7 +23,7 @@
     ARCH = RbConfig::CONFIG['host_cpu']
   end
   if ARCH != 'i386' && ARCH != 'x86_64' then
-    raise new Exception("Unsupported architecture #{ARCH}")
+    raise Exception.new("Unsupported architecture #{ARCH}")
   end
 end
 
@@ -113,16 +113,11 @@
 task :'setup:project' =>  :'setup:projects'  do
   error("PROJECT variable not defined!") if not defined? PROJECT
   project! PROJECT.to_sym
-
-
-
   project.apply_imports()
-
   app_name    = project.app_name    || 'smalltalkx'
   app_version = project.app_version || '6.2.5'
 
-  defined? BUILD_NAME or BUILD_NAME = "#{app_name}-#{app_version}_#{ARCH}-#{PLATFORM}"
-
+  defined? BUILD_NAME or BUILD_NAME = "#{app_name}-#{app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}"
 end
 
 task :'setup:tasks' => :'setup:tasks:internal'
@@ -133,7 +128,6 @@
     t.define!
   end
 
-
   # compute required packages - bit hacky!
   pkgs_all  = project.packages.collect { | p | p.name }
   if project.application
--- a/specs/jv-branch.deps.rake	Mon May 23 19:46:10 2016 +0100
+++ b/specs/jv-branch.deps.rake	Mon May 23 22:31:14 2016 +0100
@@ -154,7 +154,7 @@
 task "stx:goodies/loggia" => "stx:libbasic"
 task "stx:goodies/loggia" => "stx:libboss"
 
+task "stx:goodies/regex" => "stx:libbasic"
 
 
 
-
--- a/specs/stx-jv.rbspec	Mon May 23 19:46:10 2016 +0100
+++ b/specs/stx-jv.rbspec	Mon May 23 22:31:14 2016 +0100
@@ -289,8 +289,6 @@
 
   #package "stx:goodies/builder/reports", :repository => :'swing:baseline', :link => false
 
-
-
   tasks do
     task "stx:projects/smalltalk" => "stx:libwebkit"
     task "stx:projects/smalltalk" => "stx:libjava"
@@ -307,20 +305,17 @@
     task 'stx:projects/smalltalk' => 'stx:goodies/ring'
     task 'stx:projects/smalltalk' => 'stx:goodies/libcairo'
     task "stx:goodies/builder/reports" => 'stx:libbasic'
-
-    task :'dist:main' => :'dist:build-tree'
-    task :'dist:main' => :'dist:jv-branch'
-
-
+  
+    task :'install:main' => :'dist:jv-branch'
 
     task :'dist:jv:pre' => :'stx:jv-branch:extractver'
 
     if win32?     	
-			app_name    = project.app_name      || (raise Exception.new("No app_name property specified"))
+      app_name    = project.app_name      || (raise Exception.new("No app_name property specified"))
 	    app_version = project.app_version   || (raise Exception.new("No app_version property specified"))
 	    version = app_version.split('_').first
 
-	    install_dir = DIST_DIR / 'dist' / "#{app_name}-#{app_version}_#{ARCH}-#{PLATFORM}"
+	    install_dir = ARTIFACTS_DIR / BUILD_NAME
 	    bin_dir = install_dir / 'bin'
 
 	    cairo_dll_dir = nil
@@ -360,16 +355,15 @@
     	end
     end
 
-    task :'dist:jv-branch' => [ :'dist:jv:all',
-                                :'dist:jv:archive',
-                                # Documentation
-                                :'dist:jv:doc' ,
-                                :'dist:jv:archive-doc' ]
+    task :'dist:jv-branch' => [ :'dist:jv:all',                                                          
+                                :'dist:jv:doc' ]
 
+    task :'install:main' => [:'stx:jv-branch:extractver']
+    task :'artifacts:main' => [:'stx:jv-branch:extractver']
   end
 end
 
-task :'stx:jv-branch:extractver' do
+task :'stx:jv-branch:extractver' => :'setup' do
   ver = nil
   if win32?
     stx_exe = 'stx.com'
@@ -384,6 +378,8 @@
   end
   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']}"
 end
 
 
@@ -400,9 +396,8 @@
          end
       end
     end
-
-    clear :'dist:main' => :'dist:build-tree'
-    clear :'dist:main' => :'dist:jv-branch'
+    
+    clear :'dist:install' => :'dist:jv-branch'
   end
 end