Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 228 lines (191 sloc) 8.228 kb
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
1 # Common build system
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
2 require 'fileutils'
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
3 require 'rubygems'
4 require 'rake'
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
5 require 'rake/clean'
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
6
3d4b511 rake task based off of VERSION env variable
Cliff Moon authored
7 VERSION = ENV["VERSION"]
b3cdf8b rake target to make a release
Cliff Moon authored
8
1199672 eunit submod integration
Cliff Moon authored
9 ERLC_TEST_FLAGS = "-pa deps/eunit/ebin -I deps/eunit/include -DTEST"
2845342 @toddlipcon Add thrift and a thrift service
toddlipcon authored
10 ERLC_FLAGS = "+debug_info -W0 -I include -pa deps/mochiweb/ebin -I deps/mochiweb/include -pa deps/rfc4627/ebin -I deps/rfc4627/include -I gen-erl/ -o ebin"
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
11
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
12 CLEAN.include("ebin/*.beam")
13 CLEAN.include("c/*.o")
a16e540 lib -> priv
Cliff Moon authored
14 CLEAN.include("priv/*.so")
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
15
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
16 task :default => [:build_deps, :build_c_drivers] do
652e45a nicerer rakefile
Cliff Moon authored
17 puts "building #{ENV['TEST']}"
2845342 @toddlipcon Add thrift and a thrift service
toddlipcon authored
18 sh "erlc #{ERLC_FLAGS} #{ENV['TEST'] ? ERLC_TEST_FLAGS : ''} elibs/*.erl gen-erl/*.erl"
215cfc3 fixed up the mediator tests to not use slave nodes
Cliff Moon authored
19 if ENV['TEST']
20 files = Dir["etest/*.erl"].select {|d| d !~ /^.*_test.erl$/}
21 sh "erlc #{ERLC_FLAGS} #{ERLC_TEST_FLAGS} #{files.join(' ')}"
22 end
3019c9b web interface
Cliff Moon authored
23 # Dir["templates/*"].each do |template|
24 # sh %Q(erl -pz ebin -noshell -eval 'erltl:compile("#{template}", [{outdir, "ebin"}, debug_info, show_errors, show_warnings])' -s erlang halt)
25 # end
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
26 end
27
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
28 task :test_env => [:build_test_deps, :test_config] do
652e45a nicerer rakefile
Cliff Moon authored
29 puts "test env"
30 ENV['TEST'] = 'test'
31 end
32
ae6010e Added test lib module, fixed storage server test to use priv dir inst…
Jason Pellerin authored
33 task :native do
ed0d24a added native compilation to the load testing deployment
Cliff Moon authored
34 ERLC_FLAGS = "-smp +native #{ERLC_FLAGS}"
ae6010e Added test lib module, fixed storage server test to use priv dir inst…
Jason Pellerin authored
35 end
36
7a70e0e Merged from cliffmoon master
Jason Pellerin authored
37 task :profile do
38 ERLC_FLAGS = "-DPROF #{ERLC_FLAGS}"
39 end
40
3cf81ce more work on the ext listener.
Cliff Moon authored
41 task :run do
9bd5f0d mods to rakefile
Cliff Moon authored
42 sh %Q{erl -boot start_sasl +K true +A 128 -smp enable -pz ./ebin/ -sname local_console#{$$} -mnesia dir '"/tmp/mbd"' -noshell -run dynomite start}
3cf81ce more work on the ext listener.
Cliff Moon authored
43 end
44
72f65d2 make_dist, install, and uninstall tasks
Cliff Moon authored
45 task :make_dist => [:clean, :native, :default, :release] do
46 puts "made release version #{VERSION}"
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
47 end
48
72f65d2 make_dist, install, and uninstall tasks
Cliff Moon authored
49 task :install do
50 ERL = `which erl`
51 ERLDIR = `awk -F= '/ROOTDIR=/ { print $2; exit; }' #{ERL}`.chomp
52 sh "cp releases/dynomite-#{VERSION}/dynomite_rel-#{VERSION}.tar.gz #{ERLDIR}/releases/"
53 sh %Q(erl -boot start_sasl -noshell -eval "io:format(\\"~p~n\\", [release_handler:unpack_release(\\"dynomite_rel-#{VERSION}\\")])." -s init stop)
54 end
55
56 task :uninstall do
57 ERL = `which erl`
58 ERLDIR = `awk -F= '/ROOTDIR=/ { print $2; exit; }' #{ERL}`.chomp
59 sh %Q(erl -boot start_sasl -noshell -eval "io:format(\\"~p~n\\", [release_handler:remove_release(\\"dynomite_#{VERSION}\\")])." -s init stop)
60 end
b3cdf8b rake target to make a release
Cliff Moon authored
61
6ddae59 added the 'rebuild thrift clients' task
Christopher Brown authored
62 task :thrift_clients do
63 sh "thrift --gen rb if/dynomite.thrift"
64 sh "thrift -erl if/dynomite.thrift"
65 end
66
b3cdf8b rake target to make a release
Cliff Moon authored
67 task :release => [:default] do
3d4b511 rake task based off of VERSION env variable
Cliff Moon authored
68 rel_file_contents = File.read("releases/dynomite.rel").gsub(/\?VERSION/, VERSION)
69
b3cdf8b rake target to make a release
Cliff Moon authored
70 release = "releases/dynomite-#{VERSION}"
3d4b511 rake task based off of VERSION env variable
Cliff Moon authored
71 rel_file = "#{release}/dynomite_rel-#{VERSION}.rel"
b3cdf8b rake target to make a release
Cliff Moon authored
72 puts "preparing release #{release.inspect}"
a16e540 lib -> priv
Cliff Moon authored
73 %w(ebin priv src include).each do |dir|
b3cdf8b rake target to make a release
Cliff Moon authored
74 FileUtils.mkdir_p("#{release}/#{dir}")
75 end
3d4b511 rake task based off of VERSION env variable
Cliff Moon authored
76 File.open(rel_file, 'w') do |f|
77 f.print(rel_file_contents)
78 end
b3cdf8b rake target to make a release
Cliff Moon authored
79 sh "cp -r elibs/* #{release}/src" rescue nil
80 sh "cp -r ebin/* #{release}/ebin" rescue nil
a16e540 lib -> priv
Cliff Moon authored
81 sh "cp -r priv/* #{release}/priv" rescue nil
b3cdf8b rake target to make a release
Cliff Moon authored
82 sh "cp -r include/* #{release}/include" rescue nil
83 sh "cp -r deps/thrift/src/* #{release}/src" rescue nil
84 sh "cp -r deps/thrift/ebin/* #{release}/ebin" rescue nil
85 sh "cp -r deps/thrift/include/* #{release}/include" rescue nil
86 sh "cp -r deps/thrift/priv/* #{release}/priv" rescue nil
87 sh "cp -r deps/mochiweb/src/* #{release}/src" rescue nil
88 sh "cp -r deps/mochiweb/ebin/* #{release}/ebin" rescue nil
89 sh "cp -r deps/mochiweb/include/* #{release}/include" rescue nil
90 sh "cp -r deps/mochiweb/priv/* #{release}/priv" rescue nil
91
72f65d2 make_dist, install, and uninstall tasks
Cliff Moon authored
92 sh %Q(cd #{release} && erl -pa ./ebin -noshell -eval "systools:make_script(\\"dynomite_rel-#{VERSION}\\")." -eval "systools:make_tar(\\"dynomite_rel-#{VERSION}\\")." -s init stop)
b3cdf8b rake target to make a release
Cliff Moon authored
93 end
94
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
95 task :econsole do
9bd5f0d mods to rakefile
Cliff Moon authored
96 sh "erl +Bc +K true -smp enable -pz ./ebin -pz ./etest -pa ./deps/eunit/ebin -pa deps/rfc4627/ebin -pa deps/mochiweb/ebin -sname local_console_#{$$} -kernel"
97 end
98
99 task :stress => [:default] do
4e1daa4 fix stress test
Cliff Moon authored
100 sh "erl -boot start_sasl +Bc +K true -smp enable +A 128 -pz ./ebin -pz ./etest -pa ./deps/eunit/ebin -pa deps/rfc4627/ebin -pa deps/mochiweb/ebin -sname local_console_#{$$} -noshell -run dmerkle stress -run erlang halt"
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
101 end
102
103 task :console do
104 sh "irb -I rlibs/"
105 end
106
652e45a nicerer rakefile
Cliff Moon authored
107 task :test => [:test_env, :default] do
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
108 mods = []
109 mod_directives = ""
110 env_peek = ENV['MOD'] || ENV['MODS'] || ENV['MODULE'] || ENV['MODULES']
111 if env_peek
112 mods = env_peek.split(",")
113 else
114 mods = Dir["etest/*_test.erl"].map { |x| x.match(/etest\/(.*)_test.erl/)[1] }
115 end
990fa31 Changed Rakefile to run all selected module tests as unified test run
Jason Pellerin authored
116 mod_directives = mods.join(" ")
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
117 priv = priv_dir()
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
118 # -run #{ENV['MOD']} test
bf03872 Working on fixing mediator, ext_listener tests. Changed name of thrif…
Jason Pellerin authored
119 sh %Q{erl -boot start_sasl +K true -smp enable -pz ./etest ./ebin -pa ./deps/eunit/ebin ./deps/mochiweb/ebin ./deps/rfc4627/ebin ./deps/thrift/ebin -sname local_console_#{$$} -noshell -priv_dir "#{priv}" -config test -s eunit test #{mod_directives} -run init stop}
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
120 puts "-> Test logs in #{priv}"
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
121 end
122
ff36d92 code coverage analysis
Cliff Moon authored
123 task :coverage => [:test_env] do
124 mods = []
125 mod_directives = ""
126 env_peek = ENV['MOD'] || ENV['MODS'] || ENV['MODULE'] || ENV['MODULES']
127 if env_peek
128 mods = env_peek.split(",")
129 else
130 mods = Dir["etest/*_test.erl"].map { |x| x.match(/etest\/(.*)_test.erl/)[1] }
131 end
132 mod_directives = mods.join(', ')#map{|m| %Q(\\"#{m}\\")}.join(", ")
133 priv = priv_dir()
134 cmd = %Q{erl -boot start_sasl +K true -smp enable -pz etest -pa ./deps/eunit/ebin ./deps/mochiweb/ebin ./deps/rfc4627/ebin ./deps/thrift/ebin -sname local_console_#{$$} -noshell -priv_dir "#{priv}" -config test\
135 -eval "\
320cfb3 fixed mediator tests for coverage
Cliff Moon authored
136 cover:compile_directory(\\"elibs\\", [{i,\\"include\\"},{i, \\"deps/eunit/include\\"},{d,'TEST'},{warn_format, 0}]), \
ff36d92 code coverage analysis
Cliff Moon authored
137 T = fun(X) -> io:format(user, \\"~-20.s\\", [X]), X:test() end, \
138 [T(X) || X <- [#{mod_directives}]], \
139 F = fun(X) -> cover:analyse_to_file(X, \\"doc/\\" ++ atom_to_list(X) ++ \\"_coverage.html\\", [html]) end, \
140 [F(X) || X <- [#{mod_directives}]]. \
141 " -s init stop;}
320cfb3 fixed mediator tests for coverage
Cliff Moon authored
142 puts cmd
ff36d92 code coverage analysis
Cliff Moon authored
143 sh cmd
144 puts "-> Test logs in #{priv}"
145 end
146
b33369e @KirinDave Bootstrapping the project to a more helpful inf.
KirinDave authored
147 task :docs do
148 #files = (Dir["elibs/*.erl"] - ["elibs/json.erl"]).sort.map { |x| "\'../" + x + "\'"}.join(" ")
149 #sh %|cd doc && erl -noshell -run edoc_run files #{files}|
150 files = Dir["elibs/*.erl"].map { |x| "'../" + x + "'"}.join " "
151 sh %|cd doc && erl -noshell -s init stop -run edoc files #{files}|
152 end
1199672 eunit submod integration
Cliff Moon authored
153
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
154 task :c_env do
155 ERL = `which erl`
156 ERLDIR = `awk -F= '/ROOTDIR=/ { print $2; exit; }' #{ERL}`.chomp
157 ERTSBASE = `erl -noshell -noinput -eval 'io:format (\"~s\", [[ \"/\" ++ filename:join (lists:reverse ([ \"erts-\" ++ erlang:system_info (version) | tl (lists:reverse (string:tokens (code:lib_dir (), \"/\"))) ])) ]]).' -s erlang halt `.chomp
158 ERL_INTERFACE = `ls #{ERLDIR}/lib`.split("\n").grep(/erl_interface/).last
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
159 CPPFLAGS = "-I #{ERTSBASE}/include -I #{ERLDIR}/lib/#{ERL_INTERFACE}/include -Wall -g -O2 -fPIC -I./"
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
160 LIBEI = "#{ERLDIR}/lib/#{ERL_INTERFACE}/lib/libei.a"
161 if `uname` =~ /Linux/
162 LDFLAGS = " -shared"
163 else
164 LDFLAGS = " -dynamic -bundle -undefined suppress -flat_namespace"
165 end
166 end
167
1199672 eunit submod integration
Cliff Moon authored
168 task :build_deps do
169 Dir["deps/*"].each do |dir|
170 sh "cd #{dir} && make"
171 end
2845342 @toddlipcon Add thrift and a thrift service
toddlipcon authored
172 end
ae6010e Added test lib module, fixed storage server test to use priv dir inst…
Jason Pellerin authored
173
174 task :build_test_deps do
3ff13ce partitions will now consistently hash to a node.
Cliff Moon authored
175 sh "erlc +debug_info -I include #{ERLC_TEST_FLAGS} -o etest etest/t.erl etest/mock_genserver.erl etest/mock.erl"
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
176 end
177
33e2c2c moved the task
Christopher Brown authored
178 task :build_tarball => [:default, 'build'] do
6255f68 removed bash-isms from tarball task
Christopher Brown authored
179 sh "wd=$(pwd) && cd ./.. && tar czvf dynomite/build/dynomite.tar.tgz --exclude dynomite/build ./dynomite && (cd \"$wd\")"
33e2c2c moved the task
Christopher Brown authored
180 end
181
ceae03c Rakefile now sets priv dir, and generates test.config that puts kerne…
Jason Pellerin authored
182 task :test_config do
183 # ensure the test log dir exists
184 priv = priv_dir()
185 FileUtils.mkpath(priv)
186
187 # write config file to configure sasl, etc to
188 cfg = File.new("test.config", "w+")
189 # write their error logs to the log files in log dir
190 cfg.write(<<EOC)
191 [{kernel,
192 [{error_logger, {file, "#{priv}/kernel.log"}}
193 ]},
194 {sasl,
195 [{sasl_error_logger, {file, "#{priv}/sasl.log"}}
196 ]}
197 ].
198 EOC
199 cfg.close()
200 end
201
202 def priv_dir
203 base = File.dirname(__FILE__)
204 priv = File.join(base, "etest", "log", "#{$$}")
205 return priv
ae6010e Added test lib module, fixed storage server test to use priv dir inst…
Jason Pellerin authored
206 end
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
207
a16e540 lib -> priv
Cliff Moon authored
208 DRIVERS = FileList['c/*_drv.c'].pathmap("%{c,priv}X.so")
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
209
1aefb97 added build_tarball task
Christopher Brown authored
210 directory "build"
a16e540 lib -> priv
Cliff Moon authored
211 directory "priv"
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
212
a16e540 lib -> priv
Cliff Moon authored
213 # task "priv/murmur_drv.c" => ["c/murmur.o"]
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
214
a16e540 lib -> priv
Cliff Moon authored
215 rule ".so" => ['%{priv,c}X.o', 'c/murmur.o', 'c/fnv.o'] do |t|
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
216 puts "cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.prerequisites.join(' ')} #{LIBEI}"
217 sh "cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.prerequisites.join(' ')} #{LIBEI}"
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
218 end
219
220 rule ".o" => ".c" do |t|
5fd7f15 ulimit driver that can dynamically fiddle with the fd soft limits
Cliff Moon authored
221 puts "cc #{CPPFLAGS} -c -o #{t.name} #{t.source}"
222 sh "cc #{CPPFLAGS} -c -o #{t.name} #{t.source}"
4b82ba2 adding c extensions to deal with ulimit
Cliff Moon authored
223 end
224
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
225
a16e540 lib -> priv
Cliff Moon authored
226 task :build_c_drivers => [:c_env, "priv"] + DRIVERS
fecb101 added native murmur and fnv hashing.
Cliff Moon authored
227
Something went wrong with that request. Please try again.