PageRenderTime 54ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/quickstart.html

https://code.google.com/p/pct/
HTML | 305 lines | 269 code | 36 blank | 0 comment | 0 complexity | 87d2520e53c27b3565a8b1d9c39790df MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  6. <meta http-equiv="Content-language" content="en" />
  7. <meta name="Keywords" content="progress,ant,compilation,automated,task,querret,apache,build tools,roundtable" />
  8. <meta name="Description" content="PCT is set of ANT tasks designed to compile Progress procedures among others things" />
  9. <meta name="revisit-after" content="30 days" />
  10. <meta name="DC.Language" content="en" />
  11. <title>PCT documentation - Quick start</title>
  12. <link rel="stylesheet" type="text/css" href="style.css" media="screen" title="Normal" />
  13. </head>
  14. <body>
  15. <div class="Main">
  16. <div class="Bandeau">
  17. <span id="sflogo">
  18. <a href="http://sourceforge.net"><img id="sflogoimg" alt="SourceForge.net Logo" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=%3Cb%3E85743%3C/b%3E&amp;amp;type=1"/></a>
  19. </span>
  20. Progress&reg; OpenEdge&reg; Compilation Tools
  21. </div>
  22. <div class="Menu">
  23. <a href="index.html">Overview</a>
  24. :: <a href="download.html">Download</a>
  25. :: <a href="screenshots.html">Screenshots</a>
  26. :: <span class="selected">Documentation</span>
  27. :: <a href="javadoc/index.html">JavaDoc</a>
  28. :: <a href="links.html">Links</a>
  29. </div>
  30. @RIGHT_BANNER@
  31. <div class="Text">
  32. <h1>Quick start</h1>
  33. <h2>Step 1 : first build.xml file (aka Hello, world!) [Download <a href="sample1.zip">sample</a>]</h2>
  34. <p>
  35. Let's assume ANT and PCT are correctly installed (see <a href="manual.html">manual</a>).
  36. We'll create a new Progress
  37. project in a directory called, say, MyProject. As a good practice, we'll separate
  38. sources from build files : let's say we'll have a subdirectory called <em>src</em>
  39. for sources, and a subdirectory called <em>build</em> for build files.
  40. </p>
  41. <p>
  42. We'll now create one or more procedures in the <em>src</em> subdir. For example,
  43. in <em>MyProject/src/test.p</em> :</p><pre class="source">
  44. MESSAGE "This is a test file".
  45. </pre>
  46. <p>And now, in <em>MyProject/build.xml</em> :</p>
  47. <pre class="source">
  48. &lt;?xml version="1.0" encoding="utf-8"?&gt;
  49. &lt;project name="MyProject" default="build" basedir="."&gt;
  50. &lt;property environment="env" /&gt;
  51. &lt;taskdef resource="PCT.properties" classpath="${env.PCT_HOME}/lib/PCT.jar" /&gt;
  52. &lt;target name="build" description="Builds source files"&gt;
  53. &lt;mkdir dir="build"/&gt;
  54. &lt;PCTCompile destDir="build" dlcHome="${env.DLC}"&gt;
  55. &lt;fileset dir="src"&gt;
  56. &lt;include name="*.p" /&gt;
  57. &lt;/fileset&gt;
  58. &lt;/PCTCompile&gt;
  59. &lt;/target&gt;
  60. &lt;/project&gt;
  61. </pre>
  62. <p>
  63. Open a shell, define two environment variables, DLC and PCT_HOME, pointing to
  64. Progress base directory and PCT base directory. Ant also assumes that ANT_HOME,
  65. JAVA_HOME are defined, but that's part of Ant installation.
  66. Then cd to the MyProject directory, and then type <code>ant build</code>.
  67. You should get the following :</p>
  68. <pre class="output">
  69. Buildfile: build.xml
  70. build:
  71. [mkdir] Created dir: /home/justus/MyProject/build
  72. [PCTCompile] PCTCompile - Progress Code Compiler
  73. [PCTCompile] 1 file(s) compiled
  74. BUILD SUCCESSFUL
  75. Total time: 1 seconds
  76. </pre>
  77. <p>And you should have a subdir called build, containing a test.r file.</p>
  78. <p>A few words on this :</p><ul>
  79. <li>Line 4 tells Ant to load environment variables so that
  80. they could be accessed with ${env.VARIABLE_NAME} : useful for DLC and PCT_HOME...</li>
  81. <li>Line 6 tells Ant to load the mapping between tasks name (e.g. PCTCompile) and Java
  82. class files (e.g. com.phenix.pct.PCTCompile) : this is mandatory to have a working
  83. PCT.</li>
  84. <li>Lines 10 to 14 tells PCT to compile every .p file in the src directory, and then
  85. put them in the destDir directory.</li>
  86. </ul>
  87. <p>
  88. Download the <a href="sample1.zip">sample</a>
  89. </p>
  90. <h2>Step 2 : adding a database [Download <a href="sample2.zip">sample</a>]</h2>
  91. <p>
  92. We'll create a subdir called db, containing the database dump file (called db.df).
  93. Just create this file :</p>
  94. <pre class="source"">
  95. ADD TABLE "MyTable"
  96. AREA "Schema Area"
  97. DUMP-NAME "MyTable"
  98. ADD FIELD "Fld1" OF "MyTable" AS character
  99. ADD FIELD "Fld2" OF "MyTable" AS character
  100. ADD INDEX "MyTable-PK" ON "MyTable"
  101. AREA "Schema Area"
  102. UNIQUE
  103. PRIMARY
  104. INDEX-FIELD "Fld1" ASCENDING
  105. </pre>
  106. <p>This should create a really simple table, with two fields, and a primary unique index.</p>
  107. <p>Now, we'll create a new procedure, called src/test2.p :</p>
  108. <pre class="source">
  109. CREATE MyTable.
  110. ASSIGN MyTable.Fld1 = "ABC"
  111. MyTable.Fld2 = "DEF".
  112. </pre>
  113. <p>Now, add the following line after line 8 of the previous build.xml :</p>
  114. <pre class="source">
  115. &lt;PCTCreateBase dbName="db" destDir="db" schemaFile="db/db.df" dlcHome="${env.DLC}"/&gt;
  116. </pre>
  117. <p>and this one after line 10 :</p>
  118. <pre class="source"">
  119. &lt;PCTConnection dbName="db" dbDir="db" singleUser="true"/&gt;
  120. </pre>
  121. <p>Now run ant build from the shell prompt. You should get the following :</p>
  122. <pre class="output">
  123. Buildfile: build.xml
  124. build:
  125. [PCTCreateBase] procopy source session begin for justus on batch. (451)
  126. [PCTCreateBase] Formatting extents:
  127. [PCTCreateBase] size area name path name
  128. [PCTCreateBase] 4 Primary Recovery Area /home/justus/MyProject/db/db.b1 00:00:00
  129. [PCTCreateBase] 4 Schema Area /home/justus/MyProject/db/db.d1 00:00:00
  130. [PCTCreateBase] Copying /opt/dlc10/empty8 to db... (6715)
  131. [PCTCreateBase] Start writing data blocks. (6718)
  132. [PCTCreateBase] 14:23:21 10 Percent complete.
  133. [PCTCreateBase] 14:23:21 20 Percent complete.
  134. [PCTCreateBase] 14:23:21 30 Percent complete.
  135. [PCTCreateBase] 14:23:21 40 Percent complete.
  136. [PCTCreateBase] 14:23:21 50 Percent complete.
  137. [PCTCreateBase] 14:23:21 60 Percent complete.
  138. [PCTCreateBase] 14:23:21 70 Percent complete.
  139. [PCTCreateBase] 14:23:21 80 Percent complete.
  140. [PCTCreateBase] 14:23:21 90 Percent complete.
  141. [PCTCreateBase] 14:23:21 100 Percent complete.
  142. [PCTCreateBase] 239 blocks copied. (6720)
  143. [PCTCreateBase] ...Copy complete. (6722)
  144. [PCTCreateBase] procopy source session end. (334)
  145. [PCTCreateBase] Database copied from /opt/dlc10/empty8. (1365)
  146. [PCTCompile] PCTCompile - Progress Code Compiler
  147. [PCTCompile] 2 file(s) compiled
  148. BUILD SUCCESSFUL
  149. Total time: 7 seconds
  150. </pre>
  151. Running ant build a second time will give you this :<pre class="output">
  152. Buildfile: build.xml
  153. build:
  154. [PCTCompile] PCTCompile - Progress Code Compiler
  155. [PCTCompile] 0 file(s) compiled
  156. BUILD SUCCESSFUL
  157. Total time: 1 seconds
  158. </pre>
  159. <h2>Step 3 : dealing with propath [Download <a href="sample3.zip">sample</a>]</h2>
  160. <p>Imagine you'd like to work with PDFInclude : it would be a good idea to separate
  161. your own source code from PDFInclude source code, so that upgrading to a newer version
  162. would just be a drop of the new source files. So in project tree, you add a pdfinc-src
  163. directory, and include {pdfinc.i} in your programs. How to add this dir to your propath ?
  164. Quite simple, just add a <code>propath</code> directive in you PCTCompile task (line 9) :</p>
  165. <pre class="source">
  166. &lt;propath&gt;
  167. &lt;pathelement location="pdfinc-src"/&gt;
  168. &lt;/propath&gt;
  169. </pre>
  170. <p>Compile as usual, using <code>ant build</code>, then execute build/test3.r : you should
  171. get</p>
  172. <pre class="output">
  173. Message from pdfinc.i
  174. Message from test3.p
  175. </pre>
  176. <h2>Step 4 : dealing with ADM2 and customs [Download <a href="sample4.zip">sample</a>]</h2>
  177. <p>
  178. When working with ADM2, it's really a good idea to have your own copy in your project, so that
  179. you can upgrade your Progress version without upgrading your ADM2 version. Here is how I proceed :
  180. in my project tree, I create two subdirectories, called <code>ade</code> and <code>ade-custom</code>.
  181. The first one contains everything I import directly from Progress directory, and is only modified when I
  182. upgrade ADM2 version, the second one contains my own customizations.
  183. </p>
  184. <p>Here is the target to compile the standard ADM2 :</p>
  185. <pre class="source">
  186. &lt;target name="build-ade" description="Standard ADM2"&gt;
  187. &lt;mkdir dir="build-ade" /&gt;
  188. &lt;PCTCreateBase dbName="db" destDir="db" schemaFile="ade/temp-db.df" dlcHome="${env.DLC}" /&gt;
  189. &lt;PCTCompile destDir="build-ade" dlcHome="${env.DLC}"&gt;
  190. &lt;fileset dir="ade/src"&gt;
  191. &lt;include name="adm2/**/*.p" /&gt;
  192. &lt;include name="adm2/**/*.w" /&gt;
  193. &lt;exclude name="adm2/template/**" /&gt;
  194. &lt;/fileset&gt;
  195. &lt;PCTConnection dbName="temp-db" dbDir="base/temp-db" singleUser="${singleUser}" /&gt;
  196. &lt;propath&gt;
  197. &lt;pathelement location="ade" /&gt;
  198. &lt;pathelement location="ade/src" /&gt;
  199. &lt;/propath&gt;
  200. &lt;/PCTCompile&gt;
  201. &lt;copy toDir="ade"&gt;
  202. &lt;fileset dir="ade/src"&gt;
  203. &lt;include name="adm2/image/**" /&gt;
  204. &lt;include name="adm2/template/**" /&gt;
  205. &lt;/fileset&gt;
  206. &lt;/copy&gt;
  207. &lt;/target&gt;
  208. </pre>
  209. <p>And the target to compile your customized version of ADM2 :</p>
  210. <pre class="source">
  211. &lt;target name="build-ade-custom" depends="build-ade" description="Customized ADM2"&gt;
  212. &lt;mkdir dir="build-ade-custom" /&gt;
  213. &lt;PCTCompile destDir="build-ade-custom" dlcHome="${env.DLC}"&gt;
  214. &lt;fileset dir="ade/src"&gt;
  215. &lt;include name="adm2/*.p" /&gt;
  216. &lt;include name="adm2/*.w" /&gt;
  217. &lt;/fileset&gt;
  218. &lt;fileset dir="ade-custom/src"&gt;
  219. &lt;include name="adm2/**/*.p" /&gt;
  220. &lt;include name="adm2/**/*.w" /&gt;
  221. &lt;exclude name="adm2/template/**" /&gt;
  222. &lt;/fileset&gt;
  223. &lt;PCTConnection dbName="temp-db" dbDir="base/temp-db" singleUser="${singleUser}" /&gt;
  224. &lt;propath&gt;
  225. &lt;pathelement location="ade-custom" /&gt;
  226. &lt;pathelement location="ade" /&gt;
  227. &lt;pathelement location="ade/src" /&gt;
  228. &lt;/propath&gt;
  229. &lt;/PCTCompile&gt;
  230. &lt;copy toDir="build-ade-custom"&gt;
  231. &lt;fileset dir="ade-custom/src"&gt;
  232. &lt;include name="adm2/image/**" /&gt;
  233. &lt;include name="adm2/template/**" /&gt;
  234. &lt;/fileset&gt;
  235. &lt;/copy&gt;
  236. &lt;/target&gt;
  237. </pre>
  238. <h2>Step 5 : let's proxygen... [Download <a href="sample5.zip">sample</a>]</h2>
  239. <p>We'll here explain how to use the <em>Java</em> proxygen. Using .Net and DLL proxygen should work identically.</p>
  240. <p>In the provided example, we're using a Progress 10.0A XPXG file, but 9.1 PXG files are OK too.</p>
  241. <p><em>Warning</em> : 10.1 XPXG files don't work for now ; 10.1 doesn't accept relative paths anymore, which is
  242. really annoying...</p>
  243. <p>Declaring a proxygen task is simple :</p>
  244. <pre class="source">
  245. &lt;PCTProxygen workingDirectory="src" srcFile="src/MyApp.xpxg" dlcHome="${env.DLC}" /&gt;
  246. </pre>
  247. <p>Which gives the following result :</p>
  248. <pre class="output">
  249. pxg:
  250. [PCTProxygen] Batch ProxyGen, Version Progress 10.0A
  251. [PCTProxygen] Generating Proxies...
  252. [PCTProxygen] Proxy Generation Succeeded.
  253. [PCTProxygen] For details see the log file ..\build-pxg\MyProduct.log
  254. </pre>
  255. <h2>Step 6 : using schema holders [Download <a href="sample6.zip">sample</a>]</h2>
  256. <p>We'll explain here how to compile your application against both a Progress database and an Oracle schema holder.</p>
  257. <p>In our example, we have an application made of a few programs, and a dump file. What we expect is to get a set
  258. of .r files compiled against the generated Progress database, as well as a set of .r files compiled against the
  259. corresponding Oracle schema holder, without any human intervention and without any real Oracle database.</p>
  260. <p>First step is to generate a .df file, to be loaded in a database. This is done through the use of prodict/ora/_gendsql.p.
  261. A program is available in PCT, called pct/protoora.p
  262. </div>
  263. </div>
  264. @ANALYTICS@</body>
  265. </html>