9571
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic3' }"
|
|
13 |
|
|
14 |
Object subclass:#PackageId
|
|
15 |
instanceVariableNames:'packageIdString'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'System-Support-Projects'
|
|
19 |
!
|
|
20 |
|
|
21 |
!PackageId class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
|
37 |
documentation
|
|
38 |
"
|
|
39 |
Represents packageID's.
|
|
40 |
Knows the relationship between modules and directories in the package-organization.
|
|
41 |
"
|
|
42 |
! !
|
|
43 |
|
|
44 |
!PackageId class methodsFor:'instance creation'!
|
|
45 |
|
|
46 |
from: aStringOrSymbol
|
|
47 |
^ self new packageIdString:aStringOrSymbol
|
|
48 |
|
9840
|
49 |
"
|
|
50 |
(self from:'stx:libbasic') module
|
|
51 |
(self from:'stx:libbasic') directory
|
|
52 |
"
|
|
53 |
|
9571
|
54 |
"Created: / 18-08-2006 / 12:11:58 / cg"
|
9840
|
55 |
"Modified: / 12-09-2006 / 15:27:42 / cg"
|
|
56 |
!
|
|
57 |
|
|
58 |
module:moduleString directory:directoryString
|
|
59 |
^ self new module:moduleString directory:directoryString
|
|
60 |
|
|
61 |
"
|
|
62 |
(self module:'stx' directory:'libbasic') module
|
|
63 |
(self module:'stx' directory:'libbasic') directory
|
|
64 |
"
|
|
65 |
|
|
66 |
"Created: / 12-09-2006 / 15:26:24 / cg"
|
9571
|
67 |
! !
|
|
68 |
|
|
69 |
!PackageId methodsFor:'accessing'!
|
|
70 |
|
9840
|
71 |
module:moduleString directory:directoryString
|
|
72 |
packageIdString := moduleString,':',directoryString.
|
|
73 |
|
|
74 |
"Created: / 12-09-2006 / 15:26:48 / cg"
|
|
75 |
!
|
|
76 |
|
9571
|
77 |
packageIdString:something
|
|
78 |
packageIdString := something.
|
|
79 |
|
|
80 |
"Created: / 18-08-2006 / 12:14:45 / cg"
|
|
81 |
!
|
|
82 |
|
|
83 |
string
|
|
84 |
^ packageIdString
|
|
85 |
|
|
86 |
"Created: / 18-08-2006 / 12:20:54 / cg"
|
|
87 |
! !
|
|
88 |
|
|
89 |
!PackageId methodsFor:'comparing'!
|
|
90 |
|
|
91 |
= aPackageId
|
9841
|
92 |
"compares equal to a corresponding string"
|
|
93 |
|
9571
|
94 |
^ packageIdString = aPackageId asPackageId string
|
|
95 |
|
|
96 |
"
|
9841
|
97 |
'stx:libbasic' asPackageId = 'stx:libbasic'
|
9571
|
98 |
'stx:libbasic' asPackageId = 'stx:libbasic' asSymbol asPackageId
|
|
99 |
'stx:libbasic' asPackageId = 'stx:libbasic' asPackageId
|
|
100 |
'stx:libbasic2' asPackageId = 'stx:libbasic3' asPackageId
|
|
101 |
"
|
|
102 |
|
|
103 |
"Created: / 18-08-2006 / 12:20:47 / cg"
|
9841
|
104 |
"Modified: / 12-09-2006 / 15:33:00 / cg"
|
9571
|
105 |
!
|
|
106 |
|
|
107 |
hash
|
|
108 |
^ packageIdString hash
|
|
109 |
|
|
110 |
"Created: / 18-08-2006 / 12:21:19 / cg"
|
|
111 |
! !
|
|
112 |
|
|
113 |
!PackageId methodsFor:'converting'!
|
|
114 |
|
|
115 |
asPackageId
|
|
116 |
^ self
|
|
117 |
|
|
118 |
"Created: / 18-08-2006 / 12:22:10 / cg"
|
|
119 |
!
|
|
120 |
|
|
121 |
asString
|
|
122 |
^ packageIdString
|
|
123 |
|
|
124 |
"Created: / 18-08-2006 / 12:12:22 / cg"
|
|
125 |
!
|
|
126 |
|
|
127 |
asSymbol
|
|
128 |
^ packageIdString asSymbol
|
|
129 |
|
|
130 |
"Created: / 18-08-2006 / 12:12:29 / cg"
|
|
131 |
! !
|
|
132 |
|
10075
|
133 |
!PackageId methodsFor:'printing'!
|
|
134 |
|
|
135 |
printOn:aStream
|
|
136 |
aStream
|
|
137 |
nextPutAll:'PackageId('; nextPutAll:packageIdString; nextPutAll:')'
|
|
138 |
|
|
139 |
"Created: / 12-10-2006 / 10:30:10 / cg"
|
|
140 |
! !
|
|
141 |
|
9577
|
142 |
!PackageId methodsFor:'queries'!
|
|
143 |
|
|
144 |
directory
|
|
145 |
"return the directory component. Thats the rest after the colon.
|
|
146 |
The module is typically used to define the project-path or project-id within its
|
|
147 |
sourcecode repository (which is selected via the module)."
|
|
148 |
|
|
149 |
^ packageIdString copyFrom:(packageIdString indexOf:$:)+1
|
|
150 |
|
|
151 |
"
|
|
152 |
(PackageId from:'stx:libbasic') module
|
|
153 |
(PackageId from:'stx:libbasic') directory
|
|
154 |
(PackageId from:'stx:goodies/xml/stx') module
|
|
155 |
(PackageId from:'stx:goodies/xml/stx') directory
|
|
156 |
"
|
|
157 |
|
|
158 |
"Created: / 18-08-2006 / 12:15:33 / cg"
|
|
159 |
!
|
|
160 |
|
|
161 |
libraryName
|
|
162 |
"return the name of the library, when compiled to a binary (i.e. dll/so).
|
|
163 |
To avoid conflicts with the projectDefinition class
|
|
164 |
(which is named <module>_<directory_components>), we prefix the library name
|
|
165 |
with 'lib'. This has the added advantage, that under unix, linking can be done with
|
|
166 |
'-l'shortName."
|
|
167 |
|
|
168 |
^ 'lib' , (packageIdString copy asString replaceAny:':/' with:$_)
|
|
169 |
|
|
170 |
"
|
|
171 |
(PackageId from:'stx:libbasic') libraryName
|
|
172 |
(PackageId from:'stx:goodies/xml/stx') libraryName
|
|
173 |
(PackageId from:'bosch:dapasx') libraryName
|
|
174 |
(PackageId from:'exept:expecco') libraryName
|
|
175 |
"
|
|
176 |
|
|
177 |
"Created: / 18-08-2006 / 12:35:04 / cg"
|
|
178 |
!
|
|
179 |
|
|
180 |
module
|
|
181 |
"return the module component. Thats the first component up to the colon.
|
|
182 |
The module is typically used to select a corresponding sourcecode repository."
|
|
183 |
|
|
184 |
^ packageIdString upTo:$:
|
|
185 |
|
|
186 |
"
|
|
187 |
(PackageId from:'stx:libbasic') module
|
|
188 |
(PackageId from:'stx:libbasic') directory
|
|
189 |
"
|
|
190 |
|
|
191 |
"Created: / 18-08-2006 / 12:13:53 / cg"
|
9668
|
192 |
!
|
|
193 |
|
|
194 |
parentPackage
|
|
195 |
|dir idx|
|
|
196 |
|
|
197 |
dir := self directory.
|
|
198 |
idx := dir lastIndexOf:$/.
|
|
199 |
idx == 0 ifTrue:[
|
|
200 |
^ nil
|
|
201 |
].
|
|
202 |
^ self class from:(self module , ':' , (dir copyTo:idx-1))
|
|
203 |
|
|
204 |
"
|
|
205 |
(PackageId from:'stx:libbasic') parentPackage
|
|
206 |
(PackageId from:'stx:goodies/xml/stx') parentPackage
|
|
207 |
(PackageId from:'stx:goodies/xml/stx') parentPackage parentPackage
|
|
208 |
"
|
|
209 |
|
|
210 |
"Created: / 23-08-2006 / 15:10:13 / cg"
|
9577
|
211 |
! !
|
|
212 |
|
9571
|
213 |
!PackageId class methodsFor:'documentation'!
|
|
214 |
|
|
215 |
version
|
10075
|
216 |
^ '$Header: /cvs/stx/stx/libbasic/PackageId.st,v 1.6 2006-10-12 08:30:20 cg Exp $'
|
9571
|
217 |
! !
|