rake-delphi 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile.rb +12 -0
  6. data/lib/rake/common/chdirtask.rb +21 -0
  7. data/lib/rake/common/classes.rb +15 -0
  8. data/lib/rake/common/dsl.rb +10 -0
  9. data/lib/rake/common/echotask.rb +34 -0
  10. data/lib/rake/common/exectask.rb +20 -0
  11. data/lib/rake/common/git.rb +102 -0
  12. data/lib/rake/common/hashtask.rb +43 -0
  13. data/lib/rake/common/initask.rb +31 -0
  14. data/lib/rake/common/libstask.rb +35 -0
  15. data/lib/rake/common/sendmailtask.rb +45 -0
  16. data/lib/rake/common/ziptask.rb +98 -0
  17. data/lib/rake/delphi/dcc32.rb +260 -0
  18. data/lib/rake/delphi/envvariables.rb +41 -0
  19. data/lib/rake/delphi/liblist.rb +29 -0
  20. data/lib/rake/delphi/project.rb +68 -0
  21. data/lib/rake/delphi/projectinfo.rb +76 -0
  22. data/lib/rake/delphi/rc.rb +25 -0
  23. data/lib/rake/delphi/resources.rb +126 -0
  24. data/lib/rake/delphi/tool.rb +140 -0
  25. data/lib/rake/delphi/version.rb +7 -0
  26. data/lib/rake/delphi.rb +4 -0
  27. data/lib/rake/helpers/digest.rb +28 -0
  28. data/lib/rake/helpers/file.rb +35 -0
  29. data/lib/rake/helpers/filelist.rb +12 -0
  30. data/lib/rake/helpers/gemversion.rb +42 -0
  31. data/lib/rake/helpers/logger.rb +15 -0
  32. data/lib/rake/helpers/rake.rb +29 -0
  33. data/lib/rake/helpers/raketask.rb +39 -0
  34. data/lib/rake/helpers/string.rb +10 -0
  35. data/lib/rake/helpers/unittest.rb +17 -0
  36. data/lib/rake/templates/project.erb +60 -0
  37. data/rake-delphi.gemspec +23 -0
  38. data/test/helpers/consts.rb +4 -0
  39. data/test/resources/FakeDelphi/dcc32.exe +0 -0
  40. data/test/resources/FakeDelphi/rc.exe +0 -0
  41. data/test/resources/echo/file.in +1 -0
  42. data/test/resources/echo/file.out +1 -0
  43. data/test/resources/hashes/hash.2.file +1 -0
  44. data/test/resources/hashes/hash.file +1 -0
  45. data/test/resources/ini/file.ini +7 -0
  46. data/test/resources/libstask/lib/level-1/level-2-1/level-3-1/.gitkeep +0 -0
  47. data/test/resources/libstask/lib/level-1/level-2-1/level-3-2/.gitkeep +0 -0
  48. data/test/resources/libstask/lib/level-1/level-2-2/.gitkeep +0 -0
  49. data/test/resources/testproject/.gitignore +8 -0
  50. data/test/resources/testproject/ExplicitLib/ExplicitLibUnit.pas +17 -0
  51. data/test/resources/testproject/Rakefile.rb +54 -0
  52. data/test/resources/testproject/lib/AnyLib/LibUnit.pas +17 -0
  53. data/test/resources/testproject/local.resources.txt +1 -0
  54. data/test/resources/testproject/release.dcc.cfg +1 -0
  55. data/test/resources/testproject/resources.rc +1 -0
  56. data/test/resources/testproject/testproject.bdsproj +175 -0
  57. data/test/resources/testproject/testproject.cfg +39 -0
  58. data/test/resources/testproject/testproject.dpr +78 -0
  59. data/test/resources/testproject/testproject.dproj +77 -0
  60. data/test/resources/testproject/testproject.ico +0 -0
  61. data/test/test-delphi.rb +166 -0
  62. data/test/test-echo.rb +33 -0
  63. data/test/test-gemversion.rb +61 -0
  64. data/test/test-git.rb +144 -0
  65. data/test/test-hashes.rb +57 -0
  66. data/test/test-ini.rb +18 -0
  67. data/test/test-libstask.rb +54 -0
  68. data/test/test-projectinfo.rb +66 -0
  69. data/test/test-zip.rb +43 -0
  70. metadata +179 -0
