-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile.rb
85 lines (65 loc) · 2.77 KB
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
$: << './tools/rake_build_system' #make sure this rakefile can see all the build system files
ENV['BOOST_VERSION']='boost_1_47_0'
require 'rake/clean'
CLOBBER.include('doc') # remove any doxygen-generated files
require 'rake.environment.rb' # this sets up a slew of environment constants
require 'plugins/rake.cpp.rb' # this provides the facilities for declaring C++ style builds
require 'plugins/rake.boost.rb' # provides location and names of the boost libraries
require 'plugins/rake.swigjava.rb' # provides helpers for creating cpp/java bindings using swig
require 'plugins/rake.source.rb' # provides licensing helpers
DEFAULT_INCLUDES << __FILE__.pathmap('%d')
$USE_TEAM_CITY = !ENV['teamcity'].nil?
$DNP3_JAVA = !ENV['java'].nil?
#format is name => options, :dir is required
$projects = {
:apl => {:dir => 'APL' },
:testapl => {:dir => 'TestAPL'},
:apltesttools => {:dir => 'APLTestTools'},
:dnp3 => {:dir => 'DNP3'},
:dnp3xml => {:dir => 'DNP3XML'},
:xmlbindings => {:dir => 'XMLBindings'},
:dnp3test => {:dir => 'DNP3Test'},
:testset => {:dir => 'TestSet'},
:slavedemo => {:dir => 'demos/slave-cpp'},
:tinyxml => {:dir => 'tinyxml'},
:aplxml => {:dir => 'APLXML'},
:terminal => {:dir => 'Terminal'},
:terminaltest => {:dir => 'TerminalTest'},
}
$projects[:dnp3java] = {:dir => 'DNP3Java'} if $DNP3_JAVA
$projects[:teamcity] = {:dir => 'TeamCitySupport'} if $USE_TEAM_CITY
add_projects($projects) #removes projects that are not valid for $hw_os
SOURCE_PROJECTS = [:apl, :testapl, :apltesttools, :dnp3, :dnp3test, :dnp3xml, :aplxml, :testset]
SOURCE_DIRS = SOURCE_PROJECTS.collect { |p| $projects[p][:dir] }
desc 'Generate doxygen html docs for the project'
task :document do
`doxygen ./config/doxygen.config`
end
desc 'Generate a sloccount report for the project'
task :sloccount do
dirs = SOURCE_DIRS + ['tools/rake_build_system']
`sloccount --wide --details #{dirs.join(' ')} > sloccount.sc`
end
desc 'Formats all of the C++ h/cpp files with uncrustify'
task :format do
excludes = ['tinyxml'].collect{|e| "--exclude=#{e}"}.join(" ")
cmd = "astyle --options=config/astyle.cfg #{excludes} -r *.cpp *.h"
puts cmd
`#{cmd}`
end
namespace :license do
license_dirs = SOURCE_DIRS << 'External\build_system'
license_types = {
:cpp => {:exts => ['.cpp','.h'], :comment => '// '},
:ruby => {:exts => ['.rb'], :comment => '# '},
}
extensions = license_types.collect { |k,v| v[:exts] }.join('/')
desc "add the licensing file to all #{extensions}"
task :add do
license_types.each { |key,options| add_license(license_dirs, options, 'FILE_LICENSE') }
end
desc "remove the licensing file from all #{extensions}"
task :remove do
license_types.each { |key,options| remove_license(license_dirs, options, 'FILE_LICENSE') }
end
end