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