PackageId.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 26 Apr 2010 19:26:38 +0100
branchjv
changeset 17761 b0e5971141bc
parent 17735 6a5bc05f696a
child 17767 a4a32df3aa5e
permissions -rw-r--r--
Added Lookup and BuiltinLookup classes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
10230
28c9ab0c0d43 PackageId moved
Claus Gittinger <cg@exept.de>
parents: 10211
diff changeset
    12
"{ Package: 'stx:libbasic' }"
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Object subclass:#PackageId
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'packageIdString'
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Support-Projects'
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!PackageId class methodsFor:'documentation'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 2006 by eXept Software AG
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    Represents packageID's.
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    Knows the relationship between modules and directories in the package-organization.
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
! !
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
!PackageId class methodsFor:'instance creation'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
from: aStringOrSymbol
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    ^ self new packageIdString:aStringOrSymbol
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
9840
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    49
    "
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    50
     (self from:'stx:libbasic') module      
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    51
     (self from:'stx:libbasic') directory      
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    52
    "
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    53
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    "Created: / 18-08-2006 / 12:11:58 / cg"
9840
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    55
    "Modified: / 12-09-2006 / 15:27:42 / cg"
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    56
!
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    57
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    58
module:moduleString directory:directoryString
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    59
    ^ self new module:moduleString directory:directoryString
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    60
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    61
    "
10190
806d4a4369d7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10075
diff changeset
    62
     (PackageId module:'stx' directory:'libbasic') module      
806d4a4369d7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10075
diff changeset
    63
     (PackageId module:'stx' directory:'libbasic') directory      
9840
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    64
    "
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    65
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    66
    "Created: / 12-09-2006 / 15:26:24 / cg"
10190
806d4a4369d7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10075
diff changeset
    67
    "Modified: / 18-11-2006 / 17:09:12 / cg"
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
! !
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    70
!PackageId class methodsFor:'defaults'!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    71
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    72
noProjectID
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    73
    "return the symbol used to tag classes and methods which are loose.
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    74
     This means: not yet assigned to a particular project."
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    75
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    76
    ^ #'__NoProject__'.
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    77
! !
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    78
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
!PackageId methodsFor:'accessing'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
9840
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    81
module:moduleString directory:directoryString
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    82
    packageIdString := moduleString,':',directoryString.
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    83
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    84
    "Created: / 12-09-2006 / 15:26:48 / cg"
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    85
!
ed3d263c9109 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9668
diff changeset
    86
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
packageIdString:something
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    packageIdString := something.
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    "Created: / 18-08-2006 / 12:14:45 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
string
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    ^ packageIdString
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    "Created: / 18-08-2006 / 12:20:54 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
! !
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!PackageId methodsFor:'comparing'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
= aPackageId
9841
29d622566819 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9840
diff changeset
   102
    "compares equal to a corresponding string"
29d622566819 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9840
diff changeset
   103
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    ^ packageIdString = aPackageId asPackageId string
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    "
9841
29d622566819 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9840
diff changeset
   107
     'stx:libbasic' asPackageId = 'stx:libbasic' 
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
     'stx:libbasic' asPackageId = 'stx:libbasic' asSymbol asPackageId  
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
     'stx:libbasic' asPackageId = 'stx:libbasic' asPackageId    
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
     'stx:libbasic2' asPackageId = 'stx:libbasic3' asPackageId  
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    "
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    "Created: / 18-08-2006 / 12:20:47 / cg"
9841
29d622566819 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9840
diff changeset
   114
    "Modified: / 12-09-2006 / 15:33:00 / cg"
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
hash
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    ^ packageIdString hash
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    "Created: / 18-08-2006 / 12:21:19 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
! !
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
!PackageId methodsFor:'converting'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
asPackageId
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    ^ self
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    "Created: / 18-08-2006 / 12:22:10 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
asString
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   132
    ^ packageIdString asString
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "Created: / 18-08-2006 / 12:12:22 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
asSymbol
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    ^ packageIdString asSymbol
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    "Created: / 18-08-2006 / 12:12:29 / cg"
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
! !
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
10075
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   143
!PackageId methodsFor:'printing'!
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   144
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   145
printOn:aStream
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   146
    aStream 
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   147
        nextPutAll:'PackageId('; nextPutAll:packageIdString; nextPutAll:')'
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   148
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   149
    "Created: / 12-10-2006 / 10:30:10 / cg"
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   150
! !
01633f527642 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9841
diff changeset
   151
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   152
!PackageId methodsFor:'queries'!
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   153
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   154
directory
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   155
    "return the directory component. Thats the rest after the colon.
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   156
     The module is typically used to define the project-path or project-id within its
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   157
     sourcecode repository (which is selected via the module)."
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   158
10208
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   159
    |idx|
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   160
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   161
    idx := packageIdString indexOf:$:.
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   162
    idx == 0 ifTrue:[
11405
c9d1023b1e4e Return empty string for package without directory
Stefan Vogel <sv@exept.de>
parents: 10284
diff changeset
   163
        ^ ''.
10208
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   164
    ].
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   165
    ^ packageIdString copyFrom:idx+1
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   166
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   167
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   168
     (PackageId from:'stx:libbasic') module  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   169
     (PackageId from:'stx:libbasic') directory  
11405
c9d1023b1e4e Return empty string for package without directory
Stefan Vogel <sv@exept.de>
parents: 10284
diff changeset
   170
     (PackageId from:'stx') module  
c9d1023b1e4e Return empty string for package without directory
Stefan Vogel <sv@exept.de>
parents: 10284
diff changeset
   171
     (PackageId from:'stx') directory  
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   172
     (PackageId from:'stx:goodies/xml/stx') module  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   173
     (PackageId from:'stx:goodies/xml/stx') directory  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   174
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   175
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   176
    "Created: / 18-08-2006 / 12:15:33 / cg"
