Wiki source code of Embedding WOFrameworks

Version 61.3 by Pascal Robert on 2023/11/13 11:56

Show last authors
1 == WOLips 3.4.x, and later, Side-note ==
2
3 {{warning}}
4 If you are updating an older project, make sure you get the latest build.xml file. Create a new project, then copy/paste the contents of the fresh build.xml file into your project's build.xml file.
5 {{/warning}}
6
7 For WOLips 3.4.x and later, while embedding is built-in, it's not enabled by default. To enable embedding:
8
9 * make sure you are in the WO Explorer view
10 * right-click your project folder, select Properties, select WOLips Deployment
11 * check the related, if not all, options under Embed Frameworks
12
13 To create a versioned/dated bundle of your app and resources:
14
15 * make sure you are in the Navigator view
16 * edit build.properties, and add:
17 * {{code language="none"}}build.app.name=MyApp-2009-07-14{{/code}}
18
19 There is a known bug with WO 5.4.x (for those not using the latest Wonder release) regarding proper linking to your web server resources within the embedded frameworks. The WOFrameworksBaseURL isn't set correctly. To do this you'll need to programmatically set this within your Application constructor:
20
21 * {{code language="none"}}setFrameworksBaseURL("/WebObjects/MyApp-2009-07-14.woa/Frameworks");{{/code}}
22
23 Another way to fix this bug is to set the following launch parameter:
24
25 -DWOFrameworksBaseURL=/WebObjects/MyApp-2009-07-14.woa/Frameworks
26
27 Within build.properties (I may need to be corrected on this), the best approach to linking your embedded framework's web server resources automatically is to include (however the bug noted above breaks this):
28
29 * {{code language="none"}}frameworksBaseURL=/WebObjects/${build.app.name}.woa/Frameworks{{/code}}
30
31 There was an old bug in the build.xml file but fixed if you have WOLips more recent than october 2010:
32 [[http:~~/~~/issues.objectstyle.org/jira/browse/WOL-979>>url:http://issues.objectstyle.org/jira/browse/WOL-979||shape="rect"]]
33
34 == Introduction ==
35
36 Below is outlined "simple embedding" concepts, however (% style="text-decoration: underline;" %)full embedding(%%) **and** (% style="text-decoration: underline;" %)split-installing(%%) are really recommended. This provides fully versioned self-contained bundles of both the application deployment bundle and the webserver deployment bundle. Read the docs on that technique for more **advantages**. This technique fully explained along with a ready-to-use ant build script is available at:
37
38 [[doc:WOL.Home.Deprecated info.Alternative Ant Build Script for Fully Embedded and Split Install Bundles.WebHome]]
39
40 == Simple Approach ==
41
42 This simple approach can be used to embed frameworks already **installed** on your development machine right into the app.woa bundle.
43
44 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
45
46 {{code title="Default build.xml snippet"}}
47
48 <frameworks root="${wo.wolocalroot}" embed="false">
49 <patternset>
50 <includesfile name="woproject/ant.frameworks.wo.wolocalroot" />
51 </patternset>
52 </frameworks>
53 <frameworks root="${user.home}" embed="false">
54 <patternset>
55 <includesfile name="woproject/ant.frameworks.user.home" />
56 </patternset>
57 </frameworks>
58 <frameworks root="${wo.wosystemroot}" embed="false">
59 <patternset>
60 <includesfile name="woproject/ant.frameworks.wo.wosystemroot" />
61 </patternset>
62 </frameworks>
63
64 {{/code}}
65
66 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:
67
68 {{code title="Changes to build.xml to embed frameworks installed in /Library/Frameworks dir"}}
69
70 <frameworks root="${wo.wolocalroot}" embed="true">
71 <patternset>
72 <includesfile name="woproject/ant.frameworks.wo.wolocalroot" />
73 </patternset>
74 </frameworks>
75 <frameworks root="${user.home}" embed="false">
76 <patternset>
77 <includesfile name="woproject/ant.frameworks.user.home" />
78 </patternset>
79 </frameworks>
80 <frameworks root="${wo.wosystemroot}" embed="false">
81 <patternset>
82 <includesfile name="woproject/ant.frameworks.wo.wosystemroot" />
83 </patternset>
84 </frameworks>
85
86 {{/code}}
87
88 The various dirs referenced in the build.xml from which you can select the embed option are:
89
90 |=(((
91 dir name
92 )))|=(((
93 Description
94 )))
95 |(((
96 wo.wolocalroot
97 )))|(((
98 /Library/Frameworks/
99 Embedding these is most useful especially if you the codebase for these, like WOnder frameworks or your own, is frequently updated
100 )))
101 |(((
102 user.home
103 )))|(((
104 ~~/Library/Frameworks/
105 )))
106 |(((
107 wo.systemroot
108 )))|(((
109 /System/Library/Frameworks/
110 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.
111 )))
112
113 {{note bgColor="#FFFFCE" title="Remember to..."}}
114 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.
115 {{/note}}
116
117 === Pre-installing Workspace Frameworks Before Embedded Build ===
118
119 You could write a task to install the frameworks directly from the workspace, for example:
120
121 {{code}}
122
123 <!-- Install my own dependent frameworks in final local install location before embedding -->
124 <target name="installMyFrameworks">
125 <ant dir="../WKDemography" target="install" inheritall="false" />
126 <ant dir="../WKEmailData" target="install" inheritall="false" />
127 <ant dir="../WKEOFExtensions" target="install" inheritall="false" />
128 <ant dir="../WKFoundation" target="install" inheritall="false" />
129 <ant dir="../WKPrototypes" target="install" inheritall="false" />
130 <ant dir="../WKRemoteClient" target="install" inheritall="false" />
131 <ant dir="../WKReports" target="install" inheritall="false" />
132 <ant dir="../WKWebObjects" target="install" inheritall="false" />
133 </target>
134
135 {{/code}}
136
137 ... 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:
138
139 {{code}}
140
141 <target name="build.woapp" depends="installMyFrameworks">
142
143 {{/code}}
144
145 == Advanced Approach ==
146
147 **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)
148
149 ----
150
151 See also [[FrameworkSet>>doc:WOL.WOProject-FrameworkSet]] documentation.
152
153 Example for embedding WOFrameworks.
154
155 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.
156
157 Assume two projects: One named Foo( a framework) and the other named Uli (an application). The parent folder has another folder named packandgo.
158
159 [[image:attach:Folders.png]]
160
161 The [[attach:packageandgobuild.xml]]from the application. Two minor changes to the default build.xml:
162 1 application target
163
164 {{code}}
165
166 <!-- package and go example-->
167 <frameworks root="../packageandgo/frameworks" embed="true">
168 <include name="*.framework"/>
169 </frameworks>
170
171 {{/code}}
172
173 2 compile target
174
175 {{code}}
176
177 <!-- package and go example-->
178 <fileset dir="../packageandgo/frameworks">
179 <include name = "**/*.jar"/>
180 </fileset>
181
182 {{/code}}
183
184 The [[attach:build.xml]]from the packageandgo folder:
185
186 Just invoke ant in the packageandgo folder and grap the App from the applications folder within the packageandgo folder.
187
188 [[image:attach:FoldersAfterBuild.png]]