@@ -0,0 +1,175 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <BorlandProject>
3
+ <PersonalityInfo>
4
+ <Option>
5
+ <Option Name="Personality">Delphi.Personality</Option>
6
+ <Option Name="ProjectType">VCLApplication</Option>
7
+ <Option Name="Version">1.0</Option>
8
+ <Option Name="GUID">{C26EF931-F030-401E-98BD-888803951675}</Option>
9
+ </Option>
10
+ </PersonalityInfo>
11
+ <Delphi.Personality>
12
+ <Source>
13
+ <Source Name="MainSource">testproject.dpr</Source>
14
+ </Source>
15
+ <FileVersion>
16
+ <FileVersion Name="Version">7.0</FileVersion>
17
+ </FileVersion>
18
+ <Compiler>
19
+ <Compiler Name="A">8</Compiler>
20
+ <Compiler Name="B">0</Compiler>
21
+ <Compiler Name="C">1</Compiler>
22
+ <Compiler Name="D">1</Compiler>
23
+ <Compiler Name="E">0</Compiler>
24
+ <Compiler Name="F">0</Compiler>
25
+ <Compiler Name="G">1</Compiler>
26
+ <Compiler Name="H">1</Compiler>
27
+ <Compiler Name="I">1</Compiler>
28
+ <Compiler Name="J">0</Compiler>
29
+ <Compiler Name="K">0</Compiler>
30
+ <Compiler Name="L">1</Compiler>
31
+ <Compiler Name="M">0</Compiler>
32
+ <Compiler Name="N">1</Compiler>
33
+ <Compiler Name="O">1</Compiler>
34
+ <Compiler Name="P">1</Compiler>
35
+ <Compiler Name="Q">0</Compiler>
36
+ <Compiler Name="R">0</Compiler>
37
+ <Compiler Name="S">0</Compiler>
38
+ <Compiler Name="T">0</Compiler>
39
+ <Compiler Name="U">0</Compiler>
40
+ <Compiler Name="V">1</Compiler>
41
+ <Compiler Name="W">0</Compiler>
42
+ <Compiler Name="X">1</Compiler>
43
+ <Compiler Name="Y">1</Compiler>
44
+ <Compiler Name="Z">1</Compiler>
45
+ <Compiler Name="ShowHints">True</Compiler>
46
+ <Compiler Name="ShowWarnings">True</Compiler>
47
+ <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
48
+ <Compiler Name="NamespacePrefix"></Compiler>
49
+ <Compiler Name="GenerateDocumentation">False</Compiler>
50
+ <Compiler Name="DefaultNamespace"></Compiler>
51
+ <Compiler Name="SymbolDeprecated">True</Compiler>
52
+ <Compiler Name="SymbolLibrary">True</Compiler>
53
+ <Compiler Name="SymbolPlatform">True</Compiler>
54
+ <Compiler Name="SymbolExperimental">True</Compiler>
55
+ <Compiler Name="UnitLibrary">True</Compiler>
56
+ <Compiler Name="UnitPlatform">True</Compiler>
57
+ <Compiler Name="UnitDeprecated">True</Compiler>
58
+ <Compiler Name="UnitExperimental">True</Compiler>
59
+ <Compiler Name="HResultCompat">True</Compiler>
60
+ <Compiler Name="HidingMember">True</Compiler>
61
+ <Compiler Name="HiddenVirtual">True</Compiler>
62
+ <Compiler Name="Garbage">True</Compiler>
63
+ <Compiler Name="BoundsError">True</Compiler>
64
+ <Compiler Name="ZeroNilCompat">True</Compiler>
65
+ <Compiler Name="StringConstTruncated">True</Compiler>
66
+ <Compiler Name="ForLoopVarVarPar">True</Compiler>
67
+ <Compiler Name="TypedConstVarPar">True</Compiler>
68
+ <Compiler Name="AsgToTypedConst">True</Compiler>
69
+ <Compiler Name="CaseLabelRange">True</Compiler>
70
+ <Compiler Name="ForVariable">True</Compiler>
71
+ <Compiler Name="ConstructingAbstract">True</Compiler>
72
+ <Compiler Name="ComparisonFalse">True</Compiler>
73
+ <Compiler Name="ComparisonTrue">True</Compiler>
74
+ <Compiler Name="ComparingSignedUnsigned">True</Compiler>
75
+ <Compiler Name="CombiningSignedUnsigned">True</Compiler>
76
+ <Compiler Name="UnsupportedConstruct">True</Compiler>
77
+ <Compiler Name="FileOpen">True</Compiler>
78
+ <Compiler Name="FileOpenUnitSrc">True</Compiler>
79
+ <Compiler Name="BadGlobalSymbol">True</Compiler>
80
+ <Compiler Name="DuplicateConstructorDestructor">True</Compiler>
81
+ <Compiler Name="InvalidDirective">True</Compiler>
82
+ <Compiler Name="PackageNoLink">True</Compiler>
83
+ <Compiler Name="PackageThreadVar">True</Compiler>
84
+ <Compiler Name="ImplicitImport">True</Compiler>
85
+ <Compiler Name="HPPEMITIgnored">True</Compiler>
86
+ <Compiler Name="NoRetVal">True</Compiler>
87
+ <Compiler Name="UseBeforeDef">True</Compiler>
88
+ <Compiler Name="ForLoopVarUndef">True</Compiler>
89
+ <Compiler Name="UnitNameMismatch">True</Compiler>
90
+ <Compiler Name="NoCFGFileFound">True</Compiler>
91
+ <Compiler Name="ImplicitVariants">True</Compiler>
92
+ <Compiler Name="UnicodeToLocale">True</Compiler>
93
+ <Compiler Name="LocaleToUnicode">True</Compiler>
94
+ <Compiler Name="ImagebaseMultiple">True</Compiler>
95
+ <Compiler Name="SuspiciousTypecast">True</Compiler>
96
+ <Compiler Name="PrivatePropAccessor">True</Compiler>
97
+ <Compiler Name="UnsafeType">False</Compiler>
98
+ <Compiler Name="UnsafeCode">False</Compiler>
99
+ <Compiler Name="UnsafeCast">False</Compiler>
100
+ <Compiler Name="OptionTruncated">True</Compiler>
101
+ <Compiler Name="WideCharReduced">True</Compiler>
102
+ <Compiler Name="DuplicatesIgnored">True</Compiler>
103
+ <Compiler Name="UnitInitSeq">True</Compiler>
104
+ <Compiler Name="LocalPInvoke">True</Compiler>
105
+ <Compiler Name="MessageDirective">True</Compiler>
106
+ <Compiler Name="CodePage"></Compiler>
107
+ </Compiler>
108
+ <Linker>
109
+ <Linker Name="MapFile">0</Linker>
110
+ <Linker Name="OutputObjs">0</Linker>
111
+ <Linker Name="GenerateHpps">False</Linker>
112
+ <Linker Name="ConsoleApp">1</Linker>
113
+ <Linker Name="DebugInfo">False</Linker>
114
+ <Linker Name="RemoteSymbols">False</Linker>
115
+ <Linker Name="GenerateDRC">False</Linker>
116
+ <Linker Name="MinStackSize">16384</Linker>
117
+ <Linker Name="MaxStackSize">1048576</Linker>
118
+ <Linker Name="ImageBase">4194304</Linker>
119
+ <Linker Name="ExeDescription"></Linker>
120
+ </Linker>
121
+ <Directories>
122
+ <Directories Name="OutputDir"></Directories>
123
+ <Directories Name="UnitOutputDir"></Directories>
124
+ <Directories Name="PackageDLLOutputDir"></Directories>
125
+ <Directories Name="PackageDCPOutputDir"></Directories>
126
+ <Directories Name="SearchPath"></Directories>
127
+ <Directories Name="Packages"></Directories>
128
+ <Directories Name="Conditionals"></Directories>
129
+ <Directories Name="DebugSourceDirs"></Directories>
130
+ <Directories Name="UsePackages">False</Directories>
131
+ </Directories>
132
+ <Parameters>
133
+ <Parameters Name="RunParams"></Parameters>
134
+ <Parameters Name="HostApplication"></Parameters>
135
+ <Parameters Name="Launcher"></Parameters>
136
+ <Parameters Name="UseLauncher">False</Parameters>
137
+ <Parameters Name="DebugCWD"></Parameters>
138
+ <Parameters Name="Debug Symbols Search Path"></Parameters>
139
+ <Parameters Name="LoadAllSymbols">True</Parameters>
140
+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
141
+ </Parameters>
142
+ <Language>
143
+ <Language Name="ActiveLang"></Language>
144
+ <Language Name="ProjectLang">$00000000</Language>
145
+ <Language Name="RootDir"></Language>
146
+ </Language>
147
+ <VersionInfo>
148
+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
149
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
150
+ <VersionInfo Name="MajorVer">4</VersionInfo>
151
+ <VersionInfo Name="MinorVer">3</VersionInfo>
152
+ <VersionInfo Name="Release">2</VersionInfo>
153
+ <VersionInfo Name="Build">1</VersionInfo>
154
+ <VersionInfo Name="Debug">False</VersionInfo>
155
+ <VersionInfo Name="PreRelease">False</VersionInfo>
156
+ <VersionInfo Name="Special">False</VersionInfo>
157
+ <VersionInfo Name="Private">False</VersionInfo>
158
+ <VersionInfo Name="DLL">False</VersionInfo>
159
+ <VersionInfo Name="Locale">1049</VersionInfo>
160
+ <VersionInfo Name="CodePage">1251</VersionInfo>
161
+ </VersionInfo>
162
+ <VersionInfoKeys>
163
+ <VersionInfoKeys Name="CompanyName">Rake</VersionInfoKeys>
164
+ <VersionInfoKeys Name="FileDescription">Test rake-delphi project 2006 description</VersionInfoKeys>
165
+ <VersionInfoKeys Name="FileVersion">4.3.2.1</VersionInfoKeys>
166
+ <VersionInfoKeys Name="InternalName">testproject.exe</VersionInfoKeys>
167
+ <VersionInfoKeys Name="LegalCopyright">Copyright. Копирайт</VersionInfoKeys>
168
+ <VersionInfoKeys Name="LegalTrademarks">Trademark. Торговая марка</VersionInfoKeys>
169
+ <VersionInfoKeys Name="OriginalFilename">testproject.exe</VersionInfoKeys>
170
+ <VersionInfoKeys Name="ProductName">Test rake-delphi project 2006 product name</VersionInfoKeys>
171
+ <VersionInfoKeys Name="ProductVersion">1.2.3.4</VersionInfoKeys>
172
+ <VersionInfoKeys Name="Comments">Test project comment</VersionInfoKeys>
173
+ </VersionInfoKeys>
174
+ </Delphi.Personality>
175
+ </BorlandProject>
@@ -0,0 +1,39 @@
1
+ -$A8
2
+ -$B-
3
+ -$C+
4
+ -$D+
5
+ -$E-
6
+ -$F-
7
+ -$G+
8
+ -$H+
9
+ -$I+
10
+ -$J-
11
+ -$K-
12
+ -$L+
13
+ -$M-
14
+ -$N+
15
+ -$O+
16
+ -$P+
17
+ -$Q-
18
+ -$R-
19
+ -$S-
20
+ -$T-
21
+ -$U-
22
+ -$V+
23
+ -$W-
24
+ -$X+
25
+ -$YD
26
+ -$Z1
27
+ -cg
28
+ -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
29
+ -H+
30
+ -W+
31
+ -M
32
+ -$M16384,1048576
33
+ -K$00400000
34
+ -LE"C:\Users\Shumkin.Alexey\Documents\Borland Studio Projects\Bpl"
35
+ -LN"C:\Users\Shumkin.Alexey\Documents\Borland Studio Projects\Bpl"
36
+ -w-UNSAFE_TYPE
37
+ -w-UNSAFE_CODE
38
+ -w-UNSAFE_CAST
39
+ -DCONFIG
@@ -0,0 +1,78 @@
1
+ program testproject;
2
+
3
+ uses
4
+ Classes, SysUtils, Types
5
+ {$IFDEF LIBS}
6
+ , LibUnit
7
+ {$ENDIF LIBS}
8
+ {$IFDEF INDY}
9
+ , IdURI
10
+ {$ENDIF INDY}
11
+ {$IFDEF EXPLICIT_LIBS}
12
+ , ExplicitLibUnit
13
+ {$ENDIF}
14
+ ;
15
+
16
+ {$APPTYPE CONSOLE}
17
+
18
+ {$R *.res}
19
+ {$IFDEF RESOURCES}
20
+ {$R 'resources.res' 'resources.rc'}
21
+ {$ENDIF RESOURCES}
22
+ {$IFDEF ASSIGNABLE_CONSTS}
23
+ const
24
+ TEST_CONST: string = '-=ASSIGNED CONST=-';
25
+ {$ENDIF ASSIGNABLE_CONSTS}
26
+ var
27
+ res: TResourceStream;
28
+ str: TStringStream;
29
+ s: string;
30
+ begin
31
+ {$IFDEF DEBUG}
32
+ Write('DEBUG: ');
33
+ {$ENDIF}
34
+ {$IFOPT D+}
35
+ Write('D+: ');
36
+ {$ENDIF}
37
+ s := EmptyStr;
38
+ try
39
+ res := TResourceStream.Create(HInstance, 'LOCAL_RESOURCES', RT_RCDATA);
40
+ try
41
+ str := TStringStream.Create(EmptyStr);
42
+ try
43
+ res.SaveToStream(str);
44
+ s := str.DataString;
45
+ finally
46
+ FreeAndNil(str);
47
+ end;
48
+ finally
49
+ FreeAndNil(res);
50
+ end;
51
+ except
52
+ s := EmptyStr;
53
+ end;
54
+ {$IFDEF LIBS}
55
+ s := s + LibUnit.LibUnitFunction;
56
+ {$ENDIF LIBS}
57
+ {$IFDEF EXPLICIT_LIBS}
58
+ s := s + ExplicitLibUnit.ExplicitLibUnitFunction;
59
+ {$ENDIF EXPLICIT_LIBS}
60
+ {$IFDEF ASSIGNABLE_CONSTS}
61
+ s := s + TEST_CONST;
62
+ {$ENDIF ASSIGNABLE_CONSTS}
63
+ {$IFDEF RELEASE_CFG}
64
+ s := s + '-=RELEASE=-';
65
+ {$ENDIF RELEASE_CFG}
66
+ {$IFDEF CONFIG}
67
+ s := s + '-=CONFIG=-';
68
+ {$ENDIF CONFIG}
69
+ {$IFDEF INDY}
70
+ with TIdURI.Create('http://indy/path') do
71
+ try
72
+ s := s + Format('-=%s#%s=-', [Host, Document]);
73
+ finally
74
+ Free;
75
+ end;
76
+ {$ENDIF}
77
+ WriteLn('testproject works', s);
78
+ end.
@@ -0,0 +1,77 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <PropertyGroup>
4
+ <ProjectGuid>{af8ea221-1e83-4b10-930b-73b0e6f4b239}</ProjectGuid>
5
+ <MainSource>testproject.dpr</MainSource>
6
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8
+ <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
9
+ <DCC_DependencyCheckOutputName>testproject.exe</DCC_DependencyCheckOutputName>
10
+ </PropertyGroup>
11
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
12
+ <Version>7.0</Version>
13
+ <DCC_DebugInformation>False</DCC_DebugInformation>
14
+ <DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
15
+ <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
16
+ <DCC_Define>RELEASE</DCC_Define>
17
+ </PropertyGroup>
18
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19
+ <Version>7.0</Version>
20
+ <DCC_Define>DEBUG</DCC_Define>
21
+ <DCC_DebugInformation>False</DCC_DebugInformation>
22
+ </PropertyGroup>
23
+ <ProjectExtensions>
24
+ <Borland.Personality>Delphi.Personality</Borland.Personality>
25
+ <Borland.ProjectType>VCLApplication</Borland.ProjectType>
26
+ <BorlandProject>
27
+ <BorlandProject> <Delphi.Personality> <Parameters>
28
+ <Parameters Name="UseLauncher">False</Parameters>
29
+ <Parameters Name="LoadAllSymbols">True</Parameters>
30
+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
31
+ </Parameters>
32
+ <VersionInfo>
33
+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
34
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
35
+ <VersionInfo Name="MajorVer">4</VersionInfo>
36
+ <VersionInfo Name="MinorVer">3</VersionInfo>
37
+ <VersionInfo Name="Release">2</VersionInfo>
38
+ <VersionInfo Name="Build">1</VersionInfo>
39
+ <VersionInfo Name="Debug">False</VersionInfo>
40
+ <VersionInfo Name="PreRelease">False</VersionInfo>
41
+ <VersionInfo Name="Special">False</VersionInfo>
42
+ <VersionInfo Name="Private">False</VersionInfo>
43
+ <VersionInfo Name="DLL">False</VersionInfo>
44
+ <VersionInfo Name="Locale">1049</VersionInfo>
45
+ <VersionInfo Name="CodePage">1251</VersionInfo>
46
+ </VersionInfo>
47
+ <VersionInfoKeys>
48
+ <VersionInfoKeys Name="CompanyName">Rake</VersionInfoKeys>
49
+ <VersionInfoKeys Name="FileDescription">Test rake-delphi project 2007 description</VersionInfoKeys>
50
+ <VersionInfoKeys Name="FileVersion">4.3.2.1</VersionInfoKeys>
51
+ <VersionInfoKeys Name="InternalName">testproject.exe</VersionInfoKeys>
52
+ <VersionInfoKeys Name="LegalCopyright">Copyright. Копирайт</VersionInfoKeys>
53
+ <VersionInfoKeys Name="LegalTrademarks">Trademark. Торговая марка</VersionInfoKeys>
54
+ <VersionInfoKeys Name="OriginalFilename">testproject.exe</VersionInfoKeys>
55
+ <VersionInfoKeys Name="ProductName">Test rake-delphi project 2007 product name</VersionInfoKeys>
56
+ <VersionInfoKeys Name="ProductVersion">1.2.3.4</VersionInfoKeys>
57
+ <VersionInfoKeys Name="Comments">Test project comment</VersionInfoKeys>
58
+ </VersionInfoKeys>
59
+ <Excluded_Packages>
60
+ <Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\5.0\Bpl\rxctl110.bpl">RX Library Component and Tools Package</Excluded_Packages>
61
+ <Excluded_Packages Name="C:\Users\Public\Documents\RAD Studio\5.0\Bpl\JclDeveloperTools110.bpl">JEDI Code Library Developer Tools package</Excluded_Packages>
62
+ <Excluded_Packages Name="$(BDS)\bin\dcloffice2k100.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
63
+ <Excluded_Packages Name="$(BDS)\bin\dclofficexp100.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
64
+ <Excluded_Packages Name="c:\Program Files\FastReports\FastReport 4\LibD11\frxDB11.bpl">(untitled)</Excluded_Packages>
65
+ </Excluded_Packages>
66
+ <Source>
67
+ <Source Name="MainSource">testproject.dpr</Source>
68
+ </Source>
69
+ </Delphi.Personality> </BorlandProject></BorlandProject>
70
+ </ProjectExtensions>
71
+ <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
72
+ <ItemGroup>
73
+ <DelphiCompile Include="testproject.dpr">
74
+ <MainSource>MainSource</MainSource>
75
+ </DelphiCompile>
76
+ </ItemGroup>
77
+ </Project>
@@ -0,0 +1,166 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rake'
4
+ require 'fileutils'
5
+ require 'test/unit'
6
+ require 'rake/delphi'
7
+ require 'rake/delphi/project'
8
+ require 'rake/delphi/tool'
9
+ require 'rake/helpers/unittest'
10
+ require 'helpers/consts'
11
+
12
+ module DelphiTests
13
+
14
+ class TestDelphi < Test::Unit::TestCase
15
+ private
16
+ def reenable_tasks(task)
17
+ return unless task.class <= Rake::Task
18
+ task.reenable
19
+ task.prerequisites.each do |ptask|
20
+ ptask.reenable if ptask.class < Rake::Task
21
+ reenable_tasks(ptask)
22
+ end
23
+ end
24
+
25
+ def _test_compile_and_output(prepare_args, output)
26
+ args = [:altercfg, :usecfg, :defines, :debuginfo, :debug, :includepaths]
27
+ # reinitialize arguments (even absent ones)
28
+ args.each do |arg|
29
+ prepare_args[arg] = prepare_args[arg]
30
+ end
31
+
32
+ bin_dir = File.dirname(exe)
33
+ FileUtils.mkdir_p(bin_dir)
34
+ # reenable task for subsequent calls
35
+ prepare_task = ::Rake::Task['test:prepare']
36
+ prepare_task.reenable
37
+ # prepare arguments
38
+ useresources = prepare_args[:useresources]
39
+ prepare_args.delete(:useresources)
40
+ prepare_args[:bin] = bin_dir
41
+
42
+ prepare_task.invoke(useresources, prepare_args)
43
+
44
+ # reenable tasks (!!! after invoking 'test:prepare')
45
+ task = ::Rake::Task['test:compile']
46
+ reenable_tasks(task)
47
+ task.invoke
48
+
49
+ assert(File.exists?(exe), 'File %s does not exist' % exe)
50
+ out = `#{exe}`.chomp
51
+ assert_equal output, out, 'exe output'
52
+ end
53
+
54
+ def exe
55
+ exe = PROJECT_EXE % name.gsub(/[():]/, '_')
56
+ end
57
+ public
58
+ def setup
59
+ ENV['RAKE_DIR'] = PROJECT_PATH
60
+ File.unlink(exe) if File.exists?(exe)
61
+ res = PROJECT_PATH + '/resources.res'
62
+ File.unlink(res) if File.exists?(res)
63
+ # assert(! File.exists?(exe), 'File %s exists' % exe)
64
+ require PROJECT_PATH + '/Rakefile.rb'
65
+ end
66
+
67
+ def test_compile
68
+ _test_compile_and_output({},
69
+ 'testproject works')
70
+ end
71
+
72
+ def test_compile_defines
73
+ _test_compile_and_output({:defines => 'DEBUG'},
74
+ 'DEBUG: testproject works')
75
+ end
76
+
77
+ def test_compile_debug_info
78
+ _test_compile_and_output({:debug => true, :debuginfo => true},
79
+ 'D+: testproject works')
80
+ end
81
+
82
+ def test_compile_with_resources
83
+ _test_compile_and_output({:useresources => true, :defines => 'RESOURCES'},
84
+ 'testproject works-=WITH RESOURCES=-')
85
+ end
86
+
87
+ def test_compile_with_libs
88
+ _test_compile_and_output({:useresources => true, :defines => 'LIBS'},
89
+ 'testproject works-=WITH LIBS=-')
90
+ end
91
+
92
+ def test_compile_with_resources_and_libs
93
+ _test_compile_and_output({:useresources => true, :defines => 'RESOURCES,LIBS'},
94
+ 'testproject works-=WITH RESOURCES=--=WITH LIBS=-')
95
+ end
96
+
97
+ def test_compile_consts
98
+ _test_compile_and_output({:defines => 'ASSIGNABLE_CONSTS', :writeableconst => true},
99
+ 'testproject works-=ASSIGNED CONST=-')
100
+ end
101
+
102
+ def test_compile_alter_cfg
103
+ _test_compile_and_output({:altercfg => 'release.dcc.cfg'},
104
+ 'testproject works-=RELEASE=-')
105
+ end
106
+
107
+ def test_compile_use_config
108
+ _test_compile_and_output({:usecfg => true},
109
+ 'testproject works-=CONFIG=-')
110
+ end
111
+
112
+ def test_compile_use_library_path
113
+ # usually Indy components are in Delphi library paths
114
+ _test_compile_and_output({:defines => 'INDY', :uselibrarypath => true},
115
+ 'testproject works-=indy#path=-')
116
+ end
117
+
118
+ def test_compile_with_explicit_libs
119
+ paths = ['./ExplicitLib/']
120
+ _test_compile_and_output({:defines => 'EXPLICIT_LIBS',
121
+ :includepaths => paths},
122
+ 'testproject works-=WITH EXPLICIT LIBS=-')
123
+ end
124
+
125
+ def test_compile_with_explicit_and_implicit_libs
126
+ paths = ['./ExplicitLib/']
127
+ _test_compile_and_output({:defines => 'LIBS,EXPLICIT_LIBS',
128
+ :includepaths => paths},
129
+ 'testproject works-=WITH LIBS=--=WITH EXPLICIT LIBS=-')
130
+ end
131
+ end
132
+
133
+ class TestCustomDelphiTool < Test::Unit::TestCase
134
+ private
135
+ public
136
+ def test_checkToolFailure
137
+ assert_nothing_raised RuntimeError do
138
+ Rake::Delphi::CustomDelphiTool.checkToolFailure(__FILE__)
139
+ end
140
+ end
141
+
142
+ def test_checkToolFailure_failure
143
+ assert_raise RuntimeError do
144
+ Rake::Delphi::CustomDelphiTool.checkToolFailure(__FILE__ + '.ext')
145
+ end
146
+ end
147
+ end
148
+
149
+ class TestRCResourceCompiler < Test::Unit::TestCase
150
+ private
151
+ public
152
+ def setup
153
+ Rake::Delphi::RCResourceCompiler.reinit
154
+ ENV['DELPHI_DIR'] = File.expand_path('../FakeDelphi', PROJECT_PATH)
155
+ ENV['DELPHI_VERSION'] = '10'
156
+ end
157
+
158
+ def test_find
159
+ rc = Rake::Delphi::RCResourceCompiler.new
160
+ assert_equal ENV['DELPHI_DIR'], rc.delphidir, 'delphi path'
161
+ assert_equal '10', rc.version, 'delphi version'
162
+ assert_equal ENV['DELPHI_DIR'] + 'bin/rc.exe', rc.toolpath, 'delphi path'
163
+ end
164
+ end
165
+
166
+ end
data/test/test-echo.rb ADDED
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rake'
4
+ require 'test/unit'
5
+ require 'rake/common/echotask'
6
+ require 'rake/helpers/unittest'
7
+
8
+ class TestEchoToFileTask < Test::Unit::TestCase
9
+ private
10
+ def file_in
11
+ return @file_in ||= File.expand_path('../resources/echo/file.in', __FILE__)
12
+ end
13
+
14
+ def file_out
15
+ return @file_out ||= File.expand_path('../tmp/file.out', __FILE__)
16
+ end
17
+ public
18
+ def setup
19
+ @rake_task = Rake::Task.new('some-task-' + name, Rake.application)
20
+ end
21
+
22
+ def test_nil_vars
23
+ Rake::Delphi::EchoToFile.new(@rake_task, file_in, file_out, nil)
24
+ lines = IO.readlines(file_out)
25
+ assert_equal "${echo_variable} must be replaced by its <value>\n", lines[0]
26
+ end
27
+
28
+ def test_vars
29
+ Rake::Delphi::EchoToFile.new(@rake_task, file_in, file_out, {'echo_variable' => 'echo_variable_value'})
30
+ lines = IO.readlines(file_out)
31
+ assert_equal "echo_variable_value must be replaced by its <value>\n", lines[0]
32
+ end
33
+ end
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test/unit'
4
+ require 'rake/helpers/gemversion'
5
+
6
+ class TestVersionImproved < Test::Unit::TestCase
7
+ public
8
+ def setup
9
+ end
10
+
11
+ def test_new_nil
12
+ assert_equal '0.0.0.0', Gem::VersionImproved.new(nil).version
13
+ end
14
+
15
+ def test_new_empty_string
16
+ assert_equal '0.0.0.0', Gem::VersionImproved.new('').version
17
+ end
18
+
19
+ def test_comma_nil
20
+ assert_equal '0,0,0,0', Gem::VersionImproved.new(nil).comma
21
+ end
22
+
23
+ def test_comma_empty_string
24
+ assert_equal '0,0,0,0', Gem::VersionImproved.new('').comma
25
+ end
26
+
27
+ def test_comma
28
+ assert_equal '1,2,3,4', Gem::VersionImproved.new('1.2.3.4').comma
29
+ end
30
+
31
+ def test_prev_release
32
+ @version = Gem::VersionImproved.new('1.2.3.4')
33
+ assert_equal '1.2.2', @version.prev_release.version
34
+
35
+ @version = Gem::VersionImproved.new('1.2.3')
36
+ assert_equal '1.1', @version.prev_release.version
37
+
38
+ @version = Gem::VersionImproved.new('1.2')
39
+ assert_equal '0', @version.prev_release.version
40
+ end
41
+
42
+ def test_build
43
+ @version = Gem::VersionImproved.new('1.2.3.4')
44
+ assert_equal '1.2.3.4', @version.build.version
45
+
46
+ @version = Gem::VersionImproved.new('1.2.3')
47
+ assert_equal '1.2.3', @version.build.version
48
+
49
+ @version = Gem::VersionImproved.new('1.2')
50
+ assert_equal '1.2', @version.build.version
51
+
52
+ @version = Gem::VersionImproved.new('1.2.3.a')
53
+ assert_equal '1.2.4', @version.build.version
54
+
55
+ @version = Gem::VersionImproved.new('1.2.x')
56
+ assert_equal '1.3', @version.build.version
57
+
58
+ @version = Gem::VersionImproved.new('1.x')
59
+ assert_equal '2', @version.build.version
60
+ end
61
+ end