10208
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   177
    "Modified: / 28-11-2006 / 11:39:14 / cg"
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   178
!
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   179
17734
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   180
isModuleId
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   181
    "true if this is a module-id only (i.e. no directory component present).
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   182
     These are not allowed to be used as real projects, but only for organization.
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   183
     The reason is that this is used as selector to select the sourceCodeManager and
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   184
     also the managers repository"
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   185
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   186
    ^ self directory isEmptyOrNil
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   187
!
406b1590afe8 Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17732
diff changeset
   188
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   189
libraryName
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   190
    "return the name of the library, when compiled to a binary (i.e. dll/so).
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   191
     To avoid conflicts with the projectDefinition class 
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   192
     (which is named <module>_<directory_components>), we prefix the library name
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   193
     with 'lib'. This has the added advantage, that under unix, linking can be done with
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   194
     '-l'shortName."
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   195
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   196
    ^ 'lib' , (packageIdString copy asString replaceAny:':/' with:$_)
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   197
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   198
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   199
     (PackageId from:'stx:libbasic') libraryName        
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   200
     (PackageId from:'stx:goodies/xml/stx') libraryName   
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   201
     (PackageId from:'bosch:dapasx') libraryName  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   202
     (PackageId from:'exept:expecco') libraryName  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   203
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   204
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   205
    "Created: / 18-08-2006 / 12:35:04 / cg"
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   206
!
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   207
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   208
module
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   209
    "return the module component. Thats the first component up to the colon.
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   210
     The module is typically used to select a corresponding sourcecode repository."
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   211
10208
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   212
    |idx|
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   213
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   214
    idx := packageIdString indexOf:$:.
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   215
    idx == 0 ifTrue:[
10284
b2ccf3a1794f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10230
diff changeset
   216
        ^ packageIdString.
10208
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   217
    ].
8248266e5c0d report erro, when asking NoProject for directory/module
Claus Gittinger <cg@exept.de>
parents: 10190
diff changeset
   218
    ^ packageIdString copyTo:idx-1
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   219
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   220
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   221
     (PackageId from:'stx:libbasic') module  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   222
     (PackageId from:'stx:libbasic') directory  
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   223
    "
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   224
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   225
    "Created: / 18-08-2006 / 12:13:53 / cg"
10284
b2ccf3a1794f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10230
diff changeset
   226
    "Modified: / 27-12-2006 / 11:51:25 / cg"
9668
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   227
!
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   228
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   229
parentPackage
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   230
    |dir idx|
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   231
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   232
    dir := self directory.
10211
6516bfb2ae56 changed #parentPackage - handle nil
Stefan Vogel <sv@exept.de>
parents: 10208
diff changeset
   233
    dir isNil ifTrue:[
6516bfb2ae56 changed #parentPackage - handle nil
Stefan Vogel <sv@exept.de>
parents: 10208
diff changeset
   234
        ^ nil.
6516bfb2ae56 changed #parentPackage - handle nil
Stefan Vogel <sv@exept.de>
parents: 10208
diff changeset
   235
    ].
9668
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   236
    idx := dir lastIndexOf:$/.
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   237
    idx == 0 ifTrue:[
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   238
        ^ nil
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   239
    ].
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   240
    ^ self class from:(self module , ':' , (dir copyTo:idx-1))
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   241
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   242
    "
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   243
     (PackageId from:'stx:libbasic') parentPackage  
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   244
     (PackageId from:'stx:goodies/xml/stx') parentPackage  
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   245
     (PackageId from:'stx:goodies/xml/stx') parentPackage parentPackage  
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   246
    "
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   247
aa1d5186bd46 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9577
diff changeset
   248
    "Created: / 23-08-2006 / 15:10:13 / cg"
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   249
!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   250
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   251
pathRelativeToTopDirectory
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   252
    ^ (self module asFilename construct:(self directory)) pathName.
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   253
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   254
    "
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   255
     'stx:libbasic' asPackageId pathRelativeToTopDirectory  
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   256
     'stx:goodies/net/ssl' asPackageId pathRelativeToTopDirectory 
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   257
    "
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   258
!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   259
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   260
pathRelativeToTopDirectory:aDirectory
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   261
    ^ aDirectory asFilename construct:(self pathRelativeToTopDirectory)
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   262
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   263
    "
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   264
     |top|
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   265
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   266
     top := Smalltalk packagePath first.
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   267
     'stx:goodies/net/ssl' asPackageId pathRelativeToTopDirectory:top    
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   268
    "
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   269
!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   270
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   271
projectDefinitionClass
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   272
    ^ ProjectDefinition definitionClassForPackage:self
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   273
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   274
    "
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   275
     'stx:libbasic' asPackageId projectDefinitionClass
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   276
    "
9577
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   277
! !
03cce2fb9e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9571
diff changeset
   278
9571
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
!PackageId class methodsFor:'documentation'!
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
01355270af5c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
version
17761
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17735
diff changeset
   282
    ^ '$Id: PackageId.st 10517 2010-04-26 18:26:38Z vranyj1 $'
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   283
!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   284
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   285
version_CVS
17735
6a5bc05f696a Merged with trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17734
diff changeset
   286
    ^ '§Header: /cvs/stx/stx/libbasic/PackageId.st,v 1.16 2009/10/22 15:43:27 cg Exp §'
17761
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17735
diff changeset
   287
!
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   288
17761
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17735
diff changeset
   289
version_SVN
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17735
diff changeset
   290
    ^ '$Id: PackageId.st 10517 2010-04-26 18:26:38Z vranyj1 $'
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17735
diff changeset
   291
! !