Rake task for reprocessing data, setting up config files etc inside sandbox folder

This commit is contained in:
Emil Tin 2011-12-03 14:30:07 +01:00
parent 1c38827b55
commit 3c5ce306a7
4 changed files with 60 additions and 5 deletions

4
.gitignore vendored
View File

@ -39,9 +39,9 @@ SconsBuilder*
.scon*
.build
# Rake build directory #
# sandbox directory #
#######################
build
sandbox
# Eclipse related files #
#########################

55
Rakefile Normal file
View File

@ -0,0 +1,55 @@
sandbox = "sandbox" #where to locate builds, server configs and test data
osm_data = "amager" #name of OSM data file
desc "Recompile, reprocess OSM data and run server"
task :default => [:compile, :process, :run]
desc "Compile"
task :compile do
system "scons"
end
file "#{sandbox}/amager.osm.pbf" => "amager.osm.pbf" do |t|
system "cp #{t.prerequisites.join} #{t.name}"
end
desc "Reprocess OSM test data"
task :process => ["#{sandbox}/amager.osm.pbf", :setup] do
prev = Dir.pwd
cd sandbox #we must be in the sandbox folder to use the speedprofile.ini in that folder
system "./osrm-extract amager.osm.pbf"
system "./osrm-prepare amager.osrm amager.osrm.restrictions"
cd prev
end
desc "Setup server files"
task :setup => ["#{sandbox}/speedprofile.ini", "#{sandbox}/extractor.ini", "#{sandbox}/server.ini"]
file "#{sandbox}/speedprofile.ini" => "speedprofile.ini" do |t|
system "cp #{t.prerequisites.join} #{t.name}"
end
file "#{sandbox}/extractor.ini" => "extractor.ini" do |t|
system "cp #{t.prerequisites.join} #{t.name}"
end
file "#{sandbox}/server.ini" => "server.ini" do |t|
#first time the file is copied, we adjusts server settings to point to data files in our sandbox folder
text = File.read(t.prerequisites.join)
text.gsub!('/opt/osm/germany', "#{Dir.pwd}/sandbox/#{osm_data}")
file = File.new( t.name, "w+")
file.puts text
file.close
end
desc "Run the OSRM server"
task :run => :setup do
cd sandbox
system "osrm-routed"
end
desc "Run all test"
task :test do
puts "Test would go here..."
end

View File

@ -193,8 +193,8 @@ env.Protobuf('DataStructures/pbf-proto/osmformat.proto')
env.Append(CCFLAGS = ['-lboost_regex', '-lboost_iostreams', '-lbz2', '-lz', '-lprotobuf'])
#env.Append(LINKFLAGS = ['-lboost_system'])
env.Program(target = 'osrm-extract', source = ["extractor.cpp", 'DataStructures/pbf-proto/fileformat.pb.cc', 'DataStructures/pbf-proto/osmformat.pb.cc'])
env.Program(target = 'osrm-prepare', source = ["createHierarchy.cpp", 'Contractor/EdgeBasedGraphFactory.cpp'])
env.Program(target = 'osrm-routed', source = ["routed.cpp", 'Descriptors/DescriptionFactory.cpp'])
env.Program(target = 'sandbox/osrm-extract', source = ["extractor.cpp", 'DataStructures/pbf-proto/fileformat.pb.cc', 'DataStructures/pbf-proto/osmformat.pb.cc'])
env.Program(target = 'sandbox/osrm-prepare', source = ["createHierarchy.cpp", 'Contractor/EdgeBasedGraphFactory.cpp'])
env.Program(target = 'sandbox/osrm-routed', source = ["routed.cpp", 'Descriptors/DescriptionFactory.cpp'])
env = conf.Finish()

BIN
amager.osm.pbf Normal file

Binary file not shown.