PackageVisualStudio.pas 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. { Rev 1.5 2004.11.14 10:35:34 AM czhower
  18. { Update
  19. }
  20. {
  21. { Rev 1.4 12/10/2004 17:52:34 HHariri
  22. { Fixes for VS
  23. }
  24. {
  25. { Rev 1.3 12/10/2004 15:39:30 HHariri
  26. { Fixes for VS
  27. }
  28. {
  29. { Rev 1.2 04/09/2004 12:45:16 ANeillans
  30. { Moved the databasename and output paths into a globally accessible variable
  31. { -- makes it a lot easier to override if you need to (as I did for my local
  32. { file structure).
  33. }
  34. {
  35. { Rev 1.1 2004.05.19 10:01:52 AM czhower
  36. { Updates
  37. }
  38. {
  39. { Rev 1.0 2004.01.22 8:18:36 PM czhower
  40. { Initial checkin
  41. }
  42. unit PackageVisualStudio;
  43. interface
  44. uses
  45. Package;
  46. type
  47. TPackageVisualStudio = class(TPackage)
  48. protected
  49. procedure GenHeader; override;
  50. procedure GenOptions; override;
  51. procedure GenContains; override;
  52. procedure GenFooter; override;
  53. public
  54. constructor Create; override;
  55. procedure Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags); override;
  56. end;
  57. implementation
  58. { TPackageVisualStudio }
  59. constructor TPackageVisualStudio.Create;
  60. begin
  61. inherited;
  62. FContainsClause := 'uses';
  63. FExt := '.dpr';
  64. FOutputSubDir := 'Lib';
  65. end;
  66. procedure TPackageVisualStudio.Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags);
  67. begin
  68. FName := 'Indy.Sockets' + iif(gfDebug in AFlags, 'Debug', '');
  69. FDesc := '.Net Assembly';
  70. AddUnit('IdAssemblyInfo', 'System');
  71. inherited Generate(ACompiler, AFlags - [gfDesignTime]);
  72. WriteFile;
  73. end;
  74. procedure TPackageVisualStudio.GenHeader;
  75. begin
  76. Code('library ' + FName + ';');
  77. end;
  78. procedure TPackageVisualStudio.GenOptions;
  79. begin
  80. Code('');
  81. Code('{%DelphiDotNetAssemblyCompiler ''$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll''}');
  82. // Dont seem to need .Delphi? But internal errors when not included sometimes
  83. Code('{%DelphiDotNetAssemblyCompiler ''$(CommonProgramFiles)\borland shared\bds\shared assemblies\3.0\Borland.Delphi.dll''}');
  84. // Doesnt seem to need this either - likely the visual parts are here
  85. //Code('{%DelphiDotNetAssemblyCompiler ''$(CommonProgramFiles)\borland shared\bds\shared assemblies\3.0\Borland.Vcl.dll''}');
  86. Code('{%DelphiDotNetAssemblyCompiler ''$(CommonProgramFiles)\borland shared\bds\shared assemblies\3.0\Borland.VclRtl.dll''}');
  87. Code('');
  88. end;
  89. procedure TPackageVisualStudio.GenContains;
  90. begin
  91. if FDebug then begin
  92. inherited GenContains();
  93. end else begin
  94. inherited GenContains('Indy.Sockets.Id', False);
  95. end;
  96. end;
  97. procedure TPackageVisualStudio.GenFooter;
  98. begin
  99. Code('');
  100. Code('');
  101. Code('//');
  102. Code('// Version information for an assembly consists of the following four values:');
  103. Code('//');
  104. Code('// Major Version');
  105. Code('// Minor Version');
  106. Code('// Build Number');
  107. Code('// Revision');
  108. Code('//');
  109. Code('// You can specify all the values or you can default the Revision and Build Numbers');
  110. Code('// by using the ''*'' as shown below:');
  111. Code('');
  112. Code('');
  113. Code('//');
  114. Code('// In order to sign your assembly you must specify a key to use. Refer to the');
  115. Code('// Microsoft .NET Framework documentation for more information on assembly signing.');
  116. Code('//');
  117. Code('// Use the attributes below to control which key is used for signing.');
  118. Code('//');
  119. Code('// Notes:');
  120. Code('// (*) If no key is specified, the assembly is not signed.');
  121. Code('// (*) KeyName refers to a key that has been installed in the Crypto Service');
  122. Code('// Provider (CSP) on your machine. KeyFile refers to a file which contains');
  123. Code('// a key.');
  124. Code('// (*) If the KeyFile and the KeyName values are both specified, the');
  125. Code('// following processing occurs:');
  126. Code('// (1) If the KeyName can be found in the CSP, that key is used.');
  127. Code('// (2) If the KeyName does not exist and the KeyFile does exist, the key');
  128. Code('// in the KeyFile is installed into the CSP and used.');
  129. Code('// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.');
  130. Code('// When specifying the KeyFile, the location of the KeyFile should be');
  131. Code('// relative to the project output directory. For example, if your KeyFile is');
  132. Code('// located in the project directory, you would specify the AssemblyKeyFile');
  133. Code('// attribute as [assembly: AssemblyKeyFile(''mykey.snk'')], provided your output');
  134. Code('// directory is the project directory (the default).');
  135. Code('// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework');
  136. Code('// documentation for more information on this.');
  137. Code('//');
  138. Code('');
  139. Code('//');
  140. Code('// Use the attributes below to control the COM visibility of your assembly. By');
  141. Code('// default the entire assembly is visible to COM. Setting ComVisible to false');
  142. Code('// is the recommended default for your assembly. To then expose a class and interface');
  143. Code('// to COM set ComVisible to true on each one. It is also recommended to add a');
  144. Code('// Guid attribute.');
  145. Code('//');
  146. Code('');
  147. Code('//[assembly: Guid('')]');
  148. Code('//[assembly: TypeLibVersion(1, 0)]');
  149. Code('');
  150. Code('begin');
  151. inherited GenFooter;
  152. end;
  153. end.