Build UI & QRC files from Rakefile.

This commit is contained in:
Glenn Y. Rolland 2014-10-30 16:53:51 +01:00
parent b29c8cc6a1
commit afc6e1704f
2 changed files with 52 additions and 28 deletions

View file

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
qasim (0.1.11.dev.2014102922) qasim (0.1.11.dev.2014103015)
qtbindings (~> 4.8.6) qtbindings (~> 4.8.6)
thor (~> 0.19.1) thor (~> 0.19.1)

View file

@ -17,37 +17,40 @@ RBQRC_FILES=QRC_FILES.map{ |f| f.sub(/\.qrc$/,'_qrc.rb') }
UI_FILES=Dir.glob("lib/#{NAME}/ui/*.ui") UI_FILES=Dir.glob("lib/#{NAME}/ui/*.ui")
RBUI_FILES=UI_FILES.map{ |f| f.sub(/\.ui$/,'_ui.rb') } RBUI_FILES=UI_FILES.map{ |f| f.sub(/\.ui$/,'_ui.rb') }
require 'rake'
#Rake.application.options.trace_rules = true
desc "Do everything" desc "Do everything"
task :all => [:build, :install] task :all => [:build, :install]
desc "Clean everything" desc "Clean everything"
task :clean => [ task :clean => [
:clean_ui, :"ui:clean",
:clean_qrc, :"qrc:clean",
:clean_bin, #:clean_bin,
:clean_lib, #:clean_lib,
:clean_data, #:clean_data,
:"gem:clean" :"gem:clean"
] ]
desc "Build everything" desc "Build everything"
task :build => [ task :build => [
:build_ui, :"ui:build",
:build_qrc, :"qrc:build",
:build_bin, #:build_bin,
:build_lib, #:build_lib,
:build_data, #:build_data,
:"gem:build" :"gem:build"
] ]
desc "Install everything" desc "Install everything"
task :install => [ task :install => [
:install_ui, #:"ui:install",
:install_qrc, #:"qrc:install",
:install_bin, #:install_bin,
:install_lib, #:install_lib,
:install_data #:install_data
] ]
desc "Build documentation" desc "Build documentation"
@ -67,18 +70,40 @@ task :build_doc => :clean_doc do
} }
end end
task :clean_qrc do namespace :qrc do
rm_fr RBQRC_FILES desc "Clean QRC files"
end task :clean do
rm_rf RBQRC_FILES
end
task :build_qrc => RBQRC_FILES do desc "Build QRC files"
task :build => RBQRC_FILES do
puts RBQRC_FILES puts RBQRC_FILES
end
rule "_qrc.rb" => lambda{|f| f.gsub(/_qrc\.rb/,'.qrc') } do |t|
sh %Q{rbrcc #{t.source} -o #{t.name}}
end
end end
rule "_qrc.rb" => ".qrc" do |t| namespace :ui do
sh %Q{rbrcc #{t.source} -o #{t.name}} desc "Clean UI files"
task :clean do
rm_rf RBUI_FILES
end
desc "Build UI files"
task :build => RBUI_FILES do
puts RBQRC_FILES
end
rule "_ui.rb" => lambda{|f| f.gsub(/_ui\.rb/,'.ui') } do |t|
sh %Q{rbuic4 #{t.source} -o #{t.name}}
sh %Q{sed -e '/^module Ui/,/^end # module Ui/d' -i #{t.name}}
end
end end
namespace :gem do namespace :gem do
require "bundler/gem_tasks" require "bundler/gem_tasks"
@ -88,7 +113,6 @@ namespace :gem do
end end
end end
require 'rake'
require "bundler/gem_tasks" require "bundler/gem_tasks"
require 'rake/testtask' require 'rake/testtask'