1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: prj.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <bootstrp/sstring.hxx>
33 #include <vos/mutex.hxx>
35 #define ENABLE_BYTESTRING_STREAM_OPERATORS
36 #include <tools/stream.hxx>
37 #include <tools/geninfo.hxx>
38 #include <soldep/prj.hxx>
39 #include <bootstrp/inimgr.hxx>
40 #include <soldep/XmlBuildList.hxx>
41 #include "XmlBuildListDef.hxx"
53 #if defined(DOS) || defined(WNT) || defined(OS2)
54 #define LIST_DELIMETER ';'
57 #define LIST_DELIMETER ':'
60 #define LIST_DELIMETER ','
65 #if defined(DOS) || defined(WNT) || defined(OS2) || defined(WIN)
66 #define PATH_DELIMETER '\\'
69 #define PATH_DELIMETER '/'
72 #define PATH_DELIMETER ':'
77 static const char * XML_ALL
= "all";
83 /*****************************************************************************/
84 SimpleConfig::SimpleConfig( String aSimpleConfigFileName
)
85 /*****************************************************************************/
88 aFileName
= aSimpleConfigFileName
;
89 aFileStream
.Open ( aFileName
, STREAM_READ
);
92 /*****************************************************************************/
93 SimpleConfig::SimpleConfig( DirEntry
& rDirEntry
)
94 /*****************************************************************************/
97 aFileName
= rDirEntry
.GetFull();
98 aFileStream
.Open ( aFileName
, STREAM_READ
);
101 /*****************************************************************************/
102 SimpleConfig::~SimpleConfig()
103 /*****************************************************************************/
105 aFileStream
.Close ();
108 /*****************************************************************************/
109 ByteString
SimpleConfig::GetNext()
110 /*****************************************************************************/
114 if ( aStringBuffer
=="" )
115 while ((aStringBuffer
= GetNextLine()) == "\t"); //solange bis != "\t"
116 if ( aStringBuffer
=="" )
119 aString
= aStringBuffer
.GetToken(0,'\t');
120 aStringBuffer
.Erase(0, aString
.Len()+1);
122 aStringBuffer
.EraseLeadingChars( '\t' );
127 /*****************************************************************************/
128 ByteString
SimpleConfig::GetNextLine()
129 /*****************************************************************************/
136 bStreamOk
= aFileStream
.ReadLine ( aTmpStr
);
137 if ( (aTmpStr
.Search( "#" ) == 0) )
139 aTmpStr
= aTmpStr
.EraseLeadingChars();
140 aTmpStr
= aTmpStr
.EraseTrailingChars();
141 while ( aTmpStr
.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND
);
142 int nLength
= aTmpStr
.Len();
143 if ( bStreamOk
&& (nLength
== 0) )
147 ByteString aEraseString
;
148 for ( USHORT i
= 0; i
<= nLength
; i
++)
151 if ( aTmpStr
.GetChar( i
) == '"')
153 if ( bFound
) bFound
= FALSE
;
155 aTmpStr
.SetChar( i
, '\t' );
158 if ( aTmpStr
.GetChar( i
) == 0x20 && !bFound
)
159 aTmpStr
.SetChar( i
, 0x09 );
164 /*****************************************************************************/
165 ByteString
SimpleConfig::GetCleanedNextLine( BOOL bReadComments
)
166 /*****************************************************************************/
169 aFileStream
.ReadLine ( aTmpStr
);
170 if ( aTmpStr
.Search( "#" ) == 0 )
174 while ( aTmpStr
.Search( "#" ) == 0 )
176 aFileStream
.ReadLine ( aTmpStr
);
179 aTmpStr
= aTmpStr
.EraseLeadingChars();
180 aTmpStr
= aTmpStr
.EraseTrailingChars();
181 // while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 );
182 int nLength
= aTmpStr
.Len();
184 ByteString aEraseString
;
185 BOOL bFirstTab
= TRUE
;
186 for ( USHORT i
= 0; i
<= nLength
; i
++)
188 if ( aTmpStr
.GetChar( i
) == 0x20 )
189 aTmpStr
.SetChar( i
, 0x09 );
191 if ( aTmpStr
.GetChar( i
) == 0x09 )
197 aTmpStr
.SetChar( i
, 0x20 );
204 aTmpStr
.EraseAllChars(' ');
214 /*****************************************************************************/
215 CommandData::CommandData()
216 /*****************************************************************************/
223 /*****************************************************************************/
224 CommandData::~CommandData()
225 /*****************************************************************************/
229 ByteString
*pString
= pDepList
->First();
233 pString
= pDepList
->Next();
241 /*****************************************************************************/
242 ByteString
CommandData::GetOSTypeString()
243 /*****************************************************************************/
249 case OS_WIN16
| OS_WIN32
| OS_OS2
| OS_UNX
| OS_MAC
:
252 case OS_WIN32
| OS_WIN16
:
277 /*****************************************************************************/
278 ByteString
CommandData::GetCommandTypeString()
279 /*****************************************************************************/
293 aRetStr
+= ByteString::CreateFromInt64( nCommand
+ 1 - COMMAND_USER_START
);
300 /*****************************************************************************/
301 CommandData
& CommandData::operator>> ( SvStream
& rStream
)
302 /*****************************************************************************/
305 rStream
<< aLogFileName
;
308 rStream
<< aUpdMinor
;
314 rStream
<< aCommandPara
;
316 rStream
<< sClientRestriction
;
325 *pDepList
>> rStream
;
328 rStream
<< sal_False
;
333 /*****************************************************************************/
334 CommandData
& CommandData::operator<< ( SvStream
& rStream
)
335 /*****************************************************************************/
338 rStream
>> aLogFileName
;
341 rStream
>> aUpdMinor
;
347 rStream
>> aCommandPara
;
349 rStream
>> sClientRestriction
;
362 pDepList
= new SByteStringList();
363 *pDepList
<< rStream
;
377 /*****************************************************************************/
379 /*****************************************************************************/
385 ByteString
*pString
= pModeList
->First();
389 pString
= pModeList
->Next();
397 /*****************************************************************************/
398 void DepInfo::SetProject (ByteString
* pStr
)
399 /*****************************************************************************/
405 /*****************************************************************************/
406 void DepInfo::RemoveProject ()
407 /*****************************************************************************/
416 /*****************************************************************************/
417 DepInfo
& DepInfo::operator<< ( SvStream
& rStream
)
418 /*****************************************************************************/
421 pProject
= new ByteString();
422 rStream
>> *pProject
;
425 rStream
>> bModeList
;
427 pModeList
->CleanUp();
431 pModeList
= new SByteStringList();
432 *pModeList
<< rStream
;
437 rStream
>> bAllModes
;
441 /*****************************************************************************/
442 DepInfo
& DepInfo::operator>> ( SvStream
& rStream
)
443 /*****************************************************************************/
445 rStream
<< *pProject
;
449 *pModeList
>> rStream
;
452 rStream
<< sal_False
;
453 rStream
<< bAllModes
;
459 // class SDepInfoList
462 /*****************************************************************************/
463 SDepInfoList::SDepInfoList()
464 /*****************************************************************************/
469 /*****************************************************************************/
470 SDepInfoList::~SDepInfoList()
471 /*****************************************************************************/
477 /*****************************************************************************/
478 ULONG
SDepInfoList::IsString( ByteString
* pStr
)
479 /*****************************************************************************/
481 ULONG nRet
= NOT_THERE
;
482 if ( (nRet
= GetPrevString( pStr
)) != 0 )
484 ByteString
* pString
= GetObject( nRet
)->GetProject();
485 if ( *pString
== *pStr
)
492 ByteString
* pString
= GetObject( 0 )->GetProject();
493 if ( pString
&& (*pString
== *pStr
) )
501 /*****************************************************************************/
502 ULONG
SDepInfoList::GetPrevString( ByteString
* pStr
)
503 /*****************************************************************************/
507 ULONG nCount_l
= Count();
508 ULONG nUpper
= nCount_l
;
510 ULONG nCurrent
= nUpper
/ 2;
516 if ( (nCurrent
== nLower
) || (nCurrent
== nUpper
) )
518 pString
= GetObject( nCurrent
)->GetProject();
519 int nResult
= pStr
->CompareTo( *pString
);
520 if ( nResult
== COMPARE_LESS
)
523 nCurrent
= (nCurrent
+ nLower
) /2;
525 else if ( nResult
== COMPARE_GREATER
)
528 nCurrent
= (nUpper
+ nCurrent
) /2;
530 else if ( nResult
== COMPARE_EQUAL
)
532 if ( nRem
== nCurrent
)
540 /*****************************************************************************/
541 void SDepInfoList::PutModeString( DepInfo
* pInfoList
, ByteString
* pStr
)
542 /*****************************************************************************/
544 SByteStringList
* pList
= pInfoList
->GetModeList();
547 pList
= new SByteStringList
;
548 pInfoList
->SetModeList(pList
);
554 // check if string exists
555 ByteString
*pString
= pList
->First();
558 if (*pString
== *pStr
)
563 pString
= pList
->Next();
565 pList
->PutString( pStr
);
571 /*****************************************************************************/
572 ULONG
SDepInfoList::PutString( ByteString
* pStr
)
573 /*****************************************************************************/
575 return PutString( pStr
, NULL
);
578 /**************************************************************************
580 * Sortiert einen ByteString in die Liste ein und gibt die Position,
581 * an der einsortiert wurde, zurueck
583 **************************************************************************/
585 ULONG
SDepInfoList::PutString( ByteString
* pStr
, ByteString
* pModeStr
)
593 ULONG nPos
= GetPrevString ( pStr
);
597 DepInfo
* pInfo
= GetObject( 0 );
598 ByteString
* pString
= pInfo
->GetProject();
599 if ( pString
->CompareTo( *pStr
) == COMPARE_GREATER
)
604 pInfo
->SetProject(pStr
);
606 PutModeString(pInfo
, pModeStr
);
608 pInfo
->SetAllModes();
609 Insert( pInfo
, (ULONG
)0 );
614 ByteString
* pString
= GetObject( nPos
)->GetProject();
615 if ( *pStr
!= *pString
)
617 DepInfo
* pInfo
= new DepInfo
;
620 pInfo
->SetProject(pStr
);
622 PutModeString(pInfo
, pModeStr
);
624 pInfo
->SetAllModes();
625 Insert( pInfo
, nPos
+1 );
632 DepInfo
* pInfo
= GetObject( nPos
);
634 PutModeString(pInfo
, pModeStr
);
636 pInfo
->SetAllModes();
642 DepInfo
* pInfo
= new DepInfo
;
645 pInfo
->SetProject(pStr
);
647 PutModeString(pInfo
, pModeStr
);
649 pInfo
->SetAllModes();
661 /*****************************************************************************/
662 ByteString
* SDepInfoList::RemoveString( const ByteString
& rName
)
663 /*****************************************************************************/
673 for( i
= 0 ; i
< Count(); i
++ )
675 if ( rName
== *(GetObject( i
)->GetProject()) )
677 pReturn
= new ByteString(*(GetObject(i
)->GetProject()));
679 pInfo
= GetObject(i
);
689 /*****************************************************************************/
690 SByteStringList
* SDepInfoList::GetAllDepModes()
691 /*****************************************************************************/
696 DepInfo
*pInfo
= First();
699 if (!pInfo
->IsAllModes() && pInfo
->GetModeList())
702 pAllModeList
= new SByteStringList();
703 ByteString
* pStr
= pInfo
->GetModeList()->First();
706 if (pAllModeList
->IsString(pStr
) == NOT_THERE
)
707 pAllModeList
->PutString(pStr
);
708 pStr
= pInfo
->GetModeList()->Next();
716 /*****************************************************************************/
717 SDepInfoList
& SDepInfoList::operator<< ( SvStream
& rStream
)
718 /*****************************************************************************/
722 for ( USHORT i
= 0; i
< nCount_l
; i
++ ) {
723 DepInfo
* pDepInfo
= new DepInfo();
724 *pDepInfo
<< rStream
;
725 Insert (pDepInfo
, LIST_APPEND
);
730 /*****************************************************************************/
731 SDepInfoList
& SDepInfoList::operator>> ( SvStream
& rStream
)
732 /*****************************************************************************/
734 ULONG nCount_l
= Count();
736 DepInfo
* pDepInfo
= First();
738 *pDepInfo
>> rStream
;
745 /*****************************************************************************/
746 CommandData
* Prj::GetDirectoryList ( USHORT nWhatOS
, USHORT nCommand
)
747 /*****************************************************************************/
749 return (CommandData
*)NULL
;
752 /*****************************************************************************/
753 CommandData
* Prj::GetDirectoryData( ByteString aLogFileName
)
754 /*****************************************************************************/
756 CommandData
*pData
= NULL
;
757 ULONG nCount_l
= Count();
758 for ( ULONG i
=0; i
<nCount_l
; i
++ )
760 pData
= GetObject(i
);
761 if ( pData
->GetLogFile() == aLogFileName
)
771 /*****************************************************************************/
773 pPrjInitialDepList(0),
777 bHardDependencies( FALSE
),
778 bFixedDependencies( FALSE
),
781 /*****************************************************************************/
785 /*****************************************************************************/
786 Prj::Prj( ByteString aName
) :
787 aProjectName( aName
),
788 pPrjInitialDepList(0),
792 bHardDependencies( FALSE
),
793 bFixedDependencies( FALSE
),
796 /*****************************************************************************/
800 /*****************************************************************************/
802 /*****************************************************************************/
804 pPrjDepList
= RemoveStringList (pPrjDepList
);
805 pPrjInitialDepList
= RemoveStringList (pPrjInitialDepList
);
806 pPrjDepInfoList
= RemoveDepInfoList (pPrjDepInfoList
);
809 /*****************************************************************************/
810 SByteStringList
* Prj::RemoveStringList(SByteStringList
* pStringList
)
811 /*****************************************************************************/
815 ByteString
*pString
= pStringList
->First();
819 pString
= pStringList
->Next();
829 /*****************************************************************************/
830 SDepInfoList
* Prj::RemoveDepInfoList(SDepInfoList
* pInfoList
)
831 /*****************************************************************************/
835 DepInfo
*pInfo
= pInfoList
->First();
839 pInfo
= pInfoList
->Next();
849 /*****************************************************************************/
850 void Prj::AddDependencies( ByteString aStr
)
851 /*****************************************************************************/
854 if ( !pPrjDepInfoList
)
855 pPrjDepInfoList
= new SDepInfoList
;
857 pPrjDepInfoList
->PutString( new ByteString(aStr
) );
860 /*****************************************************************************/
861 void Prj::AddDependencies( ByteString aStr
, ByteString aModeStr
)
862 /*****************************************************************************/
865 // needs dirty flag - not expanded
866 if ( !pPrjDepInfoList
)
867 pPrjDepInfoList
= new SDepInfoList
;
869 pPrjDepInfoList
->PutString( new ByteString(aStr
), new ByteString(aModeStr
) );
872 /*****************************************************************************/
873 SByteStringList
* Prj::GetDependencies( BOOL bExpanded
)
874 /*****************************************************************************/
884 if (!pPrjInitialDepList
)
886 return pPrjInitialDepList
;
890 /*****************************************************************************/
891 void Prj::SetMode(SByteStringList
* pModList
)
892 /*****************************************************************************/
894 pPrjDepList
= RemoveStringList (pPrjDepList
);
895 pPrjInitialDepList
= RemoveStringList (pPrjInitialDepList
);
897 if (!pPrjDepInfoList
)
900 pPrjDepList
= new SByteStringList
;
901 pPrjInitialDepList
= new SByteStringList
;
903 DepInfo
*pInfo
= pPrjDepInfoList
->First();
906 if (pInfo
->IsAllModes() || !pInfo
->GetModeList() || !pModList
)
908 pPrjDepList
->PutString( new ByteString((ByteString
) *(pInfo
->GetProject())));
909 pPrjInitialDepList
->PutString( new ByteString((ByteString
) *(pInfo
->GetProject())));
910 //pPrjDepList->PutString( pInfo->GetProject());
911 //pPrjInitialDepList->PutString( pInfo->GetProject());
915 BOOL bStringFound
= FALSE
;
916 SByteStringList
* pDepList
= pInfo
->GetModeList();
917 ByteString
*pModString
= pDepList
->First();
920 ByteString
*pDefModString
= pModList
->First();
921 while ( pDefModString
)
923 if (*pDefModString
== *pModString
)
925 pPrjDepList
->PutString( new ByteString((ByteString
) *(pInfo
->GetProject())));
926 pPrjInitialDepList
->PutString( new ByteString((ByteString
) *(pInfo
->GetProject())));
927 //pPrjDepList->PutString( pInfo->GetProject());
928 //pPrjInitialDepList->PutString( pInfo->GetProject());
932 pDefModString
= pModList
->Next();
936 pModString
= pDepList
->Next();
941 pInfo
= pPrjDepInfoList
->Next();
945 /*****************************************************************************/
946 BOOL
Prj::InsertDirectory ( ByteString aDirName
, USHORT aWhat
,
947 USHORT aWhatOS
, ByteString aLogFileName
,
948 const ByteString
&rClientRestriction
)
949 /*****************************************************************************/
951 CommandData
* pData
= new CommandData();
953 pData
->SetPath( aDirName
);
954 pData
->SetCommandType( aWhat
);
955 pData
->SetOSType( aWhatOS
);
956 pData
->SetLogFile( aLogFileName
);
957 pData
->SetClientRestriction( rClientRestriction
);
964 /*****************************************************************************/
966 // removes directory and existing dependencies on it
968 CommandData
* Prj::RemoveDirectory ( ByteString aLogFileName
)
969 /*****************************************************************************/
971 ULONG nCount_l
= Count();
973 CommandData
* pDataFound
= NULL
;
974 SByteStringList
* pDataDeps
;
976 for ( USHORT i
= 0; i
< nCount_l
; i
++ )
978 pData
= GetObject( i
);
979 if ( pData
->GetLogFile() == aLogFileName
)
983 pDataDeps
= pData
->GetDependencies();
987 ULONG nDataDepsCount
= pDataDeps
->Count();
988 for ( ULONG j
= nDataDepsCount
; j
> 0; j
-- )
990 pString
= pDataDeps
->GetObject( j
- 1 );
991 if ( pString
->GetToken( 0, '.') == aLogFileName
)
992 pDataDeps
->Remove( pString
);
998 Remove( pDataFound
);
1003 /*****************************************************************************/
1004 void Prj::ExtractDependencies()
1005 /*****************************************************************************/
1008 CommandData
* pData
= GetObject(nPos
);
1011 SByteStringList
* pDepList
= pData
->GetDependencies();
1014 ByteString
* pDepStr
= pDepList
->First();
1017 CommandData
* pSearchData
= First();
1020 if ((*pDepStr
== pSearchData
->GetPath()) && (pData
->GetOSType() & pSearchData
->GetOSType()))
1022 *pDepStr
= pSearchData
->GetLogFile();
1026 pSearchData
= Next();
1029 pDepStr
= pDepList
->Next();
1033 pData
= GetObject(nPos
);
1037 /*****************************************************************************/
1038 Prj
& Prj::operator>> ( SvStream
& rStream
)
1039 /*****************************************************************************/
1041 rStream
<< bVisited
;
1042 rStream
<< aProjectName
;
1043 rStream
<< aProjectPrefix
;
1044 rStream
<< bHardDependencies
;
1045 rStream
<< bFixedDependencies
;
1047 rStream
<< bIsAvailable
;
1049 if (pPrjDepInfoList
)
1051 rStream
<< sal_True
;
1052 *pPrjDepInfoList
>> rStream
;
1055 rStream
<< sal_False
;
1057 ULONG nCount_l
= Count();
1058 rStream
<< nCount_l
;
1060 CommandData
* pData
= First();
1069 /*****************************************************************************/
1070 Prj
& Prj::operator<< ( SvStream
& rStream
)
1071 /*****************************************************************************/
1073 rStream
>> bVisited
;
1074 rStream
>> aProjectName
;
1075 rStream
>> aProjectPrefix
;
1076 rStream
>> bHardDependencies
;
1077 rStream
>> bFixedDependencies
;
1079 rStream
>> bIsAvailable
;
1082 rStream
>> bDepList
;
1083 DELETEZ (pPrjDepInfoList
);
1086 pPrjDepInfoList
= new SDepInfoList();
1087 *pPrjDepInfoList
<< rStream
;
1091 rStream
>> nCount_l
;
1093 for ( USHORT i
= 0; i
< nCount_l
; i
++ ) {
1094 CommandData
* pData
= new CommandData();
1096 Insert (pData
, LIST_APPEND
);
1107 /*****************************************************************************/
1108 Star::Star(XmlBuildList
* pXmlBuildListObj
)
1109 /*****************************************************************************/
1112 mpXmlBuildList (pXmlBuildListObj
)
1114 // this ctor is only used by StarWriter
1117 /*****************************************************************************/
1118 Star::Star(XmlBuildList
* pXmlBuildListObj
, String aFileName
, USHORT nMode
)
1119 /*****************************************************************************/
1120 : nStarMode( nMode
),
1121 sFileName( aFileName
),
1124 mpXmlBuildList (pXmlBuildListObj
)
1129 /*****************************************************************************/
1130 Star::Star(XmlBuildList
* pXmlBuildListObj
, SolarFileList
*pSolarFiles
)
1131 /*****************************************************************************/
1132 : nStarMode( STAR_MODE_MULTIPLE_PARSE
),
1135 mpXmlBuildList (pXmlBuildListObj
)
1137 // this ctor is used by StarBuilder to get the information for the whole workspace
1138 Read( pSolarFiles
);
1141 /*****************************************************************************/
1142 Star::Star(XmlBuildList
* pXmlBuildListObj
, GenericInformationList
*pStandLst
, ByteString
&rVersion
,
1143 BOOL bLocal
, const char *pSourceRoot
)
1144 /*****************************************************************************/
1147 mpXmlBuildList (pXmlBuildListObj
)
1149 UpdateFileList (pStandLst
, rVersion
, TRUE
, bLocal
, pSourceRoot
);
1152 /*****************************************************************************/
1153 void Star::UpdateFileList( GenericInformationList
*pStandLst
, ByteString
&rVersion
,
1154 BOOL bRead
, BOOL bLocal
, const char *pSourceRoot
)
1155 /*****************************************************************************/
1157 sSourceRoot
=String::CreateFromAscii(""); // clear old SourceRoot
1158 ByteString
sPath( rVersion
);
1160 sSourceRoot
= String::CreateFromAscii( pSourceRoot
);
1163 sPath
+= "/settings/UNXSOLARLIST";
1165 sPath
+= "/settings/SOLARLIST";
1167 GenericInformation
*pInfo
= pStandLst
->GetInfo( sPath
, TRUE
);
1169 if( pInfo
&& pInfo
->GetValue().Len()) {
1170 ByteString
sFile( pInfo
->GetValue());
1172 IniManager aIniManager
;
1173 aIniManager
.ToLocal( sFile
);
1175 String
sFileName_l( sFile
, RTL_TEXTENCODING_ASCII_US
);
1176 nStarMode
= STAR_MODE_SINGLE_PARSE
;
1178 Read( sFileName_l
);
1181 SolarFileList
*pFileList
= new SolarFileList();
1186 GenericInformation
*pInfo_l
= pStandLst
->GetInfo( sPath
, TRUE
);
1187 if ( pInfo_l
&& pInfo_l
->GetSubList()) {
1188 GenericInformationList
*pDrives
= pInfo_l
->GetSubList();
1189 for ( ULONG i
= 0; i
< pDrives
->Count(); i
++ ) {
1190 GenericInformation
*pDrive
= pDrives
->GetObject( i
);
1194 if ( sSourceRoot
.Len()) {
1195 aEntry
= DirEntry( sSourceRoot
);
1200 sPath
= "UnixVolume";
1201 GenericInformation
*pUnixVolume
= pDrive
->GetSubInfo( sPath
);
1202 if ( pUnixVolume
) {
1203 String
sRoot( pUnixVolume
->GetValue(), RTL_TEXTENCODING_ASCII_US
);
1204 aEntry
= DirEntry( sRoot
);
1209 String
sRoot( *pDrive
, RTL_TEXTENCODING_ASCII_US
);
1210 sRoot
+= String::CreateFromAscii( "\\" );
1211 aEntry
= DirEntry( sRoot
);
1216 GenericInformation
*pProjectsKey
= pDrive
->GetSubInfo( sPath
, TRUE
);
1217 if ( pProjectsKey
) {
1218 if ( !sSourceRoot
.Len()) {
1220 sPath
+= "/settings/PATH";
1221 GenericInformation
*pPath
= pStandLst
->GetInfo( sPath
, TRUE
);
1223 ByteString
sAddPath( pPath
->GetValue());
1225 sAddPath
.SearchAndReplaceAll( "\\", "/" );
1227 sAddPath
.SearchAndReplaceAll( "/", "\\" );
1229 String
ssAddPath( sAddPath
, RTL_TEXTENCODING_ASCII_US
);
1230 aEntry
+= DirEntry( ssAddPath
);
1233 sSourceRoot
= aEntry
.GetFull();
1234 GenericInformationList
*pProjects
= pProjectsKey
->GetSubList();
1236 GenericInformation
* pProject
= pProjects
->First();
1238 String sLocalSourceRoot
= sSourceRoot
;
1239 ByteString
sProject( *pProject
);
1240 String
ssProject( sProject
, RTL_TEXTENCODING_ASCII_US
);
1242 ByteString
aDirStr ("Directory");
1243 GenericInformation
* pDir
= pProject
->GetSubInfo (aDirStr
);
1245 ByteString aDir
= pDir
->GetValue();
1246 DirEntry aRootEntry
= aEntry
.GetPath() + DirEntry(aDir
);
1247 sLocalSourceRoot
= aRootEntry
.GetFull();
1250 String aBuildListPath
= CreateFileName(ssProject
, sLocalSourceRoot
);
1252 pFileList
->Insert( new String( aBuildListPath
), LIST_APPEND
);
1253 ByteString
sFile( aBuildListPath
, RTL_TEXTENCODING_ASCII_US
);
1254 pProject
= pProjects
->Next();
1263 if (!CheckFileLoadList(pFileList
))
1265 ClearAvailableDeps();
1267 ClearLoadedFilesList();
1269 bRead
= TRUE
; // read new list because old list is deleted
1275 GenerateFileLoadList( pFileList
);
1279 /*****************************************************************************/
1280 BOOL
Star::CheckFileLoadList(SolarFileList
*pSolarFiles
)
1281 /*****************************************************************************/
1284 if (aLoadedFilesList
.Count() == 0)
1286 StarFile
* pLoadFile
= aLoadedFilesList
.First();
1289 BOOL bIsAvailable
= FALSE
;
1290 String
* pFile
= pSolarFiles
->First();
1293 if (*pFile
== pLoadFile
->GetName())
1295 bIsAvailable
= TRUE
;
1298 pFile
= pSolarFiles
->Next();
1305 pLoadFile
= aLoadedFilesList
.Next();
1310 /*****************************************************************************/
1312 /*****************************************************************************/
1314 ClearAvailableDeps();
1316 ClearLoadedFilesList();
1320 /*****************************************************************************/
1321 void Star::GenerateFileLoadList( SolarFileList
*pSolarFiles
)
1322 /*****************************************************************************/
1324 SolarFileList
* pNewSolarFiles
= NULL
;
1325 while( pSolarFiles
->Count()) {
1326 StarFile
*pFile
= new StarFile( *pSolarFiles
->GetObject(( ULONG
) 0 ));
1328 ULONG nPos
= SearchFileEntry(&aLoadedFilesList
, pFile
);
1329 if ( nPos
== LIST_ENTRY_NOTFOUND
)
1331 if (!pNewSolarFiles
)
1332 pNewSolarFiles
= new SolarFileList();
1334 pNewSolarFiles
->Insert(new String(pFile
->GetName()), LIST_APPEND
);
1337 delete pSolarFiles
->Remove(( ULONG
) 0 );
1342 Read (pNewSolarFiles
);
1345 /*****************************************************************************/
1346 SolarFileList
* Star::NeedsFilesForUpdate()
1347 /*****************************************************************************/
1350 SolarFileList
* pPrjList
= NULL
;
1351 for ( ULONG i
= 0; i
< aLoadedFilesList
.Count(); i
++ )
1352 if ( aLoadedFilesList
.GetObject( i
)->NeedsUpdate()) {
1354 pPrjList
= new SolarFileList();
1356 pPrjList
->Insert(new String (aLoadedFilesList
.GetObject( i
)->GetName()), LIST_APPEND
);
1363 /*****************************************************************************/
1364 BOOL
Star::NeedsUpdate()
1365 /*****************************************************************************/
1368 for ( ULONG i
= 0; i
< aLoadedFilesList
.Count(); i
++ )
1369 if ( aLoadedFilesList
.GetObject( i
)->NeedsUpdate()) {
1378 /*****************************************************************************/
1379 void Star::Read( String
&rFileName
)
1380 /*****************************************************************************/
1382 ClearAvailableDeps ();
1384 aFileList
.Insert( new String( rFileName
));
1386 DirEntry
aEntry( rFileName
);
1388 aEntry
= aEntry
.GetPath().GetPath().GetPath();
1389 sSourceRoot
= aEntry
.GetFull();
1391 while( aFileList
.Count()) {
1392 String ssFileName
= *aFileList
.GetObject(( ULONG
) 0 );
1393 ByteString
sFileName_l(ssFileName
, RTL_TEXTENCODING_ASCII_US
);
1394 StarFile
*pFile
= new StarFile( ssFileName
);
1395 if ( pFile
->Exists()) {
1396 if (sFileName_l
.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT
) && ssFileName
.EqualsAscii(XML_EXT
, sFileName_l
.Len() - RTL_CONSTASCII_LENGTH(XML_EXT
), RTL_CONSTASCII_LENGTH(XML_EXT
)))
1398 ReadXmlBuildList(sFileName_l
);
1400 SimpleConfig
aSolarConfig( ssFileName
);
1401 while (( aString
= aSolarConfig
.GetNext()) != "" )
1402 InsertToken (( char * ) aString
.GetBuffer());
1406 ReplaceFileEntry (&aLoadedFilesList
, pFile
);
1407 //aLoadedFilesList.Insert( pFile, LIST_APPEND );
1409 aFileList
.Remove(( ULONG
) 0 );
1411 // resolve all dependencies recursive
1415 /*****************************************************************************/
1416 ULONG
Star::SearchFileEntry( StarFileList
*pStarFiles
, StarFile
* pFile
)
1417 /*****************************************************************************/
1419 StarFile
*pSearchFile
;
1422 nCount_l
= pStarFiles
->Count();
1424 for ( ULONG i
=0; i
<nCount_l
; i
++)
1426 pSearchFile
= pStarFiles
->GetObject(i
);
1427 if ( pSearchFile
->GetName() == pFile
->GetName() )
1432 return LIST_ENTRY_NOTFOUND
;
1435 /*****************************************************************************/
1436 void Star::ReplaceFileEntry( StarFileList
*pStarFiles
, StarFile
* pFile
)
1437 /*****************************************************************************/
1439 ULONG nPos
= SearchFileEntry(pStarFiles
, pFile
);
1440 if ( nPos
!= LIST_ENTRY_NOTFOUND
)
1442 StarFile
* pTmpStarFile
= pStarFiles
->GetObject(nPos
);
1443 delete pTmpStarFile
;
1444 pStarFiles
->Replace(pFile
, nPos
);
1447 pStarFiles
->Insert( pFile
, LIST_APPEND
);
1450 /*****************************************************************************/
1451 void Star::Read( SolarFileList
*pSolarFiles
)
1452 /*****************************************************************************/
1454 ClearAvailableDeps ();
1455 while( pSolarFiles
->Count()) {
1458 String ssFileName
= *pSolarFiles
->GetObject(( ULONG
) 0 );
1459 ByteString
sFileName_l(ssFileName
, RTL_TEXTENCODING_ASCII_US
);
1460 StarFile
*pFile
= new StarFile( ssFileName
);
1462 if ( pFile
->Exists()) {
1463 if (sFileName_l
.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT
) && ssFileName
.EqualsAscii(XML_EXT
, sFileName_l
.Len() - RTL_CONSTASCII_LENGTH(XML_EXT
), RTL_CONSTASCII_LENGTH(XML_EXT
)))
1465 ReadXmlBuildList(sFileName_l
);
1467 SimpleConfig
aSolarConfig( ssFileName
);
1468 while (( aString
= aSolarConfig
.GetNext()) != "" )
1469 InsertToken (( char * ) aString
.GetBuffer());
1472 DirEntry
aEntry( pFile
->GetName() );
1473 DirEntry aEntryPrj
= aEntry
.GetPath().GetPath();
1474 if (aEntryPrj
.GetExtension() != String::CreateFromAscii( "" ))
1476 aEntryPrj
.CutExtension();
1477 ByteString aPrjName
= ByteString( aEntryPrj
.GetName(), gsl_getSystemTextEncoding());
1478 Prj
* pPrj
= GetPrj(aPrjName
);
1480 pPrj
->IsAvailable (FALSE
);
1486 ReplaceFileEntry (&aLoadedFilesList
, pFile
);
1487 //aLoadedFilesList.Insert( pFile, LIST_APPEND );
1489 delete pSolarFiles
->Remove(( ULONG
) 0 );
1496 /*****************************************************************************/
1497 String
Star::CreateFileName( String
& rProject
, String
& rSourceRoot
)
1498 /*****************************************************************************/
1500 // this method is used to find solarlist parts of nabours (other projects)
1501 String
sPrjDir( String::CreateFromAscii( "prj" ));
1502 String
sBuildList( String::CreateFromAscii( "build.lst" ));
1503 String
sXmlBuildList( String::CreateFromAscii( "build.xlist" ));
1505 DirEntry
aEntry( rSourceRoot
);
1506 aEntry
+= DirEntry( rProject
);
1508 // if this project not exists, maybe it's a not added project of a CWS
1510 if ( !aEntry
.Exists() ) {
1511 aEntry
.SetExtension(String::CreateFromAscii( "lnk" ));
1512 if ( !aEntry
.Exists() )
1513 aEntry
.CutExtension();
1515 aEntry
.SetExtension(String::CreateFromAscii( "link" ));
1516 if ( !aEntry
.Exists() )
1517 aEntry
.CutExtension();
1520 aEntry
+= DirEntry( sPrjDir
);
1522 DirEntry
aPossibleEntry(aEntry
);
1523 aPossibleEntry
+= DirEntry( sXmlBuildList
);
1525 aEntry
+= DirEntry( sBuildList
);
1527 DirEntry
& aActualEntry
= aEntry
;
1528 if (aPossibleEntry
.Exists()) {
1529 aActualEntry
= aPossibleEntry
;
1530 } else if ( !aActualEntry
.Exists() && aDBNotFoundHdl
.IsSet())
1531 aDBNotFoundHdl
.Call( &rProject
);
1532 return aActualEntry
.GetFull();
1535 /*****************************************************************************/
1536 void Star::InsertSolarList( String sProject
)
1537 /*****************************************************************************/
1539 // inserts a new solarlist part of another project
1540 String
sFileName_l( CreateFileName( sProject
, sSourceRoot
));
1542 for ( ULONG i
= 0; i
< aFileList
.Count(); i
++ ) {
1543 if (( *aFileList
.GetObject( i
)) == sFileName_l
)
1547 ByteString
ssProject( sProject
, RTL_TEXTENCODING_ASCII_US
);
1548 if ( HasProject( ssProject
))
1551 aFileList
.Insert( new String( sFileName_l
), LIST_APPEND
);
1554 /*****************************************************************************/
1555 void Star::ExpandPrj_Impl( Prj
*pPrj
, Prj
*pDepPrj
)
1556 /*****************************************************************************/
1558 if ( pDepPrj
->bVisited
)
1561 pDepPrj
->bVisited
= TRUE
;
1563 SByteStringList
* pPrjLst
= pPrj
->GetDependencies();
1564 SByteStringList
* pDepLst
= NULL
;
1565 ByteString
* pDepend
;
1566 ByteString
* pPutStr
;
1567 Prj
*pNextPrj
= NULL
;
1571 pDepLst
= pDepPrj
->GetDependencies();
1573 for ( i
= 0; i
< pDepLst
->Count(); i
++ ) {
1574 pDepend
= pDepLst
->GetObject( i
);
1575 pPutStr
= new ByteString( *pDepend
);
1576 nRetPos
= pPrjLst
->PutString( pPutStr
);
1577 if( nRetPos
== NOT_THERE
)
1579 pNextPrj
= GetPrj( *pDepend
);
1581 ExpandPrj_Impl( pPrj
, pNextPrj
);
1588 /*****************************************************************************/
1589 void Star::Expand_Impl()
1590 /*****************************************************************************/
1592 for ( ULONG i
= 0; i
< Count(); i
++ ) {
1593 for ( ULONG j
= 0; j
< Count(); j
++ )
1594 GetObject( j
)->bVisited
= FALSE
;
1596 Prj
* pPrj
= GetObject( i
);
1597 pPrj
->SetMode(pDepMode
); // DepList für Mode initialisieren
1598 ExpandPrj_Impl( pPrj
, pPrj
);
1602 /*****************************************************************************/
1603 void Star::InsertToken ( char *yytext
)
1604 /*****************************************************************************/
1607 static ByteString aDirName
, aWhat
, aWhatOS
,
1608 sClientRestriction
, aLogFileName
, aProjectName
, aPrefix
, aCommandPara
;
1609 static BOOL bPrjDep
= FALSE
;
1610 static BOOL bHardDep
= FALSE
;
1611 static BOOL bFixedDep
= FALSE
;
1612 static int nCommandType
, nOSType
;
1613 CommandData
* pCmdData
;
1614 static SByteStringList
*pStaticDepList
;
1627 if ( !strcmp( yytext
, ":" ))
1634 else if ( !strcmp( yytext
, "::" ))
1641 else if ( !strcmp( yytext
, ":::" ))
1655 nCommandType
= GetJobType(aWhat
);
1659 aProjectName
= aDirName
.GetToken ( 0, 0x5c);
1660 if ( HasProject( aProjectName
))
1662 RemovePrj(GetPrj(aProjectName
));
1663 // Projekt exist. schon, entfernen, später neue anlegen
1673 aCommandPara
= ByteString();
1676 aCommandPara
= aWhat
;
1683 if ( aWhatOS
.GetTokenCount( ',' ) > 1 ) {
1684 sClientRestriction
= aWhatOS
.Copy( aWhatOS
.GetToken( 0, ',' ).Len() + 1 );
1685 aWhatOS
= aWhatOS
.GetToken( 0, ',' );
1687 nOSType
= GetOSType (aWhatOS
);
1693 aLogFileName
= yytext
;
1699 ByteString aItem
= yytext
;
1700 if ( aItem
== "NULL" )
1707 // ggfs. Dependency liste anlegen und ergaenzen
1708 if ( !pStaticDepList
)
1709 pStaticDepList
= new SByteStringList
;
1710 pStaticDepList
->PutString( new ByteString( aItem
));
1715 ByteString aItem
= yytext
;
1716 if ( aItem
== "NULL" )
1725 BOOL bHasModes
= FALSE
;
1726 if (aItem
.Search(":") != STRING_NOTFOUND
)
1728 sMode
= aItem
.GetToken ( 0, ':');
1729 aItem
= aItem
.GetToken ( 1, ':');
1733 aProjectName
= aDirName
.GetToken ( 0, 0x5c);
1734 if ( HasProject( aProjectName
))
1736 pPrj
= GetPrj( aProjectName
);
1737 // Projekt exist. schon, neue Eintraege anhaengen
1741 // neues Project anlegen
1742 pPrj
= new Prj ( aProjectName
);
1743 pPrj
->SetPreFix( aPrefix
);
1744 Insert(pPrj
,LIST_APPEND
);
1747 pPrj
->AddDependencies( aItem
, sMode
);
1749 pPrj
->AddDependencies( aItem
);
1750 pPrj
->HasHardDependencies( bHardDep
);
1751 pPrj
->HasFixedDependencies( bFixedDep
);
1754 if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) {
1755 String sItem( aItem, RTL_TEXTENCODING_ASCII_US );
1756 InsertSolarList( sItem );
1763 /* Wenn dieses Project noch nicht vertreten ist, in die Liste
1764 der Solar-Projekte einfuegen */
1767 aProjectName
= aDirName
.GetToken ( 0, 0x5c);
1768 if ( HasProject( aProjectName
))
1770 pPrj
= GetPrj( aProjectName
);
1771 // Projekt exist. schon, neue Eintraege anhaengen
1775 // neues Project anlegen
1776 pPrj
= new Prj ( aProjectName
);
1777 pPrj
->SetPreFix( aPrefix
);
1778 Insert(pPrj
,LIST_APPEND
);
1781 pCmdData
= new CommandData
;
1782 pCmdData
->SetPath( aDirName
);
1783 pCmdData
->SetCommandType( nCommandType
);
1784 pCmdData
->SetCommandPara( aCommandPara
);
1785 pCmdData
->SetOSType( nOSType
);
1786 pCmdData
->SetLogFile( aLogFileName
);
1787 pCmdData
->SetClientRestriction( sClientRestriction
);
1788 if ( pStaticDepList
)
1789 pCmdData
->SetDependencies( pStaticDepList
);
1792 pPrj
->Insert ( pCmdData
, LIST_APPEND
);
1796 sClientRestriction
= "";
1803 // und wer raeumt die depLst wieder ab ?
1804 // CommandData macht das
1807 /*****************************************************************************/
1808 BOOL
Star::HasProject ( ByteString aProjectName
)
1809 /*****************************************************************************/
1816 for ( int i
=0; i
<nCount_l
; i
++)
1818 pPrj
= GetObject(i
);
1819 if ( pPrj
->GetProjectName().ToLowerAscii() == aProjectName
.ToLowerAscii() )
1825 /*****************************************************************************/
1826 Prj
* Star::GetPrj ( ByteString aProjectName
)
1827 /*****************************************************************************/
1830 int nCount_l
= Count();
1831 for ( int i
=0;i
<nCount_l
;i
++)
1833 pPrj
= GetObject(i
);
1834 if ( pPrj
->GetProjectName().ToLowerAscii() == aProjectName
.ToLowerAscii() )
1837 // return (Prj*)NULL;
1841 /*****************************************************************************/
1842 BOOL
Star::RemovePrj ( Prj
* pPrj
)
1843 /*****************************************************************************/
1845 ULONG nPos
= GetPos(pPrj
);
1846 if (nPos
!= LIST_ENTRY_NOTFOUND
) {
1854 /*****************************************************************************/
1855 void Star::RemoveAllPrj ()
1856 /*****************************************************************************/
1858 Prj
* pPrj
= First();
1867 /*****************************************************************************/
1868 ByteString
Star::GetPrjName( DirEntry
&aPath
)
1869 /*****************************************************************************/
1871 ByteString aRetPrj
, aDirName
;
1872 ByteString aFullPathName
= ByteString( aPath
.GetFull(), gsl_getSystemTextEncoding());
1874 USHORT nToken
= aFullPathName
.GetTokenCount(PATH_DELIMETER
);
1875 for ( int i
=0; i
< nToken
; i
++ )
1877 aDirName
= aFullPathName
.GetToken( i
, PATH_DELIMETER
);
1878 if ( HasProject( aDirName
))
1888 /*****************************************************************************/
1889 void Star::ClearAvailableDeps ()
1890 /*****************************************************************************/
1894 ByteString
*pString
= pAllDepMode
->First();
1898 pString
= pAllDepMode
->Next();
1905 /*****************************************************************************/
1906 void Star::ClearLoadedFilesList ()
1907 /*****************************************************************************/
1909 StarFile
*pStarFile
= aLoadedFilesList
.First();
1913 pStarFile
= aLoadedFilesList
.Next();
1915 aLoadedFilesList
.Clear();
1918 /*****************************************************************************/
1919 void Star::ClearCurrentDeps ()
1920 /*****************************************************************************/
1924 ByteString
*pString
= pDepMode
->First();
1928 pString
= pDepMode
->Next();
1935 /*****************************************************************************/
1936 SByteStringList
* Star::GetAvailableDeps ()
1937 /*****************************************************************************/
1947 SByteStringList
* pModeList
= NULL
;
1948 if (pPrj
->GetModeAndDependencies() && (pModeList
= pPrj
->GetModeAndDependencies()->GetAllDepModes()))
1950 pStr
= pModeList
->First();
1954 pAllDepMode
= new SByteStringList();
1956 if (pAllDepMode
->IsString(pStr
) == NOT_THERE
)
1957 pAllDepMode
->PutString(new ByteString(*pStr
));
1959 pStr
= pModeList
->Next();
1967 /*****************************************************************************/
1968 void Star::SetCurrentDeps (SByteStringList
* pDepList
)
1969 /*****************************************************************************/
1975 pDepMode
= new SByteStringList();
1976 ByteString
*pString
= pDepList
->First();
1979 ByteString
* pStr
= new ByteString (*pString
);
1980 if (pDepMode
->PutString(pStr
) == NOT_THERE
)
1981 delete pStr
; // String is not in List
1982 pString
= pDepList
->Next();
1988 /*****************************************************************************/
1989 void Star::ReadXmlBuildList(const ByteString
& sBuildLstPath
) {
1990 /*****************************************************************************/
1991 if (mpXmlBuildList
) {
1995 mpXmlBuildList
->loadXMLFile(sBuildLstPath
);
1997 catch (XmlBuildListException
) {
1998 DirEntry
aDirEntry (sBuildLstPath
);
1999 String ssPrjName
= aDirEntry
.GetPath().GetPath().GetBase();
2000 ByteString sPrjName
= ByteString(ssPrjName
, RTL_TEXTENCODING_ASCII_US
);
2001 pPrj
= GetPrj( sPrjName
);
2004 //remove old Project
2011 ByteString sProjectName
= mpXmlBuildList
->getModuleName();
2012 pPrj
= GetPrj( sProjectName
);
2015 //remove old Project
2019 // insert new Project
2020 pPrj
= new Prj ( sProjectName
);
2021 pPrj
->SetPreFix( sProjectName
); // use ProjectName as Prefix
2022 Insert(pPrj
,LIST_APPEND
);
2024 // get global dependencies
2025 FullByteStringListWrapper aProducts
= mpXmlBuildList
->getProducts();
2026 ByteString aDepType
= ByteString(DEP_MD_ALWAYS_STR
);
2027 if (mpXmlBuildList
->hasModuleDepType(aProducts
, aDepType
))
2028 pPrj
->HasHardDependencies( TRUE
);
2030 aDepType
= ByteString(DEP_MD_FORCE_STR
);
2031 if (mpXmlBuildList
->hasModuleDepType(aProducts
, aDepType
))
2033 pPrj
->HasHardDependencies( TRUE
);
2034 pPrj
->HasFixedDependencies( TRUE
);
2037 // modul dependencies
2038 ByteString sModulDepType
= ByteString();
2039 FullByteStringListWrapper aModulDeps
= mpXmlBuildList
->getModuleDependencies(aProducts
, sModulDepType
);
2040 ByteString
* pModulDep
= aModulDeps
.First();
2043 FullByteStringListWrapper aModulProducts
= mpXmlBuildList
->getModuleProducts(*pModulDep
);
2044 ByteString
*pModulePoduct
= aModulProducts
.First();
2045 while (pModulePoduct
)
2047 if (*pModulePoduct
== XML_ALL
)
2048 pPrj
->AddDependencies( *pModulDep
);
2050 pPrj
->AddDependencies( *pModulDep
, *pModulePoduct
);
2052 pModulePoduct
= aModulProducts
.Next();
2054 pModulDep
= aModulDeps
.Next();
2058 ByteString sJobType
= ByteString();
2059 ByteString sJobPlatforms
= ByteString();
2060 FullByteStringListWrapper aJobDirs
= mpXmlBuildList
->getJobDirectories(sJobType
, sJobPlatforms
); // all dirs
2061 ByteString
* pJobDir
= aJobDirs
.First();
2064 FullByteStringListWrapper aJobPlatforms
= mpXmlBuildList
->getJobPlatforms (*pJobDir
);
2065 ByteString
* pJobPlatform
= aJobPlatforms
.First();
2066 while (pJobPlatform
)
2068 ByteString sJobRestriction
= ByteString();
2069 FullByteStringListWrapper aJobReq
= mpXmlBuildList
->getJobBuildReqs (*pJobDir
, *pJobPlatform
);
2070 // nur ein Req pro Platform wird zur Zeit unterstützt
2071 // mehr geht wegen der Struktur zur Zeit nicht!
2072 // lese sie trotzdem kommasepariert ein, wenn nötig
2073 if (aJobReq
.Count() > 0)
2075 ByteString
* pRestriction
= aJobReq
.First();
2076 sJobRestriction
= ByteString (*pRestriction
);
2077 pRestriction
= aJobReq
.Next();
2078 while (pRestriction
)
2080 sJobRestriction
+= ByteString (",");
2081 sJobRestriction
+= ByteString (*pRestriction
);
2082 pRestriction
= aJobReq
.Next();
2086 FullByteStringListWrapper aJobTypes
= mpXmlBuildList
->getJobTypes (*pJobDir
);
2087 ByteString
* pJobType
= aJobTypes
.First();
2090 FullByteStringListWrapper aDirDependencies
= mpXmlBuildList
->getDirDependencies(*pJobDir
, *pJobType
, *pJobPlatform
);
2091 SByteStringList
*pDepList
= NULL
;
2092 if (aDirDependencies
.Count() > 0)
2094 pDepList
= new SByteStringList
;
2095 ByteString
* pDirDep
= aDirDependencies
.First();
2098 ByteString sFullDir
= sProjectName
;
2099 sFullDir
+= *pDirDep
;
2100 sFullDir
.SearchAndReplaceAll('/', '\\');
2101 *pDirDep
= sFullDir
;
2102 pDepList
->PutString(pDirDep
); // String wird übergeben
2103 aDirDependencies
.Remove(); // Zeiger aus alter Liste löschen
2104 pDirDep
= aDirDependencies
.First();
2107 // insert CommandData
2108 CommandData
* pCmdData
= new CommandData
;
2109 ByteString sRequiredPath
= sProjectName
;
2110 sRequiredPath
+= *pJobDir
;
2111 sRequiredPath
.SearchAndReplaceAll('/', '\\');
2112 pCmdData
->SetPath(sRequiredPath
);
2113 pCmdData
->SetCommandType( GetJobType(*pJobType
) );
2114 pCmdData
->SetCommandPara( ByteString() );
2115 pCmdData
->SetOSType( GetOSType(*pJobPlatform
) );
2116 ByteString sLogFileName
= sProjectName
;
2117 sLogFileName
+= ByteString::CreateFromInt64( pPrj
->Count() );
2118 pCmdData
->SetLogFile( sLogFileName
);
2119 pCmdData
->SetClientRestriction( sJobRestriction
);
2121 pCmdData
->SetDependencies( pDepList
);
2123 pPrj
->Insert ( pCmdData
, LIST_APPEND
);
2125 pJobType
= aJobTypes
.Next();
2128 pJobPlatform
= aJobPlatforms
.Next();
2131 pJobDir
= aJobDirs
.Next();
2133 pPrj
->ExtractDependencies();
2135 catch (XmlBuildListException
) {
2146 /*****************************************************************************/
2147 int Star::GetOSType ( ByteString
& aWhatOS
) {
2148 /*****************************************************************************/
2149 int nOSType
= OS_NONE
;
2150 if ( aWhatOS
== "all" )
2151 nOSType
= ( OS_WIN16
| OS_WIN32
| OS_OS2
| OS_UNX
| OS_MAC
);
2152 else if ( aWhatOS
== "w" || aWhatOS
== "wnt" )
2153 nOSType
= ( OS_WIN16
| OS_WIN32
);
2154 else if ( aWhatOS
== "p" )
2156 else if ( aWhatOS
== "u" || aWhatOS
== "unx" )
2158 else if ( aWhatOS
== "d" )
2160 else if ( aWhatOS
== "n" )
2162 else if ( aWhatOS
== "m" || aWhatOS
== "mac" )
2168 /*****************************************************************************/
2169 int Star::GetJobType ( ByteString
& JobType
) {
2170 /*****************************************************************************/
2171 int nCommandType
= 0;
2172 if ( JobType
== "nmake" || JobType
== "make")
2173 nCommandType
= COMMAND_NMAKE
;
2174 else if ( JobType
== "get" )
2175 nCommandType
= COMMAND_GET
;
2177 ULONG nOffset
= JobType
.Copy( 3 ).ToInt32();
2178 nCommandType
= COMMAND_USER_START
+ nOffset
- 1;
2180 return nCommandType
;
2183 /*****************************************************************************/
2184 void Star::PutPrjIntoStream (SByteStringList
* pPrjNameList
, SvStream
* pStream
)
2185 /*****************************************************************************/
2188 *pStream
<< sal_False
; // not full Star / only some Projects
2190 ULONG nCount_l
= pPrjNameList
->Count();
2191 *pStream
<< nCount_l
;
2192 ByteString
* pStr
= pPrjNameList
->First();
2194 Prj
* pPrj
= GetPrj (*pStr
);
2196 pStr
= pPrjNameList
->Next();
2201 /*****************************************************************************/
2202 Star
& Star::operator>> ( SvStream
& rStream
)
2203 /*****************************************************************************/
2206 rStream
<< sal_True
; // full Star
2207 rStream
<< nStarMode
;
2210 rStream
<< sal_True
;
2211 *pDepMode
>> rStream
;
2214 rStream
<< sal_False
;
2216 ULONG nCount_l
= Count();
2217 rStream
<< nCount_l
;
2218 Prj
* pPrj
= First();
2228 /*****************************************************************************/
2229 Star
& Star::operator<< ( SvStream
& rStream
)
2230 /*****************************************************************************/
2234 rStream
>> bFullList
;
2237 rStream
>> nStarMode
;
2239 rStream
>> bDepMode
;
2241 pDepMode
->CleanUp();
2245 pDepMode
= new SByteStringList();
2246 *pDepMode
<< rStream
;
2253 rStream
>> nCount_l
;
2254 for ( USHORT i
= 0; i
< nCount_l
; i
++ ) {
2255 Prj
* pPrj
= new Prj();
2257 pPrj
->SetMode(pDepMode
);
2258 if (HasProject (pPrj
->GetProjectName())) {
2259 Prj
* pTmpPrj
= GetPrj( pPrj
->GetProjectName() );
2260 Replace (pPrj
, pTmpPrj
);
2264 Insert (pPrj
, LIST_APPEND
);
2277 /*****************************************************************************/
2278 StarWriter::StarWriter( XmlBuildList
* pXmlBuildListObj
, String aFileName
, BOOL bReadComments
, USHORT nMode
)
2279 /*****************************************************************************/
2280 : Star (pXmlBuildListObj
)
2282 sFileName
= aFileName
;
2283 Read ( aFileName
, bReadComments
, nMode
);
2286 /*****************************************************************************/
2287 StarWriter::StarWriter( XmlBuildList
* pXmlBuildListObj
, SolarFileList
*pSolarFiles
, BOOL bReadComments
)
2288 /*****************************************************************************/
2289 : Star (pXmlBuildListObj
)
2291 Read( pSolarFiles
, bReadComments
);
2294 /*****************************************************************************/
2295 StarWriter::StarWriter( XmlBuildList
* pXmlBuildListObj
, GenericInformationList
*pStandLst
, ByteString
&rVersion
,
2296 ByteString
&rMinor
, BOOL bReadComments
, BOOL bLocal
, const char *pSourceRoot
)
2297 /*****************************************************************************/
2298 : Star (pXmlBuildListObj
)
2300 ByteString
sPath( rVersion
);
2302 sSourceRoot
= String::CreateFromAscii( pSourceRoot
);
2305 sPath
+= "/settings/UNXSOLARLIST";
2307 sPath
+= "/settings/SOLARLIST";
2309 GenericInformation
*pInfo_l
= pStandLst
->GetInfo( sPath
, TRUE
);
2311 if( pInfo_l
&& pInfo_l
->GetValue().Len()) {
2312 ByteString
sFile( pInfo_l
->GetValue());
2314 IniManager aIniManager
;
2315 aIniManager
.ToLocal( sFile
);
2317 String
sFileName_l( sFile
, RTL_TEXTENCODING_ASCII_US
);
2318 nStarMode
= STAR_MODE_SINGLE_PARSE
;
2319 Read( sFileName_l
, bReadComments
);
2322 SolarFileList
*pFileList
= new SolarFileList();
2327 GenericInformation
*pInfo_k
= pStandLst
->GetInfo( sPath
, TRUE
);
2328 if ( pInfo_k
&& pInfo_k
->GetSubList()) {
2329 GenericInformationList
*pDrives
= pInfo_k
->GetSubList();
2330 for ( ULONG i
= 0; i
< pDrives
->Count(); i
++ ) {
2331 GenericInformation
*pDrive
= pDrives
->GetObject( i
);
2335 if ( sSourceRoot
.Len()) {
2336 aEntry
= DirEntry( sSourceRoot
);
2341 sPath
= "UnixVolume";
2342 GenericInformation
*pUnixVolume
= pDrive
->GetSubInfo( sPath
);
2343 if ( pUnixVolume
) {
2344 String
sRoot( pUnixVolume
->GetValue(), RTL_TEXTENCODING_ASCII_US
);
2345 aEntry
= DirEntry( sRoot
);
2350 String
sRoot( *pDrive
, RTL_TEXTENCODING_ASCII_US
);
2351 sRoot
+= String::CreateFromAscii( "\\" );
2352 aEntry
= DirEntry( sRoot
);
2357 GenericInformation
*pProjectsKey
= pDrive
->GetSubInfo( sPath
, TRUE
);
2358 if ( pProjectsKey
) {
2359 if ( !sSourceRoot
.Len()) {
2361 sPath
+= "/settings/PATH";
2362 GenericInformation
*pPath
= pStandLst
->GetInfo( sPath
, TRUE
);
2364 ByteString
sAddPath( pPath
->GetValue());
2366 sAddPath
.SearchAndReplaceAll( "\\", "/" );
2368 sAddPath
.SearchAndReplaceAll( "/", "\\" );
2370 //If Minor has been set add it to path
2371 if (rMinor
.Len()>0) {
2375 String
ssAddPath( sAddPath
, RTL_TEXTENCODING_ASCII_US
);
2377 aEntry
+= DirEntry( ssAddPath
);
2380 sSourceRoot
= aEntry
.GetFull();
2381 GenericInformationList
*pProjects
= pProjectsKey
->GetSubList();
2383 String
sPrjDir( String::CreateFromAscii( "prj" ));
2384 String
sSolarFile( String::CreateFromAscii( "build.lst" ));
2386 GenericInformation
* pProject
= pProjects
->First();
2388 ByteString
sProject( *pProject
);
2389 String
ssProject( sProject
, RTL_TEXTENCODING_ASCII_US
);
2391 DirEntry
aPrjEntry( aEntry
);
2393 ByteString
aDirStr ("Directory");
2394 GenericInformation
* pDir
= pProject
->GetSubInfo (aDirStr
);
2396 ByteString aDir
= pDir
->GetValue();
2397 aPrjEntry
= aEntry
.GetPath() + DirEntry(aDir
);
2400 aPrjEntry
+= DirEntry( ssProject
);
2401 aPrjEntry
+= DirEntry( sPrjDir
);
2402 aPrjEntry
+= DirEntry( sSolarFile
);
2404 pFileList
->Insert( new String( aPrjEntry
.GetFull()), LIST_APPEND
);
2406 ByteString
sFile( aPrjEntry
.GetFull(), RTL_TEXTENCODING_ASCII_US
);
2407 fprintf( stdout
, "%s\n", sFile
.GetBuffer());
2408 pProject
= pProjects
->Next();
2416 Read( pFileList
, bReadComments
);
2420 /*****************************************************************************/
2421 void StarWriter::CleanUp()
2422 /*****************************************************************************/
2427 /*****************************************************************************/
2428 USHORT
StarWriter::Read( String aFileName
, BOOL bReadComments
, USHORT nMode
)
2429 /*****************************************************************************/
2431 sFileName
= aFileName
;
2436 aFileList
.Insert( new String( aFileName
));
2438 DirEntry
aEntry( aFileName
);
2440 aEntry
= aEntry
.GetPath().GetPath().GetPath();
2441 sSourceRoot
= aEntry
.GetFull();
2443 while( aFileList
.Count()) {
2444 String ssFileName
= *aFileList
.GetObject(( ULONG
) 0 );
2445 ByteString
sFileName_l(ssFileName
, RTL_TEXTENCODING_ASCII_US
);
2446 StarFile
*pFile
= new StarFile( ssFileName
);
2447 if ( pFile
->Exists()) {
2448 if (sFileName_l
.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT
) && ssFileName
.EqualsAscii(XML_EXT
, sFileName_l
.Len() - RTL_CONSTASCII_LENGTH(XML_EXT
), RTL_CONSTASCII_LENGTH(XML_EXT
)))
2450 ReadXmlBuildList(sFileName_l
);
2452 SimpleConfig
aSolarConfig( ssFileName
);
2453 while (( aString
= aSolarConfig
.GetCleanedNextLine( bReadComments
)) != "" )
2454 InsertTokenLine ( aString
);
2459 aLoadedFilesList
.Insert( pFile
, LIST_APPEND
);
2461 delete aFileList
.Remove(( ULONG
) 0 );
2463 // resolve all dependencies recursive
2466 // Die gefundenen Abhaengigkeiten rekursiv aufloesen
2471 /*****************************************************************************/
2472 USHORT
StarWriter::Read( SolarFileList
*pSolarFiles
, BOOL bReadComments
)
2473 /*****************************************************************************/
2475 nStarMode
= STAR_MODE_MULTIPLE_PARSE
;
2477 // this ctor is used by StarBuilder to get the information for the whole workspace
2478 while( pSolarFiles
->Count()) {
2480 String ssFileName
= *pSolarFiles
->GetObject(( ULONG
) 0 );
2481 ByteString
sFileName_l(ssFileName
, RTL_TEXTENCODING_ASCII_US
);
2482 StarFile
*pFile
= new StarFile( ssFileName
);
2483 if ( pFile
->Exists()) {
2484 if (sFileName_l
.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT
) && ssFileName
.EqualsAscii(XML_EXT
, sFileName_l
.Len() - RTL_CONSTASCII_LENGTH(XML_EXT
), RTL_CONSTASCII_LENGTH(XML_EXT
)))
2486 ReadXmlBuildList(sFileName_l
);
2490 SimpleConfig
aSolarConfig( ssFileName
);
2491 while (( aString
= aSolarConfig
.GetCleanedNextLine( bReadComments
)) != "" )
2492 InsertTokenLine ( aString
);
2497 aLoadedFilesList
.Insert( pFile
, LIST_APPEND
);
2499 delete pSolarFiles
->Remove(( ULONG
) 0 );
2507 /*****************************************************************************/
2508 USHORT
StarWriter::WritePrj( Prj
*pPrj
, SvFileStream
& rStream
)
2509 /*****************************************************************************/
2511 ByteString aDataString
;
2512 ByteString
aTab('\t');
2513 ByteString
aSpace(' ');
2514 ByteString
aEmptyString("");
2515 SByteStringList
* pCmdDepList
;
2516 SByteStringList
* pPrjDepList
;
2518 CommandData
* pCmdData
= NULL
;
2519 if ( pPrj
->Count() > 0 )
2521 pCmdData
= pPrj
->First();
2522 if ( (pPrjDepList
= pPrj
->GetDependencies( FALSE
)) )
2524 aDataString
= pPrj
->GetPreFix();
2525 aDataString
+= aTab
;
2526 aDataString
+= pPrj
->GetProjectName();
2527 aDataString
+= aTab
;
2528 if ( pPrj
->HasFixedDependencies())
2529 aDataString
+= ByteString(":::");
2530 else if ( pPrj
->HasHardDependencies())
2531 aDataString
+= ByteString("::");
2533 aDataString
+= ByteString(":");
2534 aDataString
+= aTab
;
2535 for ( USHORT i
= 0; i
< pPrjDepList
->Count(); i
++ ) {
2536 aDataString
+= *pPrjDepList
->GetObject( i
);
2537 aDataString
+= aSpace
;
2539 aDataString
+= "NULL";
2541 rStream
.WriteLine( aDataString
);
2543 pCmdData
= pPrj
->Next();
2548 if (( aDataString
= pCmdData
->GetComment()) == aEmptyString
)
2550 aDataString
= pPrj
->GetPreFix();
2551 aDataString
+= aTab
;
2553 aDataString
+= pCmdData
->GetPath();
2554 aDataString
+= aTab
;
2555 USHORT nPathLen
= pCmdData
->GetPath().Len();
2556 if ( nPathLen
< 40 )
2557 for ( int i
= 0; i
< 9 - pCmdData
->GetPath().Len() / 4 ; i
++ )
2558 aDataString
+= aTab
;
2560 for ( int i
= 0; i
< 12 - pCmdData
->GetPath().Len() / 4 ; i
++ )
2561 aDataString
+= aTab
;
2562 aDataString
+= pCmdData
->GetCommandTypeString();
2563 aDataString
+= aTab
;
2564 if ( pCmdData
->GetCommandType() == COMMAND_GET
)
2565 aDataString
+= aTab
;
2566 if ( pCmdData
->GetCommandPara() == aEmptyString
)
2567 aDataString
+= ByteString("-");
2569 aDataString
+= pCmdData
->GetCommandPara();
2570 aDataString
+= aTab
;
2571 aDataString
+= pCmdData
->GetOSTypeString();
2572 if ( pCmdData
->GetClientRestriction().Len()) {
2573 aDataString
+= ByteString( "," );
2574 aDataString
+= pCmdData
->GetClientRestriction();
2576 aDataString
+= aTab
;
2577 aDataString
+= pCmdData
->GetLogFile();
2578 aDataString
+= aSpace
;
2580 pCmdDepList
= pCmdData
->GetDependencies();
2582 for ( USHORT i
= 0; i
< pCmdDepList
->Count(); i
++ ) {
2583 aDataString
+= *pCmdDepList
->GetObject( i
);
2584 aDataString
+= aSpace
;
2586 aDataString
+= "NULL";
2589 rStream
.WriteLine( aDataString
);
2591 pCmdData
= pPrj
->Next();
2592 } while ( pCmdData
);
2598 /*****************************************************************************/
2599 USHORT
StarWriter::Write( String aFileName
)
2600 /*****************************************************************************/
2602 sFileName
= aFileName
;
2604 FileStat::SetReadOnlyFlag( DirEntry( aFileName
), FALSE
);
2606 SvFileStream aFileStream
;
2608 aFileStream
.Open( aFileName
, STREAM_WRITE
| STREAM_TRUNC
);
2609 if ( !aFileStream
.IsOpen() && aFileIOErrorHdl
.IsSet()) {
2610 String
sError( String::CreateFromAscii( "Error: Unable to open \"" ));
2611 sError
+= aFileName
;
2612 sError
+= String::CreateFromAscii( "for writing!" );
2613 aFileIOErrorHdl
.Call( &sError
);
2618 Prj
* pPrj
= First();
2621 WritePrj( pPrj
, aFileStream
);
2626 aFileStream
.Close();
2631 /*****************************************************************************/
2632 USHORT
StarWriter::WriteMultiple( String rSourceRoot
)
2633 /*****************************************************************************/
2635 sSourceRoot
= rSourceRoot
;
2639 String
sPrjDir( String::CreateFromAscii( "prj" ));
2640 String
sSolarFile( String::CreateFromAscii( "build.lst" ));
2642 Prj
* pPrj
= First();
2645 String
sName( pPrj
->GetProjectName(), RTL_TEXTENCODING_ASCII_US
);
2647 DirEntry
aEntry( rSourceRoot
);
2648 aEntry
+= DirEntry( sName
);
2649 aEntry
+= DirEntry( sPrjDir
);
2650 aEntry
+= DirEntry( sSolarFile
);
2652 FileStat::SetReadOnlyFlag( aEntry
, FALSE
);
2654 SvFileStream aFileStream
;
2655 aFileStream
.Open( aEntry
.GetFull(), STREAM_WRITE
| STREAM_TRUNC
);
2657 if ( !aFileStream
.IsOpen() && aFileIOErrorHdl
.IsSet()) {
2658 String
sError( String::CreateFromAscii( "Error: Unable to open \"" ));
2659 sError
+= aEntry
.GetFull();
2660 sError
+= String::CreateFromAscii( "for writing!" );
2661 aFileIOErrorHdl
.Call( &sError
);
2664 WritePrj( pPrj
, aFileStream
);
2666 aFileStream
.Close();
2675 /*****************************************************************************/
2676 void StarWriter::InsertTokenLine ( ByteString
& rString
)
2677 /*****************************************************************************/
2680 ByteString aWhat
, aWhatOS
,
2681 sClientRestriction
, aLogFileName
, aProjectName
, aPrefix
, aCommandPara
;
2682 static ByteString aDirName
;
2683 BOOL bPrjDep
= FALSE
;
2684 BOOL bHardDep
= FALSE
;
2685 BOOL bFixedDep
= FALSE
;
2686 int nCommandType
=0, nOSType
=0;
2687 CommandData
* pCmdData
;
2688 SByteStringList
*pDepList2
= NULL
;
2691 ByteString aEmptyString
;
2692 ByteString aToken
= rString
.GetToken( 0, '\t' );
2693 ByteString aCommentString
;
2695 const char* yytext
= aToken
.GetBuffer();
2697 while ( !( aToken
== aEmptyString
) )
2702 if ( rString
.Search( "#" ) == 0 )
2705 aCommentString
= rString
;
2706 rString
= aEmptyString
;
2708 aDirName
= "null_entry" ; //comments at begin of file
2718 if ( !strcmp( yytext
, ":" ))
2725 else if ( !strcmp( yytext
, "::" ))
2732 else if ( !strcmp( yytext
, ":::" ))
2746 nCommandType
= GetJobType(aWhat
);
2755 aCommandPara
= ByteString();
2758 aCommandPara
= aWhat
;
2765 if ( aWhatOS
.GetTokenCount( ',' ) > 1 ) {
2766 sClientRestriction
= aWhatOS
.Copy( aWhatOS
.GetToken( 0, ',' ).Len() + 1 );
2767 aWhatOS
= aWhatOS
.GetToken( 0, ',' );
2769 nOSType
= GetOSType (aWhatOS
);
2775 aLogFileName
= yytext
;
2781 ByteString aItem
= yytext
;
2782 if ( aItem
== "NULL" )
2789 // ggfs. Dependency liste anlegen und ergaenzen
2791 pDepList2
= new SByteStringList
;
2792 pDepList2
->PutString( new ByteString( aItem
));
2797 ByteString aItem
= yytext
;
2798 if ( aItem
== "NULL" )
2807 BOOL bHasModes
= FALSE
;
2808 if (aItem
.Search(":") != STRING_NOTFOUND
)
2810 sMode
= aItem
.GetToken ( 0, ':');
2811 aItem
= aItem
.GetToken ( 1, ':');
2815 aProjectName
= aDirName
.GetToken ( 0, 0x5c);
2816 if ( HasProject( aProjectName
))
2818 pPrj
= GetPrj( aProjectName
);
2819 // Projekt exist. schon, neue Eintraege anhaengen
2823 // neues Project anlegen
2824 pPrj
= new Prj ( aProjectName
);
2825 pPrj
->SetPreFix( aPrefix
);
2826 Insert(pPrj
,LIST_APPEND
);
2829 pPrj
->AddDependencies( aItem
, sMode
);
2831 pPrj
->AddDependencies( aItem
);
2832 pPrj
->HasHardDependencies( bHardDep
);
2833 pPrj
->HasFixedDependencies( bFixedDep
);
2836 if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) {
2837 String sItem( aItem, RTL_TEXTENCODING_ASCII_US );
2838 InsertSolarList( sItem );
2846 /* Wenn dieses Project noch nicht vertreten ist, in die Liste
2847 der Solar-Projekte einfuegen */
2850 aProjectName
= aDirName
.GetToken ( 0, 0x5c);
2851 if ( HasProject( aProjectName
))
2853 pPrj
= GetPrj( aProjectName
);
2854 // Projekt exist. schon, neue Eintraege anhaengen
2858 // neues Project anlegen
2859 pPrj
= new Prj ( aProjectName
);
2860 pPrj
->SetPreFix( aPrefix
);
2861 Insert(pPrj
,LIST_APPEND
);
2864 pCmdData
= new CommandData
;
2865 pCmdData
->SetPath( aDirName
);
2866 pCmdData
->SetCommandType( nCommandType
);
2867 pCmdData
->SetCommandPara( aCommandPara
);
2868 pCmdData
->SetOSType( nOSType
);
2869 pCmdData
->SetLogFile( aLogFileName
);
2870 pCmdData
->SetComment( aCommentString
);
2871 pCmdData
->SetClientRestriction( sClientRestriction
);
2873 pCmdData
->SetDependencies( pDepList2
);
2875 pPrj
->Insert ( pCmdData
, LIST_APPEND
);
2880 rString
.Erase(0, aToken
.Len()+1);
2881 aToken
= rString
.GetToken( 0, '\t' );
2882 yytext
= aToken
.GetBuffer();
2885 // und wer raeumt die depLst wieder ab ?
2886 // macht CommandData selber
2889 /*****************************************************************************/
2890 BOOL
StarWriter::InsertProject ( Prj
* /*pNewPrj*/ )
2891 /*****************************************************************************/
2896 /*****************************************************************************/
2897 Prj
* StarWriter::RemoveProject ( ByteString aProjectName
)
2898 /*****************************************************************************/
2900 ULONG nCount_l
= Count();
2902 Prj
* pPrjFound
= NULL
;
2903 SByteStringList
* pPrjDeps
;
2905 for ( USHORT i
= 0; i
< nCount_l
; i
++ )
2907 pPrj
= GetObject( i
);
2908 if ( pPrj
->GetProjectName() == aProjectName
)
2912 pPrjDeps
= pPrj
->GetDependencies( FALSE
);
2915 ByteString
* pString
;
2916 ULONG nPrjDepsCount
= pPrjDeps
->Count();
2917 for ( ULONG j
= nPrjDepsCount
; j
> 0; j
-- )
2919 pString
= pPrjDeps
->GetObject( j
- 1 );
2920 if ( pString
->GetToken( 0, '.') == aProjectName
)
2921 pPrjDeps
->Remove( pString
);
2927 Remove( pPrjFound
);
2936 /*****************************************************************************/
2937 StarFile::StarFile( const String
&rFile
)
2938 /*****************************************************************************/
2939 : aFileName( rFile
)
2941 DirEntry
aEntry( aFileName
);
2942 if ( aEntry
.Exists()) {
2944 FileStat
aStat( aEntry
);
2945 aDate
= aStat
.DateModified();
2946 aTime
= aStat
.TimeModified();
2947 aDateCreated
= aStat
.DateCreated();
2948 aTimeCreated
= aStat
.TimeCreated();
2954 /*****************************************************************************/
2955 BOOL
StarFile::NeedsUpdate()
2956 /*****************************************************************************/
2958 DirEntry
aEntry( aFileName
);
2959 if ( aEntry
.Exists()) {
2964 FileStat
aStat( aEntry
);
2965 if (( aStat
.DateModified() != aDate
) || ( aStat
.TimeModified() != aTime
)
2966 || ( aStat
.DateCreated() != aDateCreated
) || ( aStat
.TimeCreated() != aTimeCreated
))