Added support for canonical, upstream and staging repositores.
Each repository (forest) can now specify three repository URLS
- (mandatory), "upstream: and "staging" repository (bothoptional).
When a "staging" repository is configured, commits are first
pulled from "staging" repository and then from "canonical"
(assuming "staging" repository is local so this should avoid
network trafic to canonical repositories).
When an "upstream" repository is configured, changes are pulled
from an "upstream" after pulling fron "staging" but before pulling
from a canonical repository.
This allows to define a hierarchy of repositories for staged
development. This means, it allows for changes (commits) to go
from one repository to another before eventually reaching
a canonical repository from which official builds should be
done. At each step commits should be verified and tested before
they're pushed to upstream to avoid pushing broken code.
load "jv-branch.deps.rake"
# 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)
plat = nil
blob = nil
sha256 = nil
if win32? then
plat = 'Windows'
elsif linux?
plat = 'Linux'
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
if artifact.name.end_with? '.sha256' then
sha256 = artifact
else
blob = artifact
end
end
end
if not blob then
error "No artifact matching given pattern found"
end
puts "Downloading binary component #{blob.name}"
blob.download_to(directory)
if sha256 then
sha256.download_to(directory)
end
unzip directory / blob.name, remove: true
rm_f directory / sha256.name
end
project :'stx:jv-branch-core' do
# Core Smalltalk/X - does contain only standard libraries,
# and development tools. Does not contain any other 'features'
# like XML suite, Java support. Usable as a basis for standalone
# applications that needs some JV-branch features.
import :'stx:baseline'
# FORKED libraries
# ======================================================================
package "stx:libbasic", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libbasic2", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libbasic3", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libcomp", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libtool", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libview", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libview2", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libwidg", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libwidg2", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:goodies/sunit", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:goodies/monticello", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:goodies/refactoryBrowser", :repository => :'bitbucket:janvrany', :branch => 'jv'
package "stx:libsvn", :repository => :'bitbucket:janvrany', :branch => 'jv'
# Some more development tools to build and preload
# ======================================================================
package "stx:goodies/xml/vw", :repository => :'exept:public'
package "stx:goodies/xml/stx", :repository => :'exept:public'
# SmallSense
package "stx:goodies/regex", :repository => :'exept:public'
package "stx:goodies/smallsense", :repository => :'bitbucket:janvrany'
package "stx:goodies/smallsense/refactoring_custom"
tasks do
# Build and install documentation for stx:libjava and stx:libscm/mercurial
task "install:pre" do
chdir BUILD_DIR / 'stx' / 'libjava' do
make "doc-install"
end
chdir BUILD_DIR / 'stx' / 'libscm' / 'mercurial' do
make "doc-install"
end
end
redefine BUILD_DIR / 'stx' / 'stc' => BUILD_DIR do
if core_developer? or jenkins? then
checkout :'swing:private:hg', 'stx/stc', :branch => 'jv'
else
download_blob_matching(/prebuilt-stc/, BUILD_DIR / 'stx')
end
end
redefine BUILD_DIR / 'stx' / 'librun' => BUILD_DIR do
if core_developer? or jenkins? then
checkout :'swing:private:hg', 'stx/librun', :branch => 'jv'
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
chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
if win32?
cmd = "smalltalk.bat -I --quick --eval \"Stdout nextPutLine:'OKay, VM runs'. Smalltalk exit: 0\""
else
cmd = "./smalltalk -I --quick --eval \"Stdout nextPutLine:'OKay, VM runs'. Smalltalk exit: 0\""
end
if not system cmd
raise Exception.new("Cannot run smalltalk!")
end
end
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
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
end
end
end
end
project :'stx:jv-branch' do
# Standard Smalltalk/X IDE with some nice libraries preloaded
import :'stx:jv-branch-core'
app_name "smalltalkx-jv-branch"
app_version "6.2.5_#{BUILD_ID}"
# Forked PetitParser
package "stx:goodies/petitparser", :repository => :'bitbucket:janvrany', :link => false
package "stx:goodies/petitparser/tests", :link => false
package "stx:goodies/petitparser/analyzer", :link => false
package "stx:goodies/petitparser/analyzer/tests", :link => false
# Monticello
package "stx:libcompat", :repository => :'exept:public'
package "stx:goodies/communication", :repository => :'exept:public'
# Java support
package "stx:libjava", :repository => :'bitbucket:janvrany'
package "stx:libjava/tools"
package "stx:libjava/experiments"
#package "stx:libjava/examples" :link => false
# Smalltalk/X IDE
application 'stx:projects/smalltalk', :repository => :'bitbucket:janvrany', :branch => 'jv'
package 'stx:libscm', :repository => :'bitbucket:janvrany'
package 'stx:libscm/common', :repository => :'bitbucket:janvrany'
package 'stx:libscm/mercurial', :repository => :'bitbucket:janvrany'
package 'stx:libscm/mercurial/monticello', :repository => :'bitbucket:janvrany'
package 'stx:goodies/ring', :repository => :'bitbucket:janvrany', :link => false
package 'stx:goodies/libcairo', :repository => :'bitbucket:janvrany', :link => false
package 'stx:goodies/cypress', :repository => :'bitbucket:janvrany'
package "stx:goodies/xmlsuite", :repository => :'bitbucket:janvrany'
package "stx:goodies/loggia", :repository => :'exept:public'
package 'stx:goodies/smaCC',:repository => :'bitbucket:janvrany'
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
tasks do
task "stx:projects/smalltalk" => "stx:libwebkit"
task "stx:projects/smalltalk" => "stx:libjava"
task "stx:projects/smalltalk" => "stx:libjava/tools"
task "stx:projects/smalltalk" => "stx:libjava/experiments"
#task "stx:libjava/examples" => "stx:libjava"
#task "stx:projects/smalltalk" => "stx:libjava/examples"
task 'stx:projects/smalltalk' => 'stx:goodies/loggia'
task 'stx:projects/smalltalk' => 'stx:goodies/monticello'
task 'stx:projects/smalltalk' => 'stx:goodies/cypress'
task 'stx:projects/smalltalk' => 'stx:libscm/mercurial'
task 'stx:projects/smalltalk' => 'stx:libscm/mercurial/monticello'
task 'stx:projects/smalltalk' => 'stx:goodies/builder/reports'
task 'stx:projects/smalltalk' => 'stx:goodies/ring'
task 'stx:projects/smalltalk' => 'stx:goodies/libcairo'
task "stx:goodies/builder/reports" => 'stx:libbasic'
# We need to checkout CharacterEncoderCodeGenerator from stx:goodies
# because RegressionTests::CharacterTests>>test01_CaseTesting needs that.
task 'checkout:post' => BUILD_DIR / 'goodies' / 'CharacterEncoderCodeGenerator.st'
file BUILD_DIR / 'goodies' / 'CharacterEncoderCodeGenerator.st' do
checkout(:'exept:public', 'stx/goodies/CharacterEncoderCodeGenerator.st')
end
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_version = project.app_version || (raise Exception.new("No app_version property specified"))
version = app_version.split('_').first
install_dir = ARTIFACTS_DIR / BUILD_NAME
bin_dir = install_dir / 'bin'
cairo_dlls = nil
if ARCH == 'i386'
cairo_dlls = [
'libcairo-2.dll' ,
'libfontconfig-1.dll' ,
'libfreetype-6.dll' ,
'liblzma-5.dll' ,
'libpixman-1-0.dll' ,
'libpng15-15.dll' ,
'libxml2-2.dll' ,
'zlib1.dll'
]
else
cairo_dlls = [
'fontconfig.dll' ,
'iconv.dll' ,
'libcairo-2.dll' ,
'libpng16.dll' ,
'libxml2.dll' ,
'pixman-1.dll' ,
'zlib1.dll'
]
end
task :'dist:jv:post' => [ :'stx:jv-branch:extractver' , :'dist:jv:variables' ]
cairo_dlls.each do | dll |
task :'dist:jv:post' => [ bin_dir / dll ]
file bin_dir / dll do
mkdir_p bin_dir
cp BUILD_DIR / 'stx' / 'goodies' / 'libcairo' / 'support' / 'win32' / (ARCH == 'i386' ? 'i586' : ARCH) / dll , bin_dir / dll
end
end
end
task :'dist:jv-branch' => [ :'dist:jv:all',
:'dist:jv:doc' ]
task :'install:main' => [:'stx:jv-branch:extractver']
task :'artifacts:main' => [:'stx:jv-branch:extractver']
task :'artifacts:post' => [:'stx:jv-branch:extractver'] do
# Just to be sure, refuse to create stc and librun archives
# if the directory contain sources. This is to prevent accidental
# leak of non-disclosed sources. Better safe than sorry!
if core_developer? || (File.exist? BUILD_DIR / 'stx' / 'stc' / '.hg') || (File.exist? BUILD_DIR / 'stx' / 'stc' / 'CVS') then
puts "WARNING: NOT CREATING stc archive since directory contains sources!!!"
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"
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"
end
end
end
end
task :'stx:jv-branch:extractver' => :'setup' do
ver = nil
if win32?
stx_exe = 'stx.com'
else
stx_exe = './stx'
end
chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
ver = %x(#{stx_exe} --eval "Stdout nextPutAll: Smalltalk versionString")
if $?.exitstatus != 0
raise Exception.new("Failed extract version from stx")
end
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
project :'stx:jv-branch:for-reports-only' do
import :'stx:jv-branch'
tasks do
task :'stx:projects/smalltalk:pre' do
chdir BUILD_DIR / 'stx' / 'projects' / 'smalltalk' do
if win32?
system "bmake clobber"
else
system "make clobber"
end
end
end
clear :'dist:install' => :'dist:jv-branch'
end
end