Wiki source code of Embedding WOFrameworks

Version 29.1 by Kieran Kelleher on 2008/05/13 12:16

Hide last authors
Kieran Kelleher 27.1 1 == Simple Approach ==
2
3 This simple approach can be used to embed frameworks already **installed** on your development machine right into the app.woa bundle.
4
5 Open your build.xml project file and change embed="false" to embed="true" for the appropriate directory paths in this section of the build.xml file inside the woapplication task
6
7 {{code title="Default build.xml snippet"}}
8
Kieran Kelleher 29.1 9 <frameworks root="${wo.wolocalroot}" embed="false">
10 <patternset>
11 <includesfile name="woproject/ant.frameworks.wo.wolocalroot" />
12 </patternset>
13 </frameworks>
14 <frameworks root="${user.home}" embed="false">
15 <patternset>
16 <includesfile name="woproject/ant.frameworks.user.home" />
17 </patternset>
18 </frameworks>
19 <frameworks root="${wo.wosystemroot}" embed="false">
20 <patternset>
21 <includesfile name="woproject/ant.frameworks.wo.wosystemroot" />
22 </patternset>
23 </frameworks>
Kieran Kelleher 27.1 24
25 {{/code}}
26
27 The most common choice is to embed locally installed WOnder and 3rd party frameworks that your app references by setting embed="true" on the wolocalroot frameworks dir as shown below:
28
29 {{code title="Changes to build.xml to embed frameworks installed in /Library/Frameworks dir"}}
30
Kieran Kelleher 29.1 31 <frameworks root="${wo.wolocalroot}" embed="true">
32 <patternset>
33 <includesfile name="woproject/ant.frameworks.wo.wolocalroot" />
34 </patternset>
35 </frameworks>
36 <frameworks root="${user.home}" embed="false">
37 <patternset>
38 <includesfile name="woproject/ant.frameworks.user.home" />
39 </patternset>
40 </frameworks>
41 <frameworks root="${wo.wosystemroot}" embed="false">
42 <patternset>
43 <includesfile name="woproject/ant.frameworks.wo.wosystemroot" />
44 </patternset>
45 </frameworks>
Kieran Kelleher 27.1 46
47 {{/code}}
48
49 The various dirs referenced in the build.xml from which you can select the embed option are:
50
Kieran Kelleher 29.1 51 |= dir name |= Description
52 | wo.wolocalroot | /Library/Frameworks/
53 \\Embedding these is most useful especially if you the codebase for these, like WOnder frameworks or your own, is frequently updated
54 | user.home | /Library/Frameworks/
55 | wo.systemroot | /System/Library/Frameworks/
56 \\This is where Apple's WebObjects frameworks are installed and if your WebObjects version is consistent between your deployment and development platforms, then embedding these is not of much benefit.
Kieran Kelleher 27.1 57
Kieran Kelleher 29.1 58 {{note title="Remember to..." bgColor="#FFFFCE"}}
Kieran Kelleher 27.1 59
Kieran Kelleher 29.1 60 If you are working with framework source in your Eclipse workspace (which you should be\!), then it is critical that you build and install all frameworks before building the deployment bundles to ensure that the embedded frameworks are the same as the source you have been developing and testing with. See next subsection for one approcah to automating this.
Kieran Kelleher 27.1 61
Kieran Kelleher 29.1 62 {{/note}}
Kieran Kelleher 27.1 63
Kieran Kelleher 29.1 64 === Pre-installing Workspace Frameworks Before Embedded Build ===
65
66 You could write a task to install the frameworks directly from the workspace, for example:
67
68 {{code}}
69
70 <!-- Install my own dependent frameworks in final local install location before embedding -->
71 <target name="installMyFrameworks">
72 <ant dir="../WKDemography" target="install" inheritall="false" />
73 <ant dir="../WKEmailData" target="install" inheritall="false" />
74 <ant dir="../WKEOFExtensions" target="install" inheritall="false" />
75 <ant dir="../WKFoundation" target="install" inheritall="false" />
76 <ant dir="../WKPrototypes" target="install" inheritall="false" />
77 <ant dir="../WKRemoteClient" target="install" inheritall="false" />
78 <ant dir="../WKReports" target="install" inheritall="false" />
79 <ant dir="../WKWebObjects" target="install" inheritall="false" />
80 </target>
81
82 {{/code}}
83
84 ... and then you could put a depends attribute on the build target to ensure the frameworks are installed before the embedded build task is executed:
85
86 {{code}}
87
88 <target name="build.woapp" depends="installMyFrameworks">
89
90 {{/code}}
91
Kieran Kelleher 27.1 92 == Advanced Approach ==
93
David Holt 19.1 94 **Caveat:** This example assumes that each framework you want to embed has an ant "build.xml" file with a "compileAndBuild" target. For frameworks you create yourself using WOLips, you will have this, but for a case where you are checking out individual Wonder framework projects from CVS, then you probably will not have such a build.xml file, so this approach is not quick to implement in that case unless you want to spend a lot of time working on ant build files to resolve the missing build.xml having a compileAndBuild target for those external projects. (KK 3/30/2007)
95
96 ----
97
98 See also [[FrameworkSet>>WOProject-FrameworkSet]] documentation.
99
100 Example for embedding WOFrameworks.
101
102 It's often a good idea to create your own targets in the build.xml or even create your own build.xml (with a different name). This leaves the door open for an update of the default build.xml.
103
104 Assume two projects: One named Foo( a framework) and the other named Uli (an application). The parent folder has another folder named packandgo.
105
106 [[image:Folders.png]]
107
108 The [[^packageandgobuild.xml]] from the application. Two minor changes to the default build.xml:
109 1 application target
110
111 {{code}}
112
113 <!-- package and go example-->
114 <frameworks root="../packageandgo/frameworks" embed="true">
115 <include name="*.framework"/>
116 </frameworks>
117
118 {{/code}}
119
120 2 compile target
121
122 {{code}}
123
124 <!-- package and go example-->
125 <fileset dir="../packageandgo/frameworks">
126 <include name = "**/*.jar"/>
127 </fileset>
128
129 {{/code}}
130
131 The [[^build.xml]] from the packageandgo folder:
132
133 Just invoke ant in the packageandgo folder and grap the App from the applications folder within the packageandgo folder.
134
135 [[image:FoldersAfterBuild.png]]