877
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
3 |
|
|
4 |
New code and modification done at SWING Research Group [1]:
|
|
5 |
|
877
|
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
7 |
SWING Research Group, Czech Technical University in Prague
|
|
8 |
|
|
9 |
Parts of the code written by Claus Gittinger are under following
|
|
10 |
license:
|
|
11 |
|
|
12 |
This software is furnished under a license and may be used
|
|
13 |
only in accordance with the terms of that license and with the
|
|
14 |
inclusion of the above copyright notice. This software may not
|
|
15 |
be provided or otherwise made available to, or used by, any
|
|
16 |
other person. No title to or ownership of the software is
|
|
17 |
hereby transferred.
|
|
18 |
|
|
19 |
[1] Code written at SWING Research Group contain a signature
|
1152
|
20 |
of one of the above copright owners. For exact set of such code
|
|
21 |
see the differences between this version and version stx:lib
|
|
22 |
as of 1.9.2010
|
877
|
23 |
"
|
869
|
24 |
"{ Package: 'stx:libjava' }"
|
|
25 |
|
|
26 |
TestResource subclass:#JavaAntProjectResource
|
|
27 |
instanceVariableNames:''
|
|
28 |
classVariableNames:''
|
|
29 |
poolDictionaries:''
|
|
30 |
category:'Languages-Java-Tests'
|
|
31 |
!
|
|
32 |
|
|
33 |
JavaAntProjectResource class instanceVariableNames:'built'
|
|
34 |
|
|
35 |
"
|
|
36 |
The following class instance variables are inherited by this class:
|
|
37 |
|
|
38 |
TestResource - current
|
|
39 |
TestAsserter -
|
|
40 |
Object -
|
|
41 |
"
|
|
42 |
!
|
|
43 |
|
877
|
44 |
!JavaAntProjectResource class methodsFor:'documentation'!
|
|
45 |
|
|
46 |
copyright
|
|
47 |
"
|
|
48 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
49 |
|
|
50 |
New code and modification done at SWING Research Group [1]:
|
|
51 |
|
877
|
52 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
53 |
SWING Research Group, Czech Technical University in Prague
|
|
54 |
|
|
55 |
Parts of the code written by Claus Gittinger are under following
|
|
56 |
license:
|
|
57 |
|
|
58 |
This software is furnished under a license and may be used
|
|
59 |
only in accordance with the terms of that license and with the
|
|
60 |
inclusion of the above copyright notice. This software may not
|
|
61 |
be provided or otherwise made available to, or used by, any
|
|
62 |
other person. No title to or ownership of the software is
|
|
63 |
hereby transferred.
|
|
64 |
|
|
65 |
[1] Code written at SWING Research Group contain a signature
|
1152
|
66 |
of one of the above copright owners. For exact set of such code
|
|
67 |
see the differences between this version and version stx:lib
|
|
68 |
as of 1.9.2010
|
877
|
69 |
|
|
70 |
"
|
|
71 |
! !
|
869
|
72 |
|
|
73 |
!JavaAntProjectResource class methodsFor:'accessing'!
|
|
74 |
|
|
75 |
antBuildDotXml
|
|
76 |
|
|
77 |
^self antProjectDir / 'build.xml'
|
|
78 |
|
|
79 |
"Created: / 18-07-2011 / 15:21:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
80 |
!
|
|
81 |
|
|
82 |
built
|
|
83 |
^ built == true
|
|
84 |
|
|
85 |
"Modified: / 18-07-2011 / 14:48:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
86 |
!
|
|
87 |
|
|
88 |
built:aBoolean
|
|
89 |
built := aBoolean.
|
|
90 |
!
|
|
91 |
|
|
92 |
classpath
|
|
93 |
|
|
94 |
^ Array with: (self antProjectDir / 'bin')
|
|
95 |
|
|
96 |
"Created: / 18-07-2011 / 15:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
970
|
97 |
!
|
|
98 |
|
|
99 |
properties
|
|
100 |
|
|
101 |
^#()
|
|
102 |
|
|
103 |
"Created: / 02-09-2011 / 09:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
869
|
104 |
! !
|
|
105 |
|
|
106 |
!JavaAntProjectResource class methodsFor:'accessing - ant project'!
|
|
107 |
|
|
108 |
antProjectDir
|
|
109 |
"raise an error: must be redefined in concrete subclass(es)"
|
|
110 |
|
|
111 |
^ self subclassResponsibility
|
|
112 |
! !
|
|
113 |
|
|
114 |
!JavaAntProjectResource class methodsFor:'running'!
|
|
115 |
|
|
116 |
build
|
970
|
117 |
|
869
|
118 |
"
|
970
|
119 |
JavaTestsResource built: true.
|
|
120 |
JavaTestsResource built: false.
|
|
121 |
JavaTestsResource build.
|
869
|
122 |
"
|
970
|
123 |
|
|
124 |
| properties cmd |
|
869
|
125 |
|
|
126 |
built == true
|
|
127 |
ifFalse:
|
|
128 |
[ "Check for ant"
|
|
129 |
self assert:(OperatingSystem canExecuteCommand:'ant')
|
|
130 |
description:'Cannot execute ant'.
|
|
131 |
self assert:self antBuildDotXml exists
|
|
132 |
description:'No build.xml in ' , self antProjectDir asString.
|
|
133 |
"Launch ant"
|
970
|
134 |
properties := String streamContents:[:s|
|
|
135 |
self properties pairsDo:[:name :value|
|
|
136 |
s nextPutAll:' "-D'; nextPutAll: name; nextPut: $=; nextPutAll: value; nextPut: $".
|
|
137 |
].
|
|
138 |
].
|
|
139 |
|
|
140 |
cmd := 'ant -f build.xml' , properties.
|
|
141 |
|
869
|
142 |
Transcript
|
|
143 |
show:'Running ant in ';
|
970
|
144 |
showCR:self antProjectDir asString;
|
|
145 |
showCR: cmd.
|
869
|
146 |
OperatingSystem
|
970
|
147 |
executeCommand:cmd
|
869
|
148 |
inputFrom:nil
|
|
149 |
outputTo:Stdout
|
|
150 |
errorTo:Stderr
|
|
151 |
inDirectory:self antProjectDir
|
|
152 |
onError:
|
|
153 |
[:status |
|
|
154 |
Transcript showCR:'ANT FAILED!!!!!!'.
|
|
155 |
self error:'ant failed'.
|
|
156 |
^ self ].
|
|
157 |
Transcript showCR:'Ant finished'.
|
|
158 |
built := true. ].
|
|
159 |
^ built.
|
|
160 |
|
|
161 |
"Modified: / 04-06-2011 / 18:03:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
970
|
162 |
"Modified (comment): / 02-09-2011 / 09:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
869
|
163 |
! !
|
|
164 |
|
|
165 |
!JavaAntProjectResource methodsFor:'running'!
|
|
166 |
|
|
167 |
setUp
|
|
168 |
self class build.
|
|
169 |
self class classpath do:[:each | Java addToClassPath:each ].
|
|
170 |
|
|
171 |
"
|
|
172 |
JavaTestsResource basicNew setUp
|
|
173 |
Java classPath
|
|
174 |
"
|
|
175 |
|
|
176 |
"Modified: / 07-05-2011 / 18:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
177 |
"Created: / 18-07-2011 / 15:04:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
178 |
! !
|
|
179 |
|
|
180 |
!JavaAntProjectResource methodsFor:'testing'!
|
|
181 |
|
|
182 |
isAvailable
|
|
183 |
|
|
184 |
^self class antProjectDir exists and:
|
|
185 |
[self class antBuildDotXml exists]
|
|
186 |
|
|
187 |
"Created: / 18-07-2011 / 15:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
188 |
! !
|
|
189 |
|
|
190 |
!JavaAntProjectResource class methodsFor:'documentation'!
|
|
191 |
|
|
192 |
version_SVN
|
|
193 |
^ '$Id$'
|
|
194 |
! !
|