rake-delphi 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile.rb +12 -0
- data/lib/rake/common/chdirtask.rb +21 -0
- data/lib/rake/common/classes.rb +15 -0
- data/lib/rake/common/dsl.rb +10 -0
- data/lib/rake/common/echotask.rb +34 -0
- data/lib/rake/common/exectask.rb +20 -0
- data/lib/rake/common/git.rb +102 -0
- data/lib/rake/common/hashtask.rb +43 -0
- data/lib/rake/common/initask.rb +31 -0
- data/lib/rake/common/libstask.rb +35 -0
- data/lib/rake/common/sendmailtask.rb +45 -0
- data/lib/rake/common/ziptask.rb +98 -0
- data/lib/rake/delphi/dcc32.rb +260 -0
- data/lib/rake/delphi/envvariables.rb +41 -0
- data/lib/rake/delphi/liblist.rb +29 -0
- data/lib/rake/delphi/project.rb +68 -0
- data/lib/rake/delphi/projectinfo.rb +76 -0
- data/lib/rake/delphi/rc.rb +25 -0
- data/lib/rake/delphi/resources.rb +126 -0
- data/lib/rake/delphi/tool.rb +140 -0
- data/lib/rake/delphi/version.rb +7 -0
- data/lib/rake/delphi.rb +4 -0
- data/lib/rake/helpers/digest.rb +28 -0
- data/lib/rake/helpers/file.rb +35 -0
- data/lib/rake/helpers/filelist.rb +12 -0
- data/lib/rake/helpers/gemversion.rb +42 -0
- data/lib/rake/helpers/logger.rb +15 -0
- data/lib/rake/helpers/rake.rb +29 -0
- data/lib/rake/helpers/raketask.rb +39 -0
- data/lib/rake/helpers/string.rb +10 -0
- data/lib/rake/helpers/unittest.rb +17 -0
- data/lib/rake/templates/project.erb +60 -0
- data/rake-delphi.gemspec +23 -0
- data/test/helpers/consts.rb +4 -0
- data/test/resources/FakeDelphi/dcc32.exe +0 -0
- data/test/resources/FakeDelphi/rc.exe +0 -0
- data/test/resources/echo/file.in +1 -0
- data/test/resources/echo/file.out +1 -0
- data/test/resources/hashes/hash.2.file +1 -0
- data/test/resources/hashes/hash.file +1 -0
- data/test/resources/ini/file.ini +7 -0
- data/test/resources/libstask/lib/level-1/level-2-1/level-3-1/.gitkeep +0 -0
- data/test/resources/libstask/lib/level-1/level-2-1/level-3-2/.gitkeep +0 -0
- data/test/resources/libstask/lib/level-1/level-2-2/.gitkeep +0 -0
- data/test/resources/testproject/.gitignore +8 -0
- data/test/resources/testproject/ExplicitLib/ExplicitLibUnit.pas +17 -0
- data/test/resources/testproject/Rakefile.rb +54 -0
- data/test/resources/testproject/lib/AnyLib/LibUnit.pas +17 -0
- data/test/resources/testproject/local.resources.txt +1 -0
- data/test/resources/testproject/release.dcc.cfg +1 -0
- data/test/resources/testproject/resources.rc +1 -0
- data/test/resources/testproject/testproject.bdsproj +175 -0
- data/test/resources/testproject/testproject.cfg +39 -0
- data/test/resources/testproject/testproject.dpr +78 -0
- data/test/resources/testproject/testproject.dproj +77 -0
- data/test/resources/testproject/testproject.ico +0 -0
- data/test/test-delphi.rb +166 -0
- data/test/test-echo.rb +33 -0
- data/test/test-gemversion.rb +61 -0
- data/test/test-git.rb +144 -0
- data/test/test-hashes.rb +57 -0
- data/test/test-ini.rb +18 -0
- data/test/test-libstask.rb +54 -0
- data/test/test-projectinfo.rb +66 -0
- data/test/test-zip.rb +43 -0
- metadata +179 -0
@@ -0,0 +1,140 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rake/common/exectask'
|
4
|
+
require 'rake/delphi/projectinfo'
|
5
|
+
|
6
|
+
module Rake
|
7
|
+
module Delphi
|
8
|
+
class CustomDelphiTool < CustomExec
|
9
|
+
DelphiRegRoot = 'SOFTWARE\\Borland\\Delphi'
|
10
|
+
BDSRegRoot = 'SOFTWARE\\Borland\\BDS'
|
11
|
+
EDSRegRoot = 'SOFTWARE\\CodeGear\\BDS'
|
12
|
+
|
13
|
+
# used mainly in tests
|
14
|
+
def self.reinit
|
15
|
+
@@version, @@delphidir, @@toolpath = nil, nil, nil
|
16
|
+
end
|
17
|
+
reinit
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@@version, @@delphidir, @@toolpath = self.class.find unless @@version
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.toolName
|
24
|
+
raise 'Abstract method "toolName". Override it'
|
25
|
+
end
|
26
|
+
|
27
|
+
def version
|
28
|
+
@@version
|
29
|
+
end
|
30
|
+
|
31
|
+
def delphidir
|
32
|
+
@@delphidir
|
33
|
+
end
|
34
|
+
|
35
|
+
def toolpath
|
36
|
+
@@toolpath
|
37
|
+
end
|
38
|
+
|
39
|
+
def versionInfoClass
|
40
|
+
return @@version.to_f < 11 ? BDSVersionInfo : RAD2007VersionInfo
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.readUserOption(key, name, ver)
|
44
|
+
begin
|
45
|
+
require 'win32/registry'
|
46
|
+
root = rootForVersion(ver) + '\\' + key
|
47
|
+
begin
|
48
|
+
::Win32::Registry::HKEY_CURRENT_USER.open(root) do |reg|
|
49
|
+
reg_typ, reg_val = reg.read(name)
|
50
|
+
return reg_val.gsub('\\', '/')
|
51
|
+
end
|
52
|
+
rescue ::Win32::Registry::Error
|
53
|
+
return ''
|
54
|
+
end
|
55
|
+
rescue LoadError
|
56
|
+
return ''
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.version4version(version)
|
61
|
+
if version.to_f >= 9
|
62
|
+
version = format('%.1f', version.to_f - 6)
|
63
|
+
end
|
64
|
+
if !version["."]
|
65
|
+
version << ".0"
|
66
|
+
end
|
67
|
+
return version
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.rootForVersion(version)
|
71
|
+
if version.to_f < 9
|
72
|
+
regRoot = DelphiRegRoot
|
73
|
+
else
|
74
|
+
if version.to_f < 12
|
75
|
+
regRoot = BDSRegRoot
|
76
|
+
else
|
77
|
+
regRoot = EDSRegRoot
|
78
|
+
end
|
79
|
+
end
|
80
|
+
version = version4version(version)
|
81
|
+
return regRoot + '\\' + version
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.readDelphiDir(ver)
|
85
|
+
begin
|
86
|
+
require 'win32/registry'
|
87
|
+
[::Win32::Registry::HKEY_LOCAL_MACHINE, \
|
88
|
+
# for local/manual installations
|
89
|
+
::Win32::Registry::HKEY_CURRENT_USER].each do |regRoot|
|
90
|
+
begin
|
91
|
+
regRoot.open(rootForVersion(ver)) do |reg|
|
92
|
+
reg_typ, reg_val = reg.read('RootDir')
|
93
|
+
return reg_val.gsub('\\', '/')
|
94
|
+
end
|
95
|
+
rescue ::Win32::Registry::Error
|
96
|
+
end
|
97
|
+
end
|
98
|
+
return nil
|
99
|
+
rescue LoadError
|
100
|
+
return nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.find(failIfNotFound = false)
|
105
|
+
v = ENV['DELPHI_VERSION']
|
106
|
+
if ENV['DELPHI_DIR']
|
107
|
+
# append trailing path delimiter
|
108
|
+
ENV['DELPHI_DIR'] = ENV['DELPHI_DIR'].gsub(/[^\/]$/, '\&/')
|
109
|
+
tool = ENV['DELPHI_DIR'] + toolName
|
110
|
+
checkToolFailure(tool) if failIfNotFound
|
111
|
+
return v, ENV['DELPHI_DIR'], tool
|
112
|
+
end
|
113
|
+
if v.to_s.empty?
|
114
|
+
v = []
|
115
|
+
(4..14).each { |n| v << n.to_s }
|
116
|
+
v.reverse!
|
117
|
+
else
|
118
|
+
v = [v]
|
119
|
+
end
|
120
|
+
v.each do |ver|
|
121
|
+
path = readDelphiDir(ver)
|
122
|
+
next unless path
|
123
|
+
tool = path + toolName
|
124
|
+
if File.exists?(tool) # found it !
|
125
|
+
ENV['DELPHI_VERSION'] = ver
|
126
|
+
ENV['DELPHI_DIR'] = path
|
127
|
+
return ver, path, tool
|
128
|
+
end
|
129
|
+
end
|
130
|
+
checkToolFailure(nil) if failIfNotFound
|
131
|
+
return nil
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.checkToolFailure(toolpath)
|
135
|
+
fail 'Could not find %s: (%s)' % [toolName, toolpath.to_s] unless File.exists?(toolpath.to_s)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/lib/rake/delphi.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'digest'
|
4
|
+
require 'zlib'
|
5
|
+
|
6
|
+
class Digest::CRC32 < Digest::Class
|
7
|
+
include Digest::Instance
|
8
|
+
|
9
|
+
def update(str)
|
10
|
+
@crc32 = Zlib.crc32(str, @crc32)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
reset
|
15
|
+
end
|
16
|
+
|
17
|
+
def reset
|
18
|
+
@crc32 = 0
|
19
|
+
end
|
20
|
+
|
21
|
+
def finish
|
22
|
+
@crc32.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def hexdigest_to_digest(h)
|
26
|
+
h.unpack('a2' * (h.size / 2)).collect { |i| i.hex.chr }.join
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class File
|
4
|
+
@@separator = nil
|
5
|
+
def self.cygwin?
|
6
|
+
RUBY_PLATFORM.downcase.include?('cygwin')
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.separator
|
10
|
+
return @@separator if @@separator
|
11
|
+
# Return `backlash` for Cygwin and Windows (ALT_SEPARATOR)
|
12
|
+
# otherwise - system separator
|
13
|
+
return @@separator = cygwin? ? '\\' : (ALT_SEPARATOR ? ALT_SEPARATOR : SEPARATOR)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.cygpath(path, flag = nil)
|
17
|
+
flag ||= '-w'
|
18
|
+
# convert to Windows path
|
19
|
+
path = `cygpath #{flag} "#{path}"`.chomp
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.expand_path2(path)
|
23
|
+
path = expand_path(path)
|
24
|
+
return path unless cygwin?
|
25
|
+
return cygpath(path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.dirname2(path, flag = nil)
|
29
|
+
path = dirname(path)
|
30
|
+
return path unless cygwin?
|
31
|
+
path = cygpath(path, flag)
|
32
|
+
path.gsub!('\\', '\\\\') unless flag
|
33
|
+
path
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
class FileList
|
5
|
+
def self.get_ignored_dir_pattern(dir)
|
6
|
+
Regexp.new("(^|[\\/\\\\])#{dir}([\\/\\\\]|$)", true)
|
7
|
+
end
|
8
|
+
IGNORE_GIT_PATTERN = get_ignored_dir_pattern('.git')
|
9
|
+
DEFAULT_IGNORE_PATTERNS << IGNORE_GIT_PATTERN \
|
10
|
+
if !DEFAULT_IGNORE_PATTERNS.include?(IGNORE_GIT_PATTERN)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Gem
|
4
|
+
class VersionImproved < Version
|
5
|
+
def initialize(version)
|
6
|
+
super
|
7
|
+
@version = '0.0.0.0' if @version.empty?
|
8
|
+
# avoid bug when Gem::Version <= 1.3.7
|
9
|
+
@segments = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
# Return a new version object where the previous to the last revision
|
14
|
+
# number is one lower (e.g., 5.3.1 => 5.2).
|
15
|
+
#
|
16
|
+
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.2, are ignored.
|
17
|
+
def prev_release
|
18
|
+
segments = self.segments.dup
|
19
|
+
segments.pop while segments.any? { |s| String === s }
|
20
|
+
segments.pop if segments.size > 1
|
21
|
+
|
22
|
+
segments[-1] = segments[-1].to_i.pred.to_s
|
23
|
+
self.class.new segments.join(".")
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# The build for this version (e.g. 1.2.0.a -> 1.2.1).
|
28
|
+
# Non-prerelease versions return themselves.
|
29
|
+
def build
|
30
|
+
return self unless prerelease?
|
31
|
+
|
32
|
+
segments = self.segments.dup
|
33
|
+
segments.pop while segments.any? { |s| String === s }
|
34
|
+
segments[-1] = segments[-1].succ
|
35
|
+
self.class.new segments.join('.')
|
36
|
+
end
|
37
|
+
|
38
|
+
def comma
|
39
|
+
segments.dup.join(',')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# extend Rake task with a `set_non_standard_vars` method
|
4
|
+
module Rake
|
5
|
+
def self.set_non_standard_vars
|
6
|
+
# convert tasks to vars
|
7
|
+
# and remove them from the list of tasks
|
8
|
+
Rake.application.top_level_tasks.delete_if do |task|
|
9
|
+
# if task name is like <var.with.dot>=<value>
|
10
|
+
if /^[^.=][^=]+=.*/.match(task)
|
11
|
+
name, value = task.split('=', 2)
|
12
|
+
ENV[name] = value
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.quotepath(switch, path)
|
19
|
+
return ! path.to_s.empty? ? "#{switch}\"#{path.to_s}\"" : ''
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.ruby18?
|
23
|
+
/^1\.8/.match(RUBY_VERSION)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.cygwin?
|
27
|
+
RUBY_PLATFORM.downcase.include?('cygwin')
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'rake/helpers/logger'
|
5
|
+
|
6
|
+
# extend Rake task with a logger
|
7
|
+
module Rake
|
8
|
+
class Task
|
9
|
+
alias_method :initialize_base, :initialize
|
10
|
+
alias_method :execute_base, :execute
|
11
|
+
attr_reader :logger
|
12
|
+
|
13
|
+
def initialize(name, app)
|
14
|
+
@logger = Logger.new(STDOUT)
|
15
|
+
initialize_base(name, app)
|
16
|
+
end
|
17
|
+
|
18
|
+
# replace execute to indicate what method is executed
|
19
|
+
def execute(args=nil)
|
20
|
+
puts "Executing #{name}"
|
21
|
+
execute_base(args)
|
22
|
+
end
|
23
|
+
|
24
|
+
def out(msg)
|
25
|
+
logger.info(msg)
|
26
|
+
end
|
27
|
+
|
28
|
+
def trace?
|
29
|
+
application.options.trace || $DEBUG || false
|
30
|
+
end
|
31
|
+
|
32
|
+
def shortname
|
33
|
+
scope = @scope.dup.pop.to_s
|
34
|
+
n = name.dup
|
35
|
+
n.gsub!(scope + ':', '') unless scope.empty?
|
36
|
+
return n
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
# Ruby 1.9 uses "minitest". There is no `name` property there
|
6
|
+
if defined? MiniTest::Unit::TestCase && Test::Unit::TestCase < MiniTest::Unit::TestCase
|
7
|
+
module Test
|
8
|
+
module Unit
|
9
|
+
class TestCase
|
10
|
+
def name
|
11
|
+
__name__
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#define VS_FF_DEBUG 0x00000001
|
2
|
+
#define VS_FF_PRERELEASE 0x00000002
|
3
|
+
#define VS_FF_PATCHED 0x00000004
|
4
|
+
#define VS_FF_PRIVATEBUILD 0x00000008
|
5
|
+
#define VS_FF_INFOINFERRED 0x00000010
|
6
|
+
#define VS_FF_SPECIALBUILD 0x00000020
|
7
|
+
|
8
|
+
#ifndef DEBUG
|
9
|
+
#define VER_DEBUG 0
|
10
|
+
#else
|
11
|
+
#define VER_DEBUG VS_FF_DEBUG
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#ifndef RC
|
15
|
+
#define VER_PRERELEASE 0
|
16
|
+
#else
|
17
|
+
#define VER_PRERELEASE VS_FF_PRERELEASE
|
18
|
+
#endif
|
19
|
+
|
20
|
+
|
21
|
+
#define _FILEFLAGS (VER_PRERELEASE|VER_DEBUG)
|
22
|
+
|
23
|
+
LANGUAGE <%= language %>, <%= sublanguage %>
|
24
|
+
MAINICON ICON <%= mainicon %>
|
25
|
+
1 VERSIONINFO
|
26
|
+
FILEVERSION <%= version.comma %>
|
27
|
+
PRODUCTVERSION <%= product.comma %>
|
28
|
+
FILEOS 0x40004
|
29
|
+
FILETYPE <%= filetype %>
|
30
|
+
FILEFLAGSMASK _FILEFLAGS
|
31
|
+
FILEFLAGS _FILEFLAGS
|
32
|
+
BEGIN
|
33
|
+
BLOCK "StringFileInfo"
|
34
|
+
BEGIN
|
35
|
+
BLOCK "<%= lang %><%= codepage %>"
|
36
|
+
BEGIN
|
37
|
+
VALUE "CompanyName", "<%= versioninfo.CompanyName %>\0"
|
38
|
+
VALUE "FileDescription", "<%= versioninfo.FileDescription %>\0"
|
39
|
+
VALUE "FileVersion", "<%= version %>\0"
|
40
|
+
VALUE "InternalName", "<%= versioninfo.InternalName %>\0"
|
41
|
+
VALUE "LegalCopyright", "<%= versioninfo.LegalCopyright %>\0"
|
42
|
+
VALUE "LegalTrademarks", "<%= versioninfo.LegalTrademarks %>\0"
|
43
|
+
VALUE "OriginalFilename", "<%= versioninfo.OriginalFilename %>\0"
|
44
|
+
VALUE "ProductName", "<%= versioninfo.ProductName %>\0"
|
45
|
+
VALUE "ProductVersion", "<%= versioninfo.ProductVersion %>\0"
|
46
|
+
VALUE "Comments", "<%= versioninfo.Comments %>\0"
|
47
|
+
#ifdef DEBUG
|
48
|
+
VALUE "DebugBuild", "DebugBuild\0"
|
49
|
+
#endif
|
50
|
+
#ifdef RC
|
51
|
+
VALUE "ReleaseCandidate", "<%= releaseCandidate %>\0"
|
52
|
+
#endif
|
53
|
+
END
|
54
|
+
END
|
55
|
+
|
56
|
+
BLOCK "VarFileInfo"
|
57
|
+
BEGIN
|
58
|
+
VALUE "Translation", 0x<%= lang %> 0x<%= codepage %>
|
59
|
+
END
|
60
|
+
END
|
data/rake-delphi.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rake/delphi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rake-delphi"
|
8
|
+
spec.version = Rake::Delphi::VERSION
|
9
|
+
spec.authors = ['Alexey Shumkin']
|
10
|
+
spec.email = ['Alex.Crezoff@gmail.com']
|
11
|
+
spec.description = 'Tasks for building Delphi projects'
|
12
|
+
spec.summary = 'Tasks for building Delphi projects'
|
13
|
+
spec.homepage = 'http://github.com/ashumkin/rake-delphi.gem'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
${echo_variable} must be replaced by its <value>
|
@@ -0,0 +1 @@
|
|
1
|
+
echo_variable_value must be replaced by its <value>
|
@@ -0,0 +1 @@
|
|
1
|
+
some content if a file 2
|
@@ -0,0 +1 @@
|
|
1
|
+
some content
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
=begin rdoc
|
4
|
+
|
5
|
+
=end
|
6
|
+
|
7
|
+
require 'rake'
|
8
|
+
require 'rake/delphi'
|
9
|
+
require 'rake/delphi/project'
|
10
|
+
|
11
|
+
if RAKEVERSION !~ /^0\.8/
|
12
|
+
require 'rake/dsl_definition'
|
13
|
+
include Rake::DSL
|
14
|
+
Rake::TaskManager.record_task_metadata = true if Rake::TaskManager.respond_to?('record_task_metadata')
|
15
|
+
end
|
16
|
+
|
17
|
+
module TestModule
|
18
|
+
PROJECT_NAME = 'Rake test project'
|
19
|
+
PROJECT_FILE = 'testproject'
|
20
|
+
|
21
|
+
task :default => 'test:compile'
|
22
|
+
|
23
|
+
namespace :test do
|
24
|
+
|
25
|
+
desc 'Compilation'
|
26
|
+
_task = task :compile do |t|
|
27
|
+
puts 'task %s executed' % t.name
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Preparation'
|
31
|
+
task :prepare, :useresources, :options do |t, opts|
|
32
|
+
_task = Rake::Task['test:compile']
|
33
|
+
dpr = Rake.application.define_task(Rake::Delphi::Project, (_task.shortname + ':delphi').to_sym)
|
34
|
+
dpr[:resources_additional] = 'resources' unless opts[:useresources]
|
35
|
+
options = opts[:options] || {}
|
36
|
+
if options.kind_of?(String)
|
37
|
+
options = eval(options)
|
38
|
+
end
|
39
|
+
options.each do |k, v|
|
40
|
+
dpr[k] = v
|
41
|
+
end
|
42
|
+
dpr_vars = {}
|
43
|
+
dpr_vars[:bin_path] = options[:bin] || File.expand_path(File.dirname(__FILE__) + '/bin')
|
44
|
+
|
45
|
+
dpr_vars[:bin] = File.expand_path2(dpr_vars[:bin_path])
|
46
|
+
dpr.init(Module.nesting, File.expand_path(__FILE__), dpr_vars, 0)
|
47
|
+
|
48
|
+
directory dpr_vars[:bin_path]
|
49
|
+
_task.enhance [dpr_vars[:bin_path], dpr]
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
-=WITH RESOURCES=-
|
@@ -0,0 +1 @@
|
|
1
|
+
-DRELEASE_CFG
|
@@ -0,0 +1 @@
|
|
1
|
+
LOCAL_RESOURCES RCDATA local.resources.txt
|