-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathrakefile.rb
173 lines (140 loc) · 4.59 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
require_relative 'scripts/setup'
require_relative 'scripts/copy-dependencies'
require_relative 'scripts/utils'
require_relative 'scripts/coverage'
require_relative 'src/Db/db'
task :cover do
filter = []
filter << "+[PKSim.Core]*"
filter << "+[PKSim.Assets]*"
filter << "+[PKSim.Presentation]*"
filter << "+[PKSim.Infrastructure]*"
#exclude namespaces that are tested from applications
# filter << "-[OSPSuite.Infrastructure.Serialization]OSPSuite.Infrastructure.Serialization.ORM*"
# filter << "-[OSPSuite.Presentation]OSPSuite.Presentation.MenuAndBars*"
# filter << "-[OSPSuite.Presentation]OSPSuite.Presentation.Presenters.ContextMenus*"
targetProjects = [
"PKSim.Tests.csproj",
"PKSim.R.Tests.csproj",
"PKSim.Matlab.Tests.csproj",
"PKSim.UI.Tests.csproj",
];
Coverage.cover(filter, targetProjects)
end
task :create_setup, [:product_version, :configuration] do |t, args|
src_dir = src_dir_for(args.configuration)
relative_src_dir = relative_src_dir_for(args.configuration)
#Ignore files from automatic harvesting that will be installed specifically
harvest_ignored_files = [
'PKSim.exe',
'PKSimDB.sqlite',
'PKSimTemplateDBSystem.TemplateDBSystem',
'templates.json'
]
#Files required for setup creation only and that will not be harvested automatically
setup_files = [
"#{relative_src_dir}/ChartLayouts/**/*.{wxs,xml}",
"#{relative_src_dir}/TeXTemplates/**/*.*",
'examples/*.txt',
'src/PKSim.Assets.Images/Resources/*.ico',
'Open Systems Pharmacology Suite License.pdf',
'documentation/*.pdf',
'dimensions/*.xml',
'pkparameters/*.xml',
'setup/setup.wxs',
'setup/**/*.{msm,rtf,bmp}'
]
Rake::Task['setup:create'].execute(OpenStruct.new(
solution_dir: solution_dir,
src_dir: src_dir,
setup_dir: setup_dir,
product_name: product_name,
product_version: args.product_version,
harvest_ignored_files: harvest_ignored_files,
suite_name: suite_name,
setup_files: setup_files,
manufacturer: manufacturer
))
end
task :create_portable_setup, [:product_version, :configuration, :package_name] do |t, args|
src_dir = src_dir_for(args.configuration)
relative_src_dir = relative_src_dir_for(args.configuration)
# Copy folder structure so that the portable setups works as expected
FileUtils.mkdir_p setup_temp_dir
FileUtils.copy_entry File.join(src_dir, 'TeXTemplates'), File.join(setup_temp_dir, 'TeXTemplates')
FileUtils.copy_entry File.join(src_dir, 'ChartLayouts'), File.join(setup_temp_dir, 'ChartLayouts')
#Files required for setup creation only and that will not be harvested automatically
setup_files = [
'Open Systems Pharmacology Suite License.pdf',
'documentation/*.pdf',
'dimensions/*.xml',
'pkparameters/*.xml',
'setup/**/*.{rtf}'
]
setup_folders = [
'examples/*.md',
"#{setup_temp_dir}/**/*.*",
]
Rake::Task['setup:create_portable'].execute(OpenStruct.new(
solution_dir: solution_dir,
src_dir: src_dir_for(args.configuration),
setup_dir: setup_dir,
product_name: product_name,
product_version: args.product_version,
suite_name: suite_name,
setup_files: setup_files,
setup_folders: setup_folders,
package_name: args.package_name,
))
end
task :update_go_license, [:file_path, :license] do |t, args|
Utils.update_go_diagram_license args.file_path, args.license
end
task :postclean do |t, args|
packages_dir = src_dir_for("Debug")
all_users_dir = ENV['ALLUSERSPROFILE']
all_users_application_dir = File.join(all_users_dir, manufacturer, product_name, '12.0')
copy_dependencies solution_dir, all_users_application_dir do
copy_dimensions_xml
copy_pkparameters_xml
end
copy_dependencies solution_dir, all_users_application_dir do
copy_file 'src/Db/PKSimDB.sqlite'
copy_file 'src/Db/TemplateDB/PKSimTemplateDBSystem.templateDBSystem'
end
copy_dependencies packages_dir, File.join(all_users_application_dir, 'ChartLayouts') do
copy_files 'ChartLayouts', 'xml'
end
copy_dependencies packages_dir, File.join(all_users_application_dir, 'TeXTemplates', 'StandardTemplate') do
copy_files 'StandardTemplate', '*'
end
end
task :db_pre_commit do
Rake::Task['db:dump'].execute();
Rake::Task['db:diff'].execute();
end
private
def relative_src_dir_for(configuration)
File.join( 'src', 'PKSim', 'bin', configuration, 'net472')
end
def src_dir_for(configuration)
File.join(solution_dir, relative_src_dir_for(configuration))
end
def solution_dir
File.dirname(__FILE__)
end
def manufacturer
'Open Systems Pharmacology'
end
def product_name
'PK-Sim'
end
def suite_name
'Open Systems Pharmacology Suite'
end
def setup_dir
File.join(solution_dir, 'setup')
end
def setup_temp_dir
File.join(setup_dir, 'temp')
end