ajack 2004/03/28 10:58:05 Modified: python/gump/model project.py ant.py property.py rawmodel.py workspace.py python/gump/test/resources/full1 workspace.xml python/gump/test model.py Log: Retry (had network woes). Revision Changes Path 1.69 +29 -5 gump/python/gump/model/project.py Index: project.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/project.py,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- project.py 20 Mar 2004 18:37:40 -0000 1.68 +++ project.py 28 Mar 2004 18:58:05 -0000 1.69 @@ -660,6 +660,11 @@ # # Get properties # + sysproperties=self.getAntSysProperties() + + # + # Get properties + # jvmargs=self.getJVMArgs() # @@ -668,15 +673,23 @@ cmd=Cmd(javaCommand,'build_'+self.getModule().getName()+'_'+self.getName(),\ basedir,{'CLASSPATH':classpath}) + # These are workspace + project system properties + cmd.addNamedParameters(sysproperties) + + + # :NOTE: Commented out since <sysproperty was implemented. + # # Set this as a system property. Setting it here helps JDK1.4+ # AWT implementations cope w/o an X11 server running (e.g. on # Linux) - cmd.addPrefixedParameter('-D','java.awt.headless','true','=') + # cmd.addPrefixedParameter('-D','java.awt.headless','true','=') + + # :NOTE: Commented out since <sysproperty was implemented. # # This helps ant maintain VM information for sub-VMs it launches. # - cmd.addPrefixedParameter('-D','build.clonevm','true','=') + # cmd.addPrefixedParameter('-D','build.clonevm','true','=') # # Add BOOTCLASSPATH @@ -699,14 +712,16 @@ # # This sets the *defaults*, a workspace could override them. - # - cmd.addPrefixedParameter('-D','build.sysclasspath','only','=') + # + # :NOTE: Commented out since <property on workspace works. + # cmd.addPrefixedParameter('-D','build.sysclasspath','only','=') mergeFile=self.getWorkspace().getMergeFile() if mergeFile: cmd.addPrefixedParameter('-D','gump.merge',str(mergeFile),'=') - # These are module level plus project level + # These are from the project and/or workspace + # These are 'normal' properties. cmd.addNamedParameters(properties) # Pass the buildfile @@ -870,9 +885,18 @@ properties.addPrefixedNamedParameter('-D',property.name,property.value,'=') return properties + def getAntSysProperties(self): + """Get sysproperties for a project""" + properties=Parameters() + for property in self.getWorkspace().getSysProperties()+self.getAnt().getSysProperties(): + properties.addPrefixedNamedParameter('-D',property.name,property.value,'=') + return properties + # The propertiesFile parameter is primarily for testing. def generateMavenProperties(self,propertiesFile=None): """Set properties/overrides for a Maven project""" + + #:TODO: Does Maven have the idea of system properties? # # Where to put this: 1.20 +8 -0 gump/python/gump/model/ant.py Index: ant.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/ant.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ant.py 19 Mar 2004 18:19:18 -0000 1.19 +++ ant.py 28 Mar 2004 18:58:05 -0000 1.20 @@ -59,6 +59,14 @@ for property in self.xml.property: self.expandProperty(property,project,workspace) self.importProperty(property) + + # + # convert Ant sysproperty elements which reference a project + # into dependencies + # + for sysproperty in self.xml.sysproperty: + self.expandProperty(sysproperty,project,workspace) + self.importSystemProperty(sysproperty) # # Expands 1.15 +58 -9 gump/python/gump/model/property.py Index: property.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/property.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- property.py 16 Mar 2004 19:50:15 -0000 1.14 +++ property.py 28 Mar 2004 18:58:05 -0000 1.15 @@ -127,9 +127,12 @@ """ Display the property """ output.write(getIndent(indent)+'Property: ' + self.getName() + ' ' + self.getValue()+ '\n') -class PropertyContainer(object): +class PropertySet(Ownable): """ Can hold properties """ - def __init__(self,properties=None): + def __init__(self,owner,properties=None): + + Ownable.__init__(self,owner) + self.properties={} # Any starting properties.. @@ -154,17 +157,11 @@ def getProperties(self): return self.properties.values() - - def importProperties(self,xml): - if xml.property: - for xmlproperty in xml.property: - self.importProperty(xmlproperty) def importProperty(self,xmlproperty): self.addProperty(Property(xmlproperty,self)) - def completeProperties(self,workspace=None): - if not workspace: workspace=self + def completeProperties(self,workspace): for property in self.getProperties(): property.complete(self,workspace) @@ -172,4 +169,56 @@ """ Display the properties """ for property in self.getProperties(): property.dump(indent+1,output) + + +class PropertyContainer: + """ + + Can hold properties + + Note: This depends upon the 'user' class being 'Ownable'. + + """ + def __init__(self,properties=None,sysproperties=None): + self.properties=PropertySet(self.getOwner, properties) + self.sysproperties=PropertySet(self.getOwner(), sysproperties) + + def hasProperties(self): + if self.properties: return 1 + return 0 + + def getProperties(self): + return self.properties.getProperties() + + def hasSysProperties(self): + if self.sysproperties: return 1 + return 0 + + def getSysProperties(self): + return self.sysproperties.getProperties() + + def importProperty(self,xmlproperty): + self.properties.importProperty(xmlproperty) + + def importSysProperty(self,xmlproperty): + self.sysproperties.importProperty(xmlproperty) + + def importProperties(self,xml): + if xml.property: + for xmlproperty in xml.property: + self.properties.importProperty(xmlproperty) + + if xml.sysproperty: + for xmlproperty in xml.sysproperty: + self.sysproperties.importProperty(xmlproperty) + + def completeProperties(self,workspace=None): + if not workspace: workspace=self + self.properties.completeProperties(workspace) + self.sysproperties.completeProperties(workspace) + + def dump(self, indent=0, output=sys.stdout): + """ Display the properties """ + self.properties.dump(self,indent,output) + self.sysproperties.dump(self,indent,output) 1.19 +5 -1 gump/python/gump/model/rawmodel.py Index: rawmodel.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/rawmodel.py,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- rawmodel.py 18 Mar 2004 23:24:55 -0000 1.18 +++ rawmodel.py 28 Mar 2004 18:58:05 -0000 1.19 @@ -72,6 +72,7 @@ def init(self): self.property=Multiple(XMLProperty) + self.sysproperty=Multiple(XMLProperty) self.project=Multiple(XMLProject) self.module=Multiple(XMLModule) self.repository=Multiple(XMLRepository) @@ -172,12 +173,14 @@ def init(self): self.arg=Multiple(GumpXMLModelObject) self.property=Multiple(XMLProperty) + self.sysproperty=Multiple(XMLProperty) # represents an <ant/> element class XMLAnt(GumpXMLModelObject): def init(self): self.depend=Multiple(XMLDepend) self.property=Multiple(XMLProperty) + self.sysproperty=Multiple(XMLProperty) self.jvmarg=Multiple(GumpXMLModelObject) # represents a <maven/> element @@ -185,6 +188,7 @@ def init(self): self.depend=Multiple(XMLDepend) self.property=Multiple(XMLProperty) + self.sysproperty=Multiple(XMLProperty) self.jvmarg=Multiple(GumpXMLModelObject) # represents a <nag/> element in the workspace @@ -205,7 +209,7 @@ def init(self): self.description=Multiple(GumpXMLModelObject) -# represents a <property/> element +# represents a <property/> or <sysproperty/> element class XMLProperty(GumpXMLModelObject): def getName(self): 1.38 +1 -3 gump/python/gump/model/workspace.py Index: workspace.py =================================================================== RCS file: /home/cvs/gump/python/gump/model/workspace.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- workspace.py 20 Mar 2004 18:37:40 -0000 1.37 +++ workspace.py 28 Mar 2004 18:58:05 -0000 1.38 @@ -71,9 +71,7 @@ # PropertyContainer.importProperties(self,self.xml) - - - + # self.startdatetime=time.strftime(setting.datetimeformat, \ time.localtime()) 1.6 +1 -0 gump/python/gump/test/resources/full1/workspace.xml Index: workspace.xml =================================================================== RCS file: /home/cvs/gump/python/gump/test/resources/full1/workspace.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- workspace.xml 18 Mar 2004 23:24:55 -0000 1.5 +++ workspace.xml 28 Mar 2004 18:58:05 -0000 1.6 @@ -7,6 +7,7 @@ sync="rsync -r -a --delete" version="0.3"> <property name="build.sysclasspath" value="only"/> + <sysproperty name="build.clonevm" value="true"/> <profile href="profile.xml"/> 1.18 +17 -5 gump/python/gump/test/model.py Index: model.py =================================================================== RCS file: /home/cvs/gump/python/gump/test/model.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- model.py 19 Mar 2004 18:19:18 -0000 1.17 +++ model.py 28 Mar 2004 18:58:05 -0000 1.18 @@ -266,15 +266,27 @@ def testProperties(self): self.assertTrue('Has <ant <property', self.project2.getAnt().hasProperties()) - + self.assertTrue('Has <workspace <property', self.workspace.hasProperties()) + self.assertTrue('Has <workspace <sysproperty', self.workspace.hasSysProperties()) + + #print 'Normal Properties:' #for property in self.project2.getAnt().getProperties(): # print `property` + + #print 'Workspace Normal Properties:' + #for property in self.workspace.getProperties(): + # print `property` + + #print 'Workspace System Properties:' + #for sysproperty in self.workspace.getSysProperties(): + # print `sysproperty` commandLine=self.project2.getBuildCommand().formatCommandLine() self.assertInString('Need ant.home', 'ant.home', commandLine) self.assertInString('Need project1.jar', 'project1.jar', commandLine) - # print commandLine + #print 'Command Line:' + #print commandLine def testServers(self): self.assertNotEmpty('Some servers ought be found', self.workspace.getServers())
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]