Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 7fa6505cc10a12d6970ec132ea1c04660eb52fb8 (plain) (tree)
1
2
3
4
5
6
7
                                      



                                                
 
                                                                                 









                                  
                





                                  
                
 





                                                     
                
 





                                                                     
                
 




                                            







                                             


                                                 








                                             
                                       
 


                                         
                                          
              


                                            

           


                                           

                                
                                                         
                                          
                                                                                 




                                                  


                                    

                                             
                                                                 
                                                      
                                                                                            


                                   



                             
                                   




                                       




                                     
           

                                                                                   


                            

           
                                



                                                                               





                                                                                                                        
                                                                 



                                                                                   
         
                      
                         



                                                      
           
 

           
                                   



                                                                               





                                                                                                                        
                                                                 
           
                           
                        
 
                                                                                   


                       



                                                      
           
 


                                                                                                                            


                                 
                                         
 

                                
                                                                          












                                  

                                
                                                                                    








                              

                                
                                                                             



                                                                         
                            
           

                

                                
                                                                   




                               

                                
                                                                          







                               

                                
                                                                                 








                              


                                                                                                                        
 

                               





                                   
                





                                   
                


                                                                                                                                                                                        
                                                                                          
                                                                                      



                                                                                            
                                                                                       
                                                                                     
                                     
       
                                                




                                                            
                
                                          




                                              


           
                                         

                       
                                  
                  
                                                                
                                                
                                                                 
                

                                    


                                                                                                                        
                     
                                          


                               



                                                           


           
                                            

                          
                                  
                  
                                                                
                                                
                                                                 
                

                                    
                                                                                                                        
           
                     
                                          


                               



                                                           


           



                              
 
                              


                                                            
           


                               
 
 
                                             


                                                                 








                                                      

                                          
                                  








                                                     


           


                             
                              


                                                            
           


                               
                                      


                                         
                                  
              
                                               


                                                  








                                                         








                                                     
          
                                                                                                                                                             

                                          

                                          
 
                                     

           
         
                       

                       
                                        
        

                             


                                                             


                                                   
 








                                                    
























                                                     
           
 

           


                        
                                  



                              


                                        
         

                                   
        


                                                                        

                                                          
 



                      

                                                                            


                                                                                     

           



                         
 


                                                                                     



                                                                                      
                                    
              
                                          
                              
                
         
                                                                                                                                    
                           


                                                   
                                                                 



                                                  
                                                                  

             

                               







                                                                                                            

                                       
                                  

                                         

                                                                           


                                                                          
 





                                                                     
      


                                                                                                     
     

                              
                                                                                  
 
                                                                     


                                                                                   
        




                                                                        
       
                                   


                                       
                


                                                                                                                             


                                                               
                                                                 













                                                                        





                                                               
        
           




                                                                 

                               
                                                                                                     
                                         


                                  





                                        
             
                    
                                                                            

                                          


                                         


                                                    


                                                 


                                                            
                                                                                                    


                                        
                              

                                   


                                                                                                   
                                                           


                                             
                                          

                                                                  

                         
                                                          


                                                    

                                                                           


                                          
 


                                        


                                                  
                                                                              


                                 
                                                         

                                                                                                                                                            
                                  

                                                                                                                                      
           
           






                                                                                                     







                                                                        
 










                                                                         
                                                                                       






















                                                                                                 
                                                     
















                                                                                              


           

                                                                  
     




                                                                                              

                                                                                             



                                  

                                            



                                 


                                           


               
                                                                                                                                                                                                                        
                                  


                                  
        



                                                                                                                      


                                               


                                                                                                                                   


                                                                

                                    
                                                                                      


                                                                          
                                                                             
                                                                                                
                                                                    

                                       
 
 
                                                      
                                                                                                                



                           


                               
           
 
        
                                                                     
                                                                    


                                                                      















                                                                                 
 
        

                                                                         
       
                                                       
 


                                 


                                                



























                                                                                                                                                                  
                                                                  


                                                                                   
     


                            
 

                             
                                         


                                        
                                                                       
                                                                 

                               
                                                    
           








                         

                

                               
                                                           
           








                          

                

                               
                                                           
           








                         

                

                               
                                                                  
           








                          

                

                               
                                                                 
           








                         

                

                               
                                                                     
           








                          

                


                                                            






                                                                                                                               

                                          

                                                                      

       


                                        
                              
           
                                                                                    

                                     
                                                                                                                                   





                                    
                





                                    
                





                                    
                






























                                                                     
                                          
        

                                                                      
       


                                   
                              
           
                                                                     
                                     
 





                                             
                





                                              
                





                                               
                









                                                             



                                             
           





                                                 
           



                                 
        
                                                           
                                                                   

                                                                            
       
                                                                     
                                             
























                                                                                             
 



                                        


                                        
                
                                                                                                   
                                                          



                                                          
 


                                             


                                                                 
                                                                                                          







                                                                  
 
                                                              

                        
                                                            


                               
                  

                                                                   
                                       





                                      

                                        


                                      



                 



                       


                                                       





                                            
                                                        


                                    

                                                  


                                 
                                              


                             
           


                               





                                   





                                                      


           
         
                       
                                 
                      
                                                 

                             
                                          
        
                                                                                                                                         
                                                                                                                                     
             
                                                                                                                                      


                                                                                               
       


                                            
                                                                                                                              
                                                                                       
                                                                  
 

                                    
                                                                                                                     

                                                                                     
                
        

                                                                                                    
                                                                                                                                    
           
                                                                                                                                      

                                                                                        
       

                                           
                                                                                                                       


                              
                
                                                                                 




                                                                                                                                                                
                
 










                                                      

                                                       


                                            

                                               


                                    

                                                  


                                 
                                              


                             
           


                               





                                     
                            






                                                             
                                                                                                          


                                    



                                      






                                    
                               




                                                                                                         

           


                                


                                                                                              


                   


                                                        


                   


                                                      


                   


                                                       


                    


                                                          


                   


                                                     


                        


                                                              


                      


                                                            


                   


                                                    


                          


                                                                


                                


                                                                  


                                  


                                                                    


                   


                                                    


                   


                                                          


                           






                                                                 


                          


                                                        


                   
                                                      



                               
                                         



                                   


           


                   


                                                  


                   


                                                      


                       


                                                        





                                     
                                   



                                                                 





                                    
                                                  

                                    
                                     




                                                       





                                     
                                                  


                                    


                                       






                                                                 


                                     
                                              


                          
                                   



                                                                





                                     
                                                                


                                    


                                       





                                                                 





                                     
                                                                


                                    


                                       





                                                                





                                     
                                   



                                                              


                      


                                                                    


                   


                                                         


                   


                                                      


                           


                                                                  


                   

                                                      





                                                                           
 





                     

                                                         
 


                   


                                                   


                   


                                                         





                     


                                                             


                   


                                                  


                      


                                                            


                   


                                                      


                   


                                                        


                    


                                                          


                        


                                                              


                   


                                                                          


                                


                                                                       
         





                                                                

                   


                                                           

                        
                   


                                                             


                          


                                                                
         



                                                                    
 
         



                                                                                                                                                
 


                                                          


                      


                                                             


                             


                                                                    


                   


                                                      


                   


                                                      


                   


                                                            


                   


                                                       


                     


                                                                


                     


                                                              


                    


                                                              


                   


                                                             


                   


                                                     


                   
        

                                    
       
                                   
                                         
 

           
                                                    

                                                             


                         
                                                    
                                                      
                                                                       


                                          
 

                                                    


                                                               
                                   
     




                                

                                      
                                 
                              
                                                            
                               
       
                              
                                      
                            
                                


                                      
                                                                        
                                
       
 



                           
                                                                          


                                                          
       
 



                                                                                             
           


                     

                                      


                                   


                                      


                                 


                                      


                               


                                      


                            

                            
                                      
                                      


                          


                                      


                            


                                      


                          


                                      


                                 



              


                           

                                      


                                         


                                      


                                   


                                      


                                 


                                      

                      
                              
              
                              
                                      

                      
                            
              
                                      

                      
                              
              
                              
                                      

                      
                            
              
                                      


                                       




              

                                                                
                                                                           
     



                                                     
                               
 














                                              
                                      
 
                                           



















                                                
                                                           
                                                 
     


                     








                                                


                                    
                                
       

           


                   

                              
                                             

           


                   
 


                                 


                   









                                        


                   







                                                                 


                      

                         


                       






                            


                                                                                       



                                                      
                                                                            




                                                     



                           



                          
                                                        


                                           

                                 
 
 
      
                                                                 
                                                                   
                                                                           

     
                                     
        
                                                                                 

                                                                                  
 
                                  
 




                                                                              
             


                                                            







                                             


                                                         
              
                                                   




             






                                                    






                                         

      





                                                                              
                          
 


                           

                             


                           

                         


                           

                            

                
                                                                                                                                 


                                                                                            
 



                           
                             


                                                                                 


                           

                             


                           

                         


                           

                          
                                                                                                                                 


                                                                                            
 



                           
                             
                

                                          


                             




                            


                             





                          
                                                                                                                                 


                                                                                                
 



                             
                               



                


                                                                                





                                                           

                                                 
                                                     

           


                                           


                                     

           


                                                          

           


                              
                      
           
          
<?xml version="1.0" encoding="UTF-8"?>
<project
  name="Automated Eclipse Testing in Production"
  default="all"
  basedir=".">

  <!--Directory name of org.eclipse.test plug-in installed in ${eclipse-home} -->
  <target
    name="setup"
    unless="noclean"
    depends="init">
    <condition
      property="setupTarget"
      value="setup-zip">
      <contains
        string="${runtimeArchive}"
        substring=".zip" />
    </condition>
    <condition
      property="setupTarget"
      value="setup-tar.gz">
      <contains
        string="${runtimeArchive}"
        substring=".tar.gz" />
    </condition>

    <condition
      property="extraIU"
      value="org.eclipse.releng.tools.feature.group">
      <equals
        arg1="${testPlugin}"
        arg2="org.eclipse.releng.tests" />
    </condition>

    <condition
      property="extraIU"
      value="org.eclipse.equinox.p2.discovery.feature.feature.group">
      <equals
        arg1="${testPlugin}"
        arg2="org.eclipse.equinox.p2.tests.discovery" />
    </condition>

    <condition
      property="extraIU"
      value="org.eclipse.cvs.feature.group">
      <equals
        arg1="${testPlugin}"
        arg2="org.eclipse.pde.build.tests" />
    </condition>
    	
    <condition
      property="extraIU"
      value="org.eclipse.cvs.feature.group">
      <equals
        arg1="${testPlugin}"
        arg2="org.eclipse.team.tests.cvs.core" />
    </condition>

    <condition
      property="extraIU"
      value="org.eclipse.cvs.feature.group">
      <equals
        arg1="${testPlugin}"
        arg2="org.eclipse.team.tests.core" />
    </condition>

    <antcall target="setupRepo" />
    <antcall target="${setupTarget}" />

    <antcall target="installPreferences">
      <param
        name="eclipse-home"
        value="${eclipse-home}/eclipse" />
    </antcall>
    <antcall target="installExtraPlugins" />
    <antcall target="installTestPlugins" />

  </target>

  <target
    name="installPreferences"
    depends="initStreamSpecificProperties">
    <property
      name="preferenceDirectory"
      value="${eclipse-home}/configuration/.settings/" />
    <mkdir dir="${preferenceDirectory}" />
    <echo message="[PREFS] made preferenceDirectory at ${preferenceDirectory}" />
    <antcall target="installNetworkPreferences" />

  </target>


  <target
    name="installNetworkPreferences"
    if="org.eclipse.core.net.prefs">
    <echo
      message="${org.eclipse.core.net.prefs}"
      file="${preferenceDirectory}/org.eclipse.core.net.prefs" />
    <!-- TODO: be sure to check if quoted properly -->
    <echo message="[PREFS] wrote ${org.eclipse.core.net.prefs} to ${preferenceDirectory}" />
  </target>

  <!--Extract test bundles repo -->
  <target
    name="setupRepo"
    depends="init"
    unless="testRepoCreated">
    <mkdir dir="${repoLocation}" />
    <exec
      dir="${basedir}"
      executable="unzip"
      failonerror="false"
      resultproperty="unzipResultCode">
      <arg value="-o" />
      <arg value="-qq" />
      <arg value="${repoZip}" />
      <arg value="-d" />
      <arg value="${repoLocation}" />
    </exec>
    <echo message="unzip resultcode: ${unzipResultCode}" />
    <!-- TODO: can do more checking here, if successful, before we set to value -->
    <property
      name="testRepoCreated"
      value="true" />
  </target>

  <!--setup for zip archives -->
  <target
    name="setup-zip"
    depends="init"
    description="Reinstall the test Eclipse installation if specified by user">
    <condition property="runtimeArchiveExists">
      <available file="${executionDir}/${runtimeArchive}" />
    </condition>
    <fail
      unless="runtimeArchiveExists"
      message="runtime archive (SDK) did not exist where expected. runtimeArchive: ${executionDir}/${runtimeArchive}" />
    <echo message="Deleting existing ${eclipse-home}, if any." />
    <delete
      dir="${eclipse-home}"
      verbose="false" />
    <echo message="Fresh extract ${runtimeArchive} into ${install} for testing." />
    <exec
      dir="${install}"
      executable="unzip">
      <arg value="-q" />
      <arg path="${executionDir}/${runtimeArchive}" />
      <arg value="-d" />
      <arg path="${install}" />
    </exec>

  </target>

  <!--setup for tar.gz archives -->
  <target
    name="setup-tar.gz"
    depends="init"
    description="Reinstall the test Eclipse installation if specified by user">
    <condition property="runtimeArchiveExists">
      <available file="${executionDir}/${runtimeArchive}" />
    </condition>
    <fail
      unless="runtimeArchiveExists"
      message="runtime archive (SDK) did not exist where expected. runtimeArchive: ${executionDir}/${runtimeArchive}" />
    <echo message="Deleting existing ${eclipse-home}, if any." />
    <delete
      dir="${eclipse-home}"
      verbose="false" />

    <echo message="Fresh extract ${runtimeArchive} into ${install} for testing." />
    <exec
      dir="${install}"
      executable="tar">
      <arg value="-xf" />
      <arg path="${executionDir}/${runtimeArchive}" />
      <arg value="-C" />
      <arg path="${install}" />
    </exec>

  </target>

  <!--use an stable version of the director so that instability in the current build doesn't cause all the tests to fail -->
  <target
    name="initPlatformArhiveName"
    unless="platformArchive">
    <echo message="os.arch ${os.arch}" />

    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-linux-gtk.tar.gz">
      <and>
        <os family="unix" />
        <not>
          <or>
            <or>
              <os arch="x86_64" />
              <os arch="amd64" />
            </or>
            <os family="mac" />
          </or>
        </not>
      </and>
    </condition>
    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-macosx-cocoa-x86_64.tar.gz">
      <and>
        <os family="mac" />
        <os family="unix" />
        <or>
          <os arch="x86_64" />
          <os arch="amd64" />
        </or>
      </and>
    </condition>
    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-macosx-cocoa.tar.gz">
      <and>
        <os family="mac" />
        <os family="unix" />
        <!-- should not need, as long as x86_64 rules (above) comes first
          <os arch="i386" />
        -->
      </and>
    </condition>
    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-win32.zip">
      <and>
        <os family="windows" />
        <os arch="x86" />
      </and>
    </condition>
    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-win32-x86_64.zip">
      <and>
        <os family="windows" />
        <or>
          <os arch="x86_64" />
          <os arch="amd64" />
        </or>
      </and>
    </condition>
    <condition
      property="platformArchive"
      value="eclipse-platform-${previousReleaseVersion}-linux-gtk-x86_64.tar.gz">
      <and>
        <os family="unix" />
        <or>
          <os arch="x86_64" />
          <os arch="amd64" />
        </or>
      </and>
    </condition>

    <fail
      unless="platformArchive"
      message="platformArchive is not defined. Check that conditions cover os arch ${os.arch}. May be VM dependent.)" />

  </target>
  <target name="setupPlatform">
    <condition
      property="platformTarget"
      value="platform-zip">
      <contains
        string="${platformArchive}"
        substring=".zip" />
    </condition>
    <condition
      property="platformTarget"
      value="platform-tar.gz">
      <contains
        string="${platformArchive}"
        substring=".tar.gz" />
    </condition>
    <fail
      unless="platformTarget"
      message="platformTarget is not defined. Check that platformArchive variable and value is defined correctly, such as in equinoxp2tests.properties in the appropriate testConfig" />
    <echo message="platformTarget ${platformTarget} platformArchive ${platformArchive}" />
    <!-- The "platformArchive" is a minimal, stable version of eclipse runtime binary,
      that is used only for its "p2Director" application, to install tests into
      to target test environment. The intent is to make sure that apart of the tests
      works consistently, and does not "break the tests", simply because of some recent
      but in p2Director. (while unlikely, these days ... since that code is not under active
      development ... you never know). We test for both "Eclipse.app" and "eclipse.app"
      since the case of our app may change, and the file system of MacOSX may or may 
      not be set to "case sensitive".
    -->
    <condition property="basePlatformInstalled">
      <or>
        <available file="${platformLocation}/eclipse" />
        <available file="${platformLocation}/Eclipse.app" />
        <available file="${platformLocation}/eclipse.app" />
      </or>
    </condition>
    <antcall target="${platformTarget}" />
    <antcall target="installPreferences">
      <param
        name="eclipse-home"
        value="${platformLocation}/eclipse" />
    </antcall>
  </target>


  <!--setup for platform zip archives -->
  <target
    name="platform-zip"
    unless="basePlatformInstalled"
    depends="init"
    description="Install the base binary platform installation">
    <condition property="platformArchiveExists">
      <available file="${platformLocation}/${platformArchive}" />
    </condition>
    <fail
      unless="platformArchiveExists"
      message="plaform archive did not exist where expected. platformArchive: ${platformLocation}/${platformArchive}" />
    <!-- remove eclipse home directory, to be sure completely fresh -->
    <delete
      verbose="false"
      dir="${platformLocation}/eclipse" />
    <exec
      dir="${platformLocation}"
      executable="unzip">
      <arg value="-q" />
      <arg path="${platformLocation}/${platformArchive}" />
      <arg value="-d" />
      <arg path="${platformLocation}" />
    </exec>
  </target>

  <!--setup for platform tar.gz archives -->
  <target
    name="platform-tar.gz"
    unless="basePlatformInstalled"
    depends="init"
    description="Install the base binary platform installation">
    <condition property="platformArchiveExists">
      <available file="${platformLocation}/${platformArchive}" />
    </condition>
    <fail
      unless="platformArchiveExists"
      message="plaform archive did not exist where expected. platformArchive: ${platformLocation}/${platformArchive}" />
    <delete
      verbose="false"
      dir="${platformLocation}/eclipse" />
    <exec
      dir="${platformLocation}"
      executable="tar">
      <arg value="-xf" />
      <arg path="${platformLocation}/${platformArchive}" />
      <arg value="-C" />
      <arg path="${platformLocation}" />
    </exec>
  </target>

  <target
    name="installExtraPlugins"
    depends="init"
    if="extraIU">

    <path id="launcher.paths">
      <fileset
        dir="${eclipse-home}"
        includes="plugins/org.eclipse.equinox.launcher_*" />
    </path>
    <property
      name="launcherPath"
      refid="launcher.paths" />


    <echo>-installExtraIU ${extraIU} +</echo>
    <echo> from current.build.repo: ${current.build.repo} </echo>
    <echo> into eclipse-home: ${eclipse-home} </echo>
    <echo> using launcher: ${launcherPath} </echo>
    <java
      jar="${launcherPath}"
      failonerror="false"
      dir="${eclipse-home}"
      timeout="900000"
      fork="true"
      output="${directorLogs}/director-${extraIU}.log"
      append="true"
      resultproperty="directorcode">
      <arg value="-vm" />
      <arg path="${java.home}/bin/java" />
      <arg value="-application" />
      <arg value="org.eclipse.equinox.p2.director" />
      <arg value="-consoleLog" />
      <arg value="-debug" />
      <arg value="-flavor" />
      <arg value="tooling" />
      <arg value="-installIUs" />
      <arg value="${extraIU}" />
      <arg value="-repository" />
      <arg value="${current.build.repo}" />
    </java>
  </target>

  <target
    name="installTestPlugins"
    depends="init">
    <path id="launcher.paths">
      <fileset
        dir="${eclipse-home}"
        includes="plugins/org.eclipse.equinox.launcher_*" />
    </path>
    <property
      name="launcherPath"
      refid="launcher.paths" />
    <antcall target="setupPlatform" />
    <antcall target="installPreferences">
      <param
        name="eclipse-home"
        value="${eclipse-home}" />
    </antcall>
    <echo>-installTestIU ${testPlugin} +</echo>
    <echo> from ${repoLocation} </echo>
    <echo> into ${eclipse-home} </echo>
    <echo> using launcher: ${launcherPath} </echo>
    <java
      jar="${launcherPath}"
      failonerror="false"
      dir="${eclipse-home}"
      timeout="900000"
      fork="true"
      output="${directorLogs}/director-${testPlugin}.log"
      append="true"
      resultproperty="directorcode">
      <arg value="-vm" />
      <arg path="${java.home}/bin/java" />
      <arg value="-application" />
      <arg value="org.eclipse.equinox.p2.director" />
      <arg value="-consoleLog" />
      <arg value="-debug" />
      <arg value="-flavor" />
      <arg value="tooling" />
      <arg value="-installIUs" />
      <arg
        value="${testPlugin},org.eclipse.test,org.eclipse.ant.optional.junit,org.eclipse.test.performance,org.eclipse.test.performance.win32,org.easymock" />
      <arg value="-repository" />
      <arg value="file:${repoLocation}" />
    </java>
    <antcall target="configureTeamTest" />

    <antcall target="installderby" />
  </target>

  <target
    name="installderby"
    if="derby"
    unless="skipDerby">
    <!-- use p2director, not dropins -->
    <!--
    <property
      name="perfrepoLocation"
      value="http://build.eclipse.org/eclipse/buildtools/" />
    -->
    <!-- use 'file://' if problems with proxies -->
    <property
      name="perfrepoLocation"
      value="file:///shared/eclipse/buildtools/" />

    <java
      jar="${launcherPath}"
      failonerror="true"
      dir="${eclipse-home}"
      timeout="900000"
      fork="true"
      output="${directorLogs}/director-${derby}.log"
      append="true"
      resultproperty="directorcode">
      <arg value="-vm" />
      <arg path="${java.home}/bin/java" />
      <arg value="-application" />
      <arg value="org.eclipse.equinox.p2.director" />
      <arg value="-consoleLog" />
      <arg value="-debug" />
      <arg value="-flavor" />
      <arg value="tooling" />
      <arg value="-installIUs" />
      <arg value="${derby}" />
      <arg value="-p2.os" />
      <arg value="${os}" />
      <arg value="-p2.ws" />
      <arg value="${ws}" />
      <arg value="-p2.arch" />
      <arg value="${arch}" />
      <arg value="-roaming" />
      <arg value="-profile" />
      <arg value="SDKProfile" />
      <arg value="-repository" />
      <arg value="${perfrepoLocation}" />
      <arg value="-destination" />
      <arg path="${eclipse-home}" />
      <arg value="-bundlepool" />
      <arg path="${eclipse-home}" />
    </java>

  </target>

  <target
    name="initWorkspace"
    unless="WORKSPACE">
    <property environment="env" />
    <condition
      property="WORKSPACE"
      value="${env.WORKSPACE}"
      else="${basedir}">
      <isset property="env.WORKSPACE" />
    </condition>
  </target>
  <target
    name="initProductionProperties"
    depends="initWorkspace">
    <!--
      during production testing, previous steps persists some properties
      that we would otherwise not have access too. Such as those set on
      Hudson command line.
    -->
    <property file="${WORKSPACE}/production.properties" />

  </target>
  <target
    name="initBuildId"
    unless="buildId">
    <!--property file that can contain the buildId, if not otherwise set -->
    <property file="label.properties" />
    <fail
      unless="buildId"
      message="buildId (e.g I20140731-0800) needs to be provided to run the tests" />
  </target>

  <target
    name="initBuildType"
    depends="initBuildId"
    unless="buildType">

    <fail
      unless="buildId"
      message="buildId value must be provided by caller (such as 'I20120717-0800'" />
    <!--
      this "buildId check" may be overly strict, but best to start off strict for now,
      loosen in future if we start to find/have variety
    -->
    <condition property="buildIdOK">
      <matches
        pattern="^[IMXYNPSRU]\d{8}-\d{4}$"
        string="${buildId}" />
    </condition>
    <fail
      message="buildId variable had unexpected format. Should be of the form  [IMXYNPSRU] 8 digits '-' 4 digits, but was ${buildId}"
      unless="buildIdOK" />

    <script language="javascript"><![CDATA[
      var buildId = project.getProperty("buildId");
      var pattern = new RegExp(/^([IMXYNPSRU])(\d{8})-(\d{4})$/);

      var sArray = pattern.exec(buildId);
      // sArray 0 is "whole match"
      project.setProperty("buildType", sArray[1]);
      project.setProperty("buildIdTimestamp",sArray[2]+sArray[3]);
      ]]>
    </script>
    <fail unless="buildType" />
  </target>
  <target
    name="initCurrentUpdateSite"
    depends="initDownloadHosts, initStreamVariables, initBuildId, initBuildType"
    unless="currentUpdateSite">
    <property
      name="currentUpdateSite"
      value="http://${DOWNLOAD_HOST}/eclipse/updates/${updateSiteSegment}-${buildType}-builds/${buildId}" />
  </target>
  <target
    name="initStreamSpecificProperties"
    depends="initConfigurationDir"
    unless="streamSpecificPropertiesSet">
    <!--
      Note: configurationDir used to be set by runTest2.xml in 'production'
      environment only. We may want to set to basedir, if not already set.
      But, this file, streamSpecific.properties should always be optional.
      TODO: better document what is in that file.
    -->

    <property file="${configurationDir}/streamSpecific.properties" />
    <property
      name="streamSpecificPropertiesSet"
      value="true" />
  </target>

  <!--
    main purpose of initStreamVariables, it to be sure we have eclipseStreamMajor
    and eclipseStreamMinor. Uses Javascript, which requires Java 1.6 (or ... else gets complicated to
    setup)
  -->
  <target
    name="initStreamVariables"
    depends="initDownloadHosts,initConfigurationDir,initStreamSpecificProperties">

    <property file="${configurationDir}/streamSpecific.properties" />
    <fail
      unless="eclipseStream"
      message="eclipseStream value must be provided by caller, such as '4.3.0'." />
    <!--
      Not clear why, but I've seen "eclipseStream" value have a trailing
      ?blank? that gets picked up when read in as string.
      Seems it might be a couple of ant issues?
      Luckily we never use it as a whole string (just major and minor)
      so we can ignore spaces.
    -->
    <condition property="streamOK">
      <matches
        pattern="^\s*\d\.\d(\.\d)?\s*$"
        string="${eclipseStream}" />
    </condition>
    <fail
      message="eclipseStream variable had unexpected format. Should be of form digit.digit[.digit], but was ${eclipseStream}"
      unless="streamOK" />

    <script language="javascript"><![CDATA[
      var eclipseStream = project.getProperty("eclipseStream");
      var pattern = new RegExp(/^\s*(\d+)\.(\d+)(\.(\d+))?\s*$/);

      var sArray = pattern.exec(eclipseStream);
      // sArray[0] is "whole match"

      project.setProperty("eclipseStreamMajor", sArray[1]);
      project.setProperty("eclipseStreamMinor", sArray[2]);
      // currently don't
      // set eclipseStreamService since not used,
      // but it is optional in this context, so if needed, need to check
      // length of array and assign "0" if not provided.
      // project.setProperty("eclipseStreamService", sArray[3]);
      ]]>
    </script>

    <fail
      unless="eclipseStreamMajor"
      message="eclipseStreamMajor not defined or computable" />
    <fail
      unless="eclipseStreamMinor"
      message="eclipseStreamMinor not defined or computable" />
    <!--
      <fail
      unless="eclipseStreamService"
      message="eclipseStreamService not defined or computable" />
    -->
  </target>

  <target
    name="initBasicDirectories"
    depends="initWorkspace,initBuildId, initStreamSpecificProperties,initInstallDir, initEclipseHome"
    unless="basicDirectoriesInitialized">

    <property environment="env" />

    <condition
      property="repoBuildIdToUse"
      value="${baselinePerfBuildId}"
      else="${buildId}">
      <istrue value="${baselinePerf}" />
    </condition>
    <property
      name="repoZip"
      value="${executionDir}/eclipse-junit-tests-${repoBuildIdToUse}.zip" />
    <echo message="repoZip: ${repoZip}" />

    <property
      name="repoLocation"
      value="${executionDir}/testRepo" />
    <echo message="repoLocation: ${repoLocation}" />


    <property
      name="platformLocation"
      value="${executionDir}/platformLocation" />
    <mkdir dir="${platformLocation}" />
    <echo message="platformLocation: ${platformLocation}" />

    <!-- The directory that will contain all files containing information on the tests that ran. -->
    <property
      name="results"
      value="${executionDir}/results" />
    <mkdir dir="${results}" />
    <mkdir dir="${results}/xml" />
    <mkdir dir="${results}/html" />
    <echo message="results: ${results}" />

    <!--Directory for JUnit report output, console log output and .log content for each test suite.
      Overrides default in org.eclipse.test/library.xml -->
    <property
      name="junit-report-output"
      value="${results}/${testedPlatform}" />
    <mkdir dir="${junit-report-output}" />
    <echo message="junit-report-output: ${junit-report-output}" />

    <property
      name="directorLogs"
      value="${results}/${testedPlatform}/directorLogs" />
    <mkdir dir="${directorLogs}" />
    <echo message="directorLogs: ${directorLogs}" />

    <!-- this directory, with some sort files are created during unit tests
      ... need to find where to disable/enable JaCoCo -->
    <property
      name="coverage-output"
      value="${results}/coverageIGNORE" />

    <property
      name="basicDirectoriesInitialized"
      value="true" />
    <echo message="basicDirectoriesInitialized" />
  </target>

  <!-- this method used only during "unit testing" of this test.xml itself -->
  <target
    name="testCopyFilesIfTesting"
    if="env.TESTING_TEST_XML">
    <echo message="Test of test running on ${osgi.os}" />
    <echo
      message="Reading config from ${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration/sdk.tests/testConfigs/${osgi.os}" />
    <copy todir="${executionDir}">
      <fileset
        dir="${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration/sdk.tests/testConfigs/${osgi.os}" />
    </copy>
  </target>

  <target name="initConfigurationDir">
    <property
      name="configurationDir"
      value="${WORKSPACE}/eclipse.platform.releng.aggregator/production/testScripts/configuration" />
  </target>

  <target
    name="initInstallDir"
    depends="initBuildId, initStreamSpecificProperties, checkInstallDir"
    unless="install">
    <property
      name="testDir"
      value="${WORKSPACE}/workarea/${buildId}" />
    <echo message="[DEBUG] in test.xml: testDir: ${testDir}" />

    <property
      name="executionDir"
      value="${testDir}/eclipse-testing" />
    <mkdir dir="${executionDir}" />
    <echo message="[DEBUG] in test.xml: executionDir: ${executionDir}" />

    <!--default directory where test-eclipse-sdk will be installed -->
    <property
      name="install"
      value="${executionDir}/test-eclipse" />
    <mkdir dir="${install}" />
    <echo message="[DEBUG] in test.xml: the value of install was set to: ${install}" />
  </target>

  <target
    name="checkInstallDir"
    if="install">
    <echo message="[DEBUG] in test.xml: Found the value of install already set, to ${install}" />
  </target>

  <!--
    eclipse-home set to be the folder that will later contain the plugins
    folder.
    Note: we have to set eclipse-home, rather than use "eclpse.home" or "eclipse.home.location"
    because at this point we are executing from the "setup" version of eclipse
    (aka basebuilder)
    not the actual version of eclipse we will later be testing.
  -->
  <target
    name="initEclipseHome"
    depends="initStreamSpecificProperties, initInstallDir, checkEclipseHome"
    unless="eclipse-home">

    <condition
      property="eclipse-home"
      value="${install}/Eclipse.app/Contents/Eclipse"
      else="${install}/eclipse">
      <and>
        <os family="mac" />
        <istrue value="${isMacAppLayout}" />
      </and>
    </condition>
    <echo message="[DEBUG] the value of eclipse-home was set to: ${eclipse-home}" />
  </target>

  <!--
    Intended to be called only from initEclipseHome, simply as extra information
    for debugging
  -->
  <target
    name="checkEclipseHome"
    if="eclipse-home">
    <echo message="[DEBUG] Found the value of eclipse-home already set, to ${eclipse-home}" />
  </target>

  <!--
    DOWNLOAD_HOST and ARCHIVE_HOST can be defined on command line,
    if running on local test environments.
  -->
  <target
    name="initDownloadHosts"
    unless="DOWNLOAD_HOST">
    <!-- we assume if "DOWNLOAD_HOST" is defined, then ARCHIVE_HOST has been defined also. -->
    <property environment="env" />
    <echo message="DEBUG: Found DOWNLOAD_HOST not defined. Setting in 'initDownloadHosts'" />
    <echo message="DEBUG:      env.DOWNLOAD_HOST: ${env.DOWNLOAD_HOST}" />
    <condition
      property="DOWNLOAD_HOST"
      value="${env.DOWNLOAD_HOST}"
      else="download.eclipse.org">
      <isset property="env.DOWNLOAD_HOST" />
    </condition>
    <condition
      property="ARCHIVE_HOST"
      value="${env.ARCHIVE_HOST}"
      else="archive.eclipse.org">
      <isset property="env.ARCHIVE_HOST" />
    </condition>
  </target>

  <target
    name="init"
    depends="initWorkspace,initProductionProperties,initBuildId, initBuildType, initDownloadHosts, initStreamVariables, initCurrentUpdateSite, initBasicDirectories,initOSes, initPlatformArhiveName, setRuntimeArchive"
    unless="testingIsInitialized">

    <property environment="env" />

    <!--
      Normally these files are copied by other scripts, if not simply testing this script with "testTestXMLScript.sh",
      but when testing in isolation, want this simple way to
      copy what we need. Note: the testCopyFileIfTesting target
      will need adjustment, depending on OS that the testing is done on.
    -->
    <antcall target="testCopyFilesIfTesting" />

    <property
      name="current.build.repo"
      value="http://${DOWNLOAD_HOST}/eclipse/updates/${eclipseStreamMajor}.${eclipseStreamMinor}-${buildType}-builds/${buildId}" />
    <echo message="current.build.repo: ${current.build.repo}" />


    <property
      name="last.release.build.repo"
      value="http://${DOWNLOAD_HOST}/eclipse/updates/${previousReleaseVersionRepo}" />
    <echo message="last.release.build.repo: ${last.release.build.repo}" />

    <!--
      test.properties file contains the plugin name including version number,
      and list of required test plug-ins expressed as command-line argument to unzip executable.
      Generated and packaged at build time by CBI custom Maven task.
    -->
    <property file="test.properties" />


    <!--Unlock files on the Mac before starting tests.
      Required to delete some workspace directories (org.eclipse.core.filebuffers.tests and Team CVS tests). -->
    <exec
      dir="${executionDir}"
      executable="chflags"
      os="Mac OS X">
      <arg value="-R" />
      <arg value="nouchg" />
      <arg path="${install}" />
    </exec>

    <!--
      Originally needed/provided for p2 tests, but they appear not to
      be successful in reading or using these properties any longer.
      Not clear why. So we'll leave it in until understood. (It may be
      useful in other scenarios, such when tested stand alone?)
    -->
    <property
      name="org.eclipse.equinox.p2.reconciler.tests.platform.archive"
      value="${executionDir}/${platformArchive}" />

    <property
      name="org.eclipse.equinox.p2.reconciler.tests.platform.archive"
      value="${executionDir}/${platformArchive}" />
    <property
      name="org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive"
      value="NotCurrentlyImplementedOrUsed" />
    <property
      name="org.eclipse.equinox.p2.tests.current.build.repo"
      value="${current.build.repo}" />
    <property
      name="org.eclipse.equinox.p2.tests.last.release.build.repo"
      value="${last.release.build.repo}" />

    <!--
      It is likely we do not need the equinoxp2propertiesFile any longer,
      during production tests, at least.
    -->
    <antcall target="rewriteEquinoxp2PropertiesFile" />

    <property
      name="testingIsInitialized"
      value="true" />
  </target>

  <target name="rewriteEquinoxp2PropertiesFile">
    <property
      name="EOL"
      value="${line.separator}" />

    <echo
      message="# properties for p2 tests${EOL}"
      file="${executionDir}/equinoxp2tests.properties"
      append="false"
      force="true" />

    <echo
      message="org.eclipse.equinox.p2.reconciler.tests.platform.archive=${org.eclipse.equinox.p2.reconciler.tests.platform.archive}${EOL}"
      file="${executionDir}/equinoxp2tests.properties"
      append="true" />
    <echo
      message="org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive=${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive}${EOL}"
      file="${executionDir}/equinoxp2tests.properties"
      append="true" />
    <echo
      message="org.eclipse.equinox.p2.tests.current.build.repo=${current.build.repo}${EOL}"
      file="${executionDir}/equinoxp2tests.properties"
      append="true" />
    <echo
      message="org.eclipse.equinox.p2.tests.last.release.build.repo=${last.release.build.repo}${EOL}"
      file="${executionDir}/equinoxp2tests.properties"
      append="true" />
  </target>

  <!-- runtimeArchive is set to either current, just built SDK, or
    if "baselinePerf" has been set to true, then that baselinePerf version is used,
    such as for performance baselinePerf run. baselinePerf is set in Hudson
    job.
  -->
  <target
    name="setRuntimeArchive"
    unless="runtimeArchive">

    <condition
      property="buildIdToUse"
      value="${baselinePerfVersionLabel}"
      else="${buildId}">
      <istrue value="${baselinePerf}" />
    </condition>
    <echo message="setRuntimeArchive os ${os} ws ${ws} arch ${arch}" />
    <echo message="build id of runtimeArchive ${buildIdToUse}" />
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-win32.zip">
      <and>
        <equals
          arg1="${os}"
          arg2="win32" />
        <equals
          arg1="${ws}"
          arg2="win32" />
        <equals
          arg1="${arch}"
          arg2="x86" />
      </and>
    </condition>
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-win32-x86_64.zip">
      <and>
        <equals
          arg1="${os}"
          arg2="win32" />
        <equals
          arg1="${ws}"
          arg2="win32" />
        <equals
          arg1="${arch}"
          arg2="x86_64" />
      </and>
    </condition>
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-linux-gtk.tar.gz">
      <and>
        <equals
          arg1="${os}"
          arg2="linux" />
        <equals
          arg1="${ws}"
          arg2="gtk" />
        <equals
          arg1="${arch}"
          arg2="x86" />
      </and>
    </condition>
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-linux-gtk-x86_64.tar.gz">
      <and>
        <equals
          arg1="${os}"
          arg2="linux" />
        <equals
          arg1="${ws}"
          arg2="gtk" />
        <equals
          arg1="${arch}"
          arg2="x86_64" />
      </and>
    </condition>
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-linux-gtk-ppc64.tar.gz">
      <and>
        <equals
          arg1="${os}"
          arg2="linux" />
        <equals
          arg1="${ws}"
          arg2="gtk" />
        <equals
          arg1="${arch}"
          arg2="ppc64" />
      </and>
    </condition>
    <condition
      property="runtimeArchive"
      value="eclipse-SDK-${buildIdToUse}-macosx-cocoa-x86_64.tar.gz">
      <and>
        <equals
          arg1="${os}"
          arg2="macosx" />
        <equals
          arg1="${ws}"
          arg2="cocoa" />
        <equals
          arg1="${arch}"
          arg2="x86_64" />
      </and>
    </condition>
    <echo message="runtimeArchive ${runtimeArchive} !!! " />
  </target>

  <target
    name="setJVMProperties"
    depends="setJVMfromUserSpecified"
    unless="jvm">
    <property
      name="VMSource"
      value="VM used for tests, is same that invoked Ant: '${java.home}/bin/java' (that is, 'jvm' not specified by caller)." />
    <echo message="VMSource: $VMSource" />
    <!--
      Remember, we don't want J2SE-X.0 set at all, if there is nothing
      that can run tests that require that level.
    -->

    <exec
      executable="${java.home}/bin/java"
      outputproperty="javaversion">
      <arg value="-version" />
    </exec>
    <echo message="full output from 'java -version' of ${java.home}/bin/java is " />
    <echo message="${javaversion}" />

    <!--enable tests requiring 1.5 or or greater vms to run if running vm level detected matches required execution environment -->
    <condition
      property="J2SE-5.0"
      value="${java.home}/bin/java">
      <matches
        string="${java.version}"
        pattern="^1\.[5678].*$" />
    </condition>
    <condition
      property="J2SE-6.0"
      value="${java.home}/bin/java">
      <matches
        string="${java.version}"
        pattern="^1\.[678].*$" />
    </condition>
    <condition
      property="J2SE-7.0"
      value="${java.home}/bin/java">
      <matches
        string="${java.version}"
        pattern="^1\.[78].*$" />
    </condition>
    <condition
      property="J2SE-8.0"
      value="${java.home}/bin/java">
      <matches
        string="${java.version}"
        pattern="^1\.[8].*$" />
    </condition>
    <echo
      level="info"
      message="DEBUG: values from setJVMProperties" />
    <echo
      level="info"
      message="J2SE-8.0:  ${J2SE-8.0}" />
    <echo
      level="info"
      message="J2SE-7.0:  ${J2SE-7.0}" />
    <echo
      level="info"
      message="J2SE-6.0:  ${J2SE-6.0}" />
    <echo
      level="info"
      message="J2SE-5.0:  ${J2SE-5.0}" />
  </target>

  <target
    name="setJVMfromUserSpecified"
    if="jvm">

    <property
      name="VMSource"
      value="VM used for tests, specified by caller: 'jvm'=${jvm}" />
    <echo message="VMSource: $VMSource" />
    <!--
      Remember, we don't want J2SE-X.0 set at all, if there is nothing
      that can run tests that require that level.
    -->
    <exec
      executable="${jvm}"
      outputproperty="javaversion">
      <arg value="-version" />
    </exec>
    <echo message="full output from 'java -version' of ${jvm} is " />
    <echo message="${javaversion}" />

    <condition
      property="J2SE-8.0"
      value="${jvm}">
      <matches
        string="${javaversion}"
        pattern='^java version "1\.[8].*"' />
    </condition>
    <condition
      property="J2SE-7.0"
      value="${jvm}">
      <matches
        string="${javaversion}"
        pattern='^java version "1\.[78].*"' />
    </condition>
    <condition
      property="J2SE-6.0"
      value="${jvm}">
      <matches
        string="${javaversion}"
        pattern='^java version "1\.[678].*"' />
    </condition>
    <condition
      property="J2SE-5.0"
      value="${jvm}">
      <matches
        string="${javaversion}"
        pattern='^java version "1\.[5678].*"' />
    </condition>
    <echo
      level="info"
      message="DEBUG: values from setJVMfromUserSpecified" />
    <echo message="J2SE-8.0:  ${J2SE-8.0}" />
    <echo message="J2SE-7.0:  ${J2SE-7.0}" />
    <echo message="J2SE-6.0:  ${J2SE-6.0}" />
    <echo message="J2SE-5.0:  ${J2SE-5.0}" />
  </target>
  <target
    name="checkCVSPropExists"
    if="teamcvs">
    <condition property="cvsPropertiesAvailable">
      <available file="${cvstest.properties}" />
    </condition>
  </target>
  <target
    name="getcvstestProperties"
    if="cvsPropertiesAvailable"
    depends="checkCVSPropExists">
    <!--
      TODO: cvstest.properties (file location) is currently
      hard coded in 'runTest2.xml' and passed along this 'test.xml'
      via production.properties. Would be better to have the file location
      be part of the platform specific properties files, as we do with "jvm"
    -->
    <echo message="cvstest.properties file: ${cvstest.properties}" />
    <property file="${cvstest.properties}" />

  </target>
  <target
    name="configureTeamTest"
    depends="getcvstestProperties"
    if="teamcvs">
    <!-- Fill in cvs repository information -->
    <replace
      file="${eclipse-home}/plugins/${org.eclipse.team.tests.cvs.core}/repository.properties"
      token="@user@"
      value="${cvs_user}" />
    <replace
      file="${eclipse-home}/plugins/${org.eclipse.team.tests.cvs.core}/repository.properties"
      token="@password@"
      value="${cvs_password}" />
    <replace
      file="${eclipse-home}/plugins/${org.eclipse.team.tests.cvs.core}/repository.properties"
      token="@host@"
      value="${cvs_host}" />
    <replace
      file="${eclipse-home}/plugins/${org.eclipse.team.tests.cvs.core}/repository.properties"
      token="@root@"
      value="${cvs_root}" />
  </target>


  <macrodef name="runTests">
    <attribute name="testPlugin" />
    <sequential>
      <antcall target="markCurrentTime">
        <param
          name="message"
          value="start @{testPlugin}" />
      </antcall>
      <!--always use eclipse executable to launch tests with the exception of performance tests -->
      <!--condition property="useEclipseExe" value="true">
        <not>
        <equals arg1="${test.target}" arg2="performance"/>
        </not>
        </condition -->

      <condition
        property="performance.target.present"
        value="true">
        <isset property="@{testPlugin}.has.performance.target" />
      </condition>

      <!--override the value of this property with performance if the tests run on performance machine -->
      <property
        name="test.target"
        value="junit" />
      <property
        name="report"
        value="@{testPlugin}" />

      <echo message="test.target in 'runTests': ${test.target}" />

      <!--install db plug-ins if running performance tests -->
      <condition
        property="derby"
        value="org.apache.derby.core.feature.feature.group">
        <equals
          arg1="${test.target}"
          arg2="performance" />
      </condition>
      <!-- <property name="derby" value="" /> -->
      <!-- <param name="testPlugin" value="${@{testPlugin}}" /> -->
      <antcall target="${test.target}">
        <param
          name="testPlugin"
          value="@{testPlugin}" />
        <param
          name="output-file"
          value="@{testPlugin}.xml" />
      </antcall>
      <antcall target="markCurrentTime">
        <param
          name="message"
          value="end @{testPlugin}" />
      </antcall>
    </sequential>
  </macrodef>

  <target
    name="junit"
    depends="init"
    unless="skip.test">
    <antcall target="setup">
    </antcall>
    <property file="finalPluginsVersions.properties" />
    <property
      name="library-file"
      value="${executionDir}/library.xml" />
    <property
      name="junit-stylesheet"
      value="${executionDir}/JUNIT.XSL" />
    <echo>trying to find ${testPlugin}_*/test.xml</echo>
    <fileset
      id="test.plugin.file"
      dir="${eclipse-home}/plugins">
      <filename name="${testPlugin}_*/test.xml" />
    </fileset>
    <property
      name="testPluginX"
      refid="test.plugin.file" />
    <echo>trying to find ${testPluginX}</echo>
    <condition
      property="pluginexists"
      value="true">
      <not>
        <equals
          arg1="${testPluginX}"
          arg2="" />
      </not>
    </condition>
    <antcall target="runSuite" />
    <antcall target="genResults" />
  </target>

  <target
    name="runSuite"
    if="pluginexists">
    <ant
      antfile="${eclipse-home}/plugins/${testPluginX}"
      dir="${eclipse-home}" />
  </target>


  <target
    name="runSuitePerf"
    depends="initStreamVariables"
    if="pluginexists">
    <echo message="testPluginX ${testPluginX}" />
    <property
      name="junit-stylesheet"
      value="${executionDir}/JUNIT.XSL" />
    <!--
      TODO: seems these "performance values" should "get into" library.xml in an easier way, that didn't require a change in library.xml.
      TODO: some question on how "fine" to make name. Such as, should "platform, architecture, window system" be "separated" from "VM
      value"?
      TODO: for local, non-production tests, eclipse.perf.dbloc is not being assigned value from "localTestsProperties.shsource" as it
      should. Perhaps needs tweak in Hudson job?
      TODO: would have to compute these in runTest2.xml, to make part of production properties,
      and phpproperties.php
    -->
    <property
      name="eclipse.perf.dbloc"
      value="${eclipse.perf.dbloc.value}" />
    <!-- buildIdToUse equals either baselinePerfVersion or else equals buildId. In either case we want to collect the data -->
    <!-- TODO: Do we need "buildID" coded somewhere, to know WHICH build to match with?
      Or, else will take large number of "baselines" averaged? -->

    <condition
      property="eclipse.perf.config"
      value="build=${baselinePerfVersion}-${buildIdTimestamp};config=${testedPlatformConfig};jvm=${javaMajorVersion}"
      else="build=${buildId};config=${testedPlatformConfig};jvm=${javaMajorVersion}">
      <istrue value="${baselinePerf}" />
    </condition>
    <!--
      This "assert" property works, in this context, because we run baseline first,
      when buildIdToUse != buildId that is a "baseline run" (so, no "assert" for that baseline run).
      But, when buildIdToUse == buildId that is a "normal run" so then we do want to "assert" against the already-collected baseline
      data.
      Note: Note, docs say order does not matter, and could specify "just build" and reset filled in with what's in 'config', but some
      experiences makes me doubt that?
      TODO: design problem: how to distinguish assert against baseline vs. baseline alt.
    -->
    <condition
      property="eclipse.perf.assertAgainst"
      value="build=${baselinePerfVersion}-${buildIdTimestamp};config=${testedPlatformConfig};jvm=${javaMajorVersion};">
      <equals
        arg1="${buildIdToUse}"
        arg2="${buildId}" />
    </condition>
    <!-- frameworkperfargs is used by library.xml ... probably an easier way? -->
    <condition
      property="frameworkperfargs"
      value="-Declipse.perf.dbloc=${eclipse.perf.dbloc} -Declipse.perf.config=${eclipse.perf.config} -Declipse.perf.assertAgainst=${eclipse.perf.assertAgainst}"
      else="-Declipse.perf.dbloc=${eclipse.perf.dbloc} -Declipse.perf.config=${eclipse.perf.config}">
      <isset property="eclipse.perf.assertAgainst" />
    </condition>

    <ant
      antfile="${eclipse-home}/plugins/${testPluginX}"
      dir="${eclipse-home}"
      target="performance" />
  </target>

  <target
    name="performance"
    if="performance.target.present"
    unless="skip.test"
    depends="init">
    <antcall target="setup" />
    <property file="finalPluginsVersions.properties" />
    <property
      name="library-file"
      value="${executionDir}/library.xml" />

    <echo>trying to find ${testPlugin}_*</echo>
    <fileset
      id="test.plugin.file"
      dir="${eclipse-home}/plugins">
      <filename name="${testPlugin}_*/test.xml" />
    </fileset>
    <property
      name="testPluginX"
      refid="test.plugin.file" />
    <echo>trying to find ${testPluginX}</echo>
    <condition
      property="pluginexists"
      value="true">
      <not>
        <equals
          arg1="${testPluginX}"
          arg2="" />
      </not>
    </condition>
    <antcall target="runSuitePerf" />
    <antcall target="genResults" />
  </target>

  <target name="genResults">
    <copy
      file="${eclipse-home}/${report}.xml"
      tofile="${results}/xml/${report}_${testedPlatform}.xml"
      failonerror="false" />
    <property
      name="junit-stylesheet"
      value="${executionDir}/JUNIT.XSL" />
    <!-- some "failures" are "bad enough" that the tests were not unpacked, so style sheet won't exist -->
    <available
      file="${junit-stylesheet}"
      property="stylesheetexists" />
    <antcall target="convertToHTML" />

  </target>

  <target
    name="convertToHTML"
    if="stylesheetexists"
    depends="checkStylesheetexists">
    <xslt
      style="${junit-stylesheet}"
      basedir="${results}/xml"
      destdir="${results}/html"
      filenameparameter="filename" >
      <factory name="org.apache.xalan.processor.TransformerFactoryImpl">
        <feature name="http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions" value="true"/>
      </factory>
    </xslt>
  </target>

  <target
    name="checkStylesheetexists"
    unless="stylesheetexists">
    <echo message="ERROR: previous suite test install failed, so style sheet did not exist" />
  </target>

  <target
    name="ant"
    depends="init">
    <runTests testPlugin="org.eclipse.ant.tests.core" />
  </target>

  <target
    name="antui"
    depends="init">
    <runTests testPlugin="org.eclipse.ant.tests.ui" />
  </target>

  <target
    name="compare"
    depends="init">
    <runTests testPlugin="org.eclipse.compare.tests" />
  </target>

  <target
    name="equinoxds"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.ds.tests" />
  </target>

  <target
    name="debug"
    depends="init">
    <runTests testPlugin="org.eclipse.debug.tests" />
  </target>

  <target
    name="coreresources"
    depends="init">
    <runTests testPlugin="org.eclipse.core.tests.resources" />
  </target>

  <target
    name="coreruntime"
    depends="init">
    <runTests testPlugin="org.eclipse.core.tests.runtime" />
  </target>

  <target
    name="osgi"
    depends="init">
    <runTests testPlugin="org.eclipse.osgi.tests" />
  </target>

  <target
    name="coreexpressions"
    depends="init">
    <runTests testPlugin="org.eclipse.core.expressions.tests" />
  </target>

  <target
    name="ltkuirefactoringtests"
    depends="init">
    <runTests testPlugin="org.eclipse.ltk.ui.refactoring.tests" />
  </target>

  <target
    name="ltkcorerefactoringtests"
    depends="init">
    <runTests testPlugin="org.eclipse.ltk.core.refactoring.tests" />
  </target>

  <target
    name="text"
    depends="init">
    <runTests testPlugin="org.eclipse.text.tests" />
  </target>

  <target
    name="jface"
    depends="init">
    <runTests testPlugin="org.eclipse.jface.text.tests" />
  </target>

  <target
    name="jfacedatabinding"
    depends="init">
    <runTests testPlugin="org.eclipse.jface.tests.databinding" />
  </target>

  <target name="filebuffers">
    <runTests testPlugin="org.eclipse.core.filebuffers.tests" />
  </target>

  <target
    name="jdttext"
    unless="skip.jdttext">
    <runTests testPlugin="org.eclipse.jdt.text.tests" />
  </target>

  <target
    name="relEng"
    depends="init">
    <runTests testPlugin="org.eclipse.releng.tests" />
    <move
      todir="${results}/chkpii"
      includeEmptyDirs="no"
      failonerror="false">
      <fileset dir="${results}/chkpii" />
      <mapper
        type="glob"
        from="*"
        to="${testedPlatform}_*" />
    </move>
  </target>

  <target
    name="ua"
    depends="init">
    <runTests testPlugin="org.eclipse.ua.tests" />
  </target>

  <target
    name="uadoc"
    depends="init">
    <runTests testPlugin="org.eclipse.ua.tests.doc" />
  </target>

  <target
    name="coretestsnet"
    depends="init">
    <runTests testPlugin="org.eclipse.core.tests.net" />
  </target>

  <target
    name="jdtcorecompiler"
    depends="init, setJVMProperties">
    <condition
      property="jvm"
      value="${J2SE-5.0}">
      <isset property="J2SE-5.0" />
    </condition>
    <runTests testPlugin="org.eclipse.jdt.core.tests.compiler" />
  </target>

  <target
    name="jdtapt"
    depends="init,setJVMProperties">
    <property
      name="jvm"
      value="${J2SE-5.0}" />
    <!--only run test if J2SE-5.0 property set -->
    <condition property="skip.test">
      <not>
        <isset property="J2SE-5.0" />
      </not>
    </condition>
    <runTests testPlugin="org.eclipse.jdt.apt.tests" />
  </target>

  <target
    name="jdtaptpluggable"
    depends="init, setJVMProperties">
    <property
      name="jvm"
      value="${J2SE-6.0}" />
    <!--only run test if J2SE-5.0 property set -->
    <condition property="skip.test">
      <not>
        <or>
          <isset property="J2SE-6.0" />
          <isset property="J2SE-7.0" />
          <isset property="J2SE-8.0" />
        </or>
      </not>
    </condition>
    <runTests testPlugin="org.eclipse.jdt.apt.pluggable.tests" />
  </target>


  <target
    name="jdtcorebuilder"
    depends="init, setJVMProperties">
    <!--Run with 1.5 vm if it is available -->
    <condition
      property="jvm"
      value="${J2SE-5.0}">
      <isset property="J2SE-5.0" />
    </condition>
    <runTests testPlugin="org.eclipse.jdt.core.tests.builder" />
  </target>

  <target
    name="jdtcompilertool"
    depends="init, setJVMProperties">
    <property
      name="jvm"
      value="${J2SE-6.0}" />
    <!--only run test if J2SE-6.0 property or greater is set -->
    <condition property="skip.test">
      <not>
        <or>
          <isset property="J2SE-6.0" />
          <isset property="J2SE-7.0" />
          <isset property="J2SE-8.0" />
        </or>
      </not>
    </condition>
    <runTests testPlugin="org.eclipse.jdt.compiler.tool.tests" />
  </target>

  <target
    name="jdtcompilerapt"
    depends="init, setJVMProperties">
    <property
      name="jvm"
      value="${J2SE-6.0}" />
    <!--only run test if J2SE-6.0 property or greater is set -->
    <condition property="skip.test">
      <not>
        <or>
          <isset property="J2SE-6.0" />
          <isset property="J2SE-7.0" />
          <isset property="J2SE-8.0" />
        </or>
      </not>
    </condition>
    <runTests testPlugin="org.eclipse.jdt.compiler.apt.tests" />
  </target>

  <target
    name="jdtcoremodel"
    depends="init, setJVMProperties">
    <condition
      property="jvm"
      value="${J2SE-5.0}">
      <isset property="J2SE-5.0" />
    </condition>
    <runTests testPlugin="org.eclipse.jdt.core.tests.model" />
  </target>

  <target
    name="jdtcoreperf"
    depends="init">
    <runTests testPlugin="org.eclipse.jdt.core.tests.performance" />
  </target>

  <target
    name="jdtdebug"
    depends="init">
    <runTests testPlugin="org.eclipse.jdt.debug.tests" />
  </target>

  <target
    name="jdtui"
    depends="init">
    <runTests testPlugin="org.eclipse.jdt.ui.tests" />
  </target>

  <target
    name="jdtuirefactoring"
    depends="init">
    <runTests testPlugin="org.eclipse.jdt.ui.tests.refactoring" />
  </target>

  <target
    name="pdeui"
    depends="init">
    <runTests testPlugin="org.eclipse.pde.ui.tests" />
  </target>
    	
  <target
    name="pdegenericeditor"
    depends="init">
    <runTests testPlugin="org.eclipse.pde.genericeditor.extension.tests" />
  </target>

  <target
    name="pdebuild"
    depends="init">
    <property
      name="pdebuild"
      value="true" />
    <runTests testPlugin="org.eclipse.pde.build.tests" />
  </target>

  <target
    name="swt"
    depends="init">
    <runTests testPlugin="org.eclipse.swt.tests" />
  </target>

  <target
    name="teamcore"
    depends="init">
    <runTests testPlugin="org.eclipse.team.tests.core" />
  </target>

  <target
    name="teamcvs"
    depends="init">
    <property
      name="teamcvs"
      value="true" />
    <runTests testPlugin="org.eclipse.team.tests.cvs.core" />
  </target>

  <target
    name="ui"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests" />
  </target>

  <target
    name="uinavigator"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests.navigator" />
  </target>

  <target
    name="uircp"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests.rcp" />
  </target>

  <target
    name="uiforms"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests.forms" />
  </target>

  <target
    name="uieditors"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.editors.tests" />
  </target>

  <target
    name="uiperformance"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests.performance" />
  </target>

  <target
    name="uiviews"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.tests.views.properties.tabbed" />
  </target>

  <target
    name="uiworkbenchtexteditor"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.workbench.texteditor.tests" />
  </target>

  <target
    name="genericEditor"
    depends="init">
    <runTests testPlugin="org.eclipse.ui.genericeditor.tests" />
  </target>

  <target
    name="update"
    depends="init">
    <runTests testPlugin="org.eclipse.update.tests.core" />
  </target>

  <target
    name="pdeapitooling"
    depends="init">
    <runTests testPlugin="org.eclipse.pde.api.tools.tests" />
  </target>

  <target
    name="equinoxsecurity"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.security.tests" />
  </target>

  <target
    name="equinoxhttpservlet"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.http.servlet.tests" />
  </target>

  <target
    name="equinoxp2"
    depends="init">
    <echo
      message="DEBUG: org.eclipse.equinox.p2.reconciler.tests.platform.archive: ${org.eclipse.equinox.p2.reconciler.tests.platform.archive} " />

    <runTests testPlugin="org.eclipse.equinox.p2.tests" />
  </target>

  <target
    name="equinoxp2ui"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.p2.tests.ui" />
  </target>

  <target
    name="equinoxp2discovery"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.p2.tests.discovery" />
  </target>

  <target
    name="search"
    depends="init">
    <runTests testPlugin="org.eclipse.search.tests" />
  </target>

  <target
    name="pdeds"
    depends="init">
    <runTests testPlugin="org.eclipse.pde.ds.tests" />
  </target>

  <target
    name="bidi"
    depends="init">
    <runTests testPlugin="org.eclipse.equinox.bidi.tests" />
  </target>

  <target
    name="e4Core"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.core.tests" />
  </target>

  <target
    name="e4Commands"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.core.commands.tests" />
  </target>

  <target
    name="e4Bindings"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.ui.bindings.tests" />
  </target>

  <target
    name="e4CssCore"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.ui.tests.css.core" />
  </target>

  <target
    name="e4CssSwt"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.ui.tests.css.swt" />
  </target>

  <target
    name="e4UI"
    depends="init">
    <runTests testPlugin="org.eclipse.e4.ui.tests" />
  </target>

  <target
    name="all"
    depends="init">
    <!--
      <antcall target="relEng" />
      <antcall target="equinoxp2" />
    -->
    <antcall target="quickTests" />
    <antcall target="longRunningTests" />

  </target>

  <!-- This and all the performance specific targets
    are temporary, just to help investigate which work, which
    don't, etc. -->
  <target
    name="allPerformance"
    depends="init">
    <!-- There are 41 test suites to claim they have
      performance targets. These "sub groups" are just
      and attempt to help investigate which work, which don't, etc. -->
    <antcall target="selectPerformance" />
    <antcall target="otherPerformance" />


  </target>
  <!-- This and all the performance specific targets
    are temporary, just to help investigate which work, which
    don't, etc. Visually inspected each, and found these 21 do
    have performance targets, which means there's about 20 that
    have empty performance targets.
  -->
  <target
    name="selectPerformance"
    depends="init">
    <antcall target="antui" />
    <antcall target="compare" />
    <antcall target="coreresources" />
    <antcall target="coreruntime" />
    <antcall target="jdtdebug" />
    <antcall target="jdtui" />
    <!--https://bugs.eclipse.org/bugs/show_bug.cgi?id=443233
      <antcall target="osgi" />
    -->
    <antcall target="pdeui" />
    <antcall target="pdeapitooling" />
    <antcall target="swt" />
    <antcall target="teamcvs" />
    <antcall target="ua" />
    <antcall target="uiforms" />
    <antcall target="uiperformance" />
    <!-- temp remove, we do not run these in unit tests? See bug 380553.
      <antcall target="uircp" />
    -->

  </target>
  <target
    name="otherPerformance"
    depends="init">
    <!-- There is no performance tests for org.eclipse.equinox.p2.tests.ui
      https://bugs.eclipse.org/bugs/show_bug.cgi?id=455137
      It has an empty performance target.
      <antcall target="equinoxp2ui" />
    -->

    <!-- These three ran but took longer an an hour, some memory issues with one of them? -->
    <antcall target="jdtcoreperf" />
    <antcall target="jdttext" />
    <antcall target="jdtuirefactoring" />
  </target>
  <target
    name="quickTests"
    depends="init">

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start quickTests" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start platform" />
    </antcall>
    <antcall target="platform" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end platform" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start pde" />
    </antcall>
    <antcall target="pde" />
    <antcall target="pdeapitooling" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end pde" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start jdt" />
    </antcall>
    <antcall target="jdt" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end jdt" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end quickTests" />
    </antcall>

  </target>

  <target
    name="longRunningTests"
    depends="init">

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start longRunningTests" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start platformLR" />
    </antcall>
    <antcall target="platformLR" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end platformLR" />
    </antcall>

    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start jdtLR" />
    </antcall>
    <antcall target="jdtLR" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end jdtLR" />
    </antcall>
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="start pdeLR" />
    </antcall>
    <antcall target="pdeLR" />
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end pdeLR" />
    </antcall>
    <antcall target="markCurrentTime">
      <param
        name="message"
        value="end longRunningTests" />
    </antcall>

  </target>

  <!--
    admittedly, not quite all of 'platform', but for
    now serves dual purpose of a "short set" of tests, that area
    relatively quick, and relatively reliable on build.eclipse.org hardware
  -->
  <target
    name="platform"
    depends="init">
    <!-- was removed, temporarily, see bug 400385 -->
    <antcall target="relEng" />

    <antcall target="ant" />
    <antcall target="antui" />
    <antcall target="compare" />
    <antcall target="coreruntime" />
    <antcall target="swt" />
    <antcall target="coreexpressions" />
    <antcall target="coretestsnet" />
    <antcall target="text" />
    <antcall target="jfacedatabinding" />
    <antcall target="filebuffers" />
    <antcall target="teamcore" />
    <antcall target="uadoc" />
    <antcall target="uieditors" />
    <antcall target="uinavigator" />
    <antcall target="uiworkbenchtexteditor" />
    <antcall target="genericEditor" />

    <antcall target="equinoxhttpservlet" />
    <antcall target="ua" />
    <antcall target="uiforms" />
    <antcall target="equinoxp2ui" />
    <antcall target="equinoxsecurity" />
    <antcall target="search" />
    <antcall target="debug" />
    <antcall target="e4Core" />
    <antcall target="e4Commands" />
    <antcall target="e4Bindings" />
    <antcall target="e4CssCore" />
    <antcall target="e4CssSwt" />
    <antcall target="e4UI" />
    <antcall target="equinoxds" />
    <antcall target="equinoxp2discovery" />
    <antcall target="bidi" />
    <antcall target="ltkuirefactoringtests" />
    <antcall target="ltkcorerefactoringtests" />

  </target>

  <!-- this group is "platform tests" that are Long Running
    (or, perhaps hang?, during performance tests.
  -->
  <target
    name="platformLR"
    depends="init">
    <antcall target="osgi" />
    <antcall target="coreresources" />
    <antcall target="equinoxp2" />
    <antcall target="teamcvs" />
    <antcall target="jface" />
    <antcall target="ui" />
    <antcall target="uiperformance" />

    <!-- don't run now, for 4.2. See bug 380553.
      <antcall target="uircp" />
    -->
    <!-- disable for now, bug 398717
      antcall target="uiviews" /
    -->
  </target>

  <target
    name="pde"
    depends="init">
    <antcall target="pdeds" />
    <antcall target="pdeui" />
  	<antcall target="pdegenericeditor" />
  </target>

  <target
    name="pdeLR"
    depends="init">

    <antcall target="pdebuild" />
  </target>

  <target
    name="jdt"
    depends="init">
    <antcall target="jdtcompilertool" />
    <antcall target="jdtcompilerapt" />
    <antcall target="jdttext" />
    <antcall target="jdtcoreperf" />
    <antcall target="jdtcorebuilder" />
    <antcall target="jdtdebug" />
    <antcall target="jdtapt" />
    <antcall target="jdtaptpluggable" />
  </target>

  <target
    name="jdtLR"
    depends="init">
    <antcall target="jdtui" />
    <antcall target="jdtuirefactoring" />
    <antcall target="jdtcoremodel" />
    <antcall target="jdtcorecompiler" />
  </target>

  <!-- we could put other variables/os checks here, if needed -->
  <target name="checkOS">
    <condition
      property="isMac"
      value="true">
      <os family="mac" />
    </condition>
    <condition
      property="isUnix"
      value="true">
      <os family="unix" />
    </condition>
  </target>
  <macrodef name="markTime">
    <attribute name="msg" />
    <sequential>
      <!--
        we write the message first, with no ${line.separator} so that the timestamp can
        go on same line, and my side-effect writes an EOL
      -->
      <echo
        message="@{msg}     "
        append="true"
        file="${junit-report-output}/testTimes.log" />
      <!-- This executable should run on all unix platforms (Linux, mac) -->
      <exec
        executable="date"
        append="true"
        output="${junit-report-output}/testTimes.log"
        osfamily="unix">
        <arg value="+%s" />
      </exec>
    </sequential>
  </macrodef>
  <target
    name="markCurrentTime"
    depends="checkOS"
    if="isUnix">
    <!-- caller in antcall is expected to supply msg -->
    <property
      name="message"
      value="no message given by caller" />
    <markTime msg="${message}" />
  </target>


  <!--
    function to centralize how we get (that is, set) the value of
    'javaMajorVersion'. (expected to be integer, such as 5,6,7,8,9,
    or will be "0" if the version could not be determined, for some reason.
  -->

  <target name="getJavaMajorVersion">
    <!--
      TODO: this assumes we are running ant, with same VM as we'll eventually use
      during test. Valid assumption most the time, but ... not necessarily always.
    -->

    <script language="javascript">

      <!--
        technically does not have to be wrapped in "CDATA" (Ant and BSD define
        it that way, but if not done, other tools (such as XML Editor) can
        break the code by changing the formatting.
      -->
    <![CDATA[
      var javaVersion = project.getProperty("java.version");
      var pattern = new
      RegExp(/^1\.([456789]).*$/);

      var sArray = pattern.exec(javaVersion);
      // sArray 0 is "whole match"
      // so will always exist (even
      // if no match?)
      // for safety from programing
      // errors, we'll check that there is
      // something in '1'.
      var length = sArray.length;
      if (length > 1) {
      project.setProperty("javaMajorVersion", sArray[1]);
      } else {
      project.setProperty("javaMajorVersion", "0");
      }
      ]]>
    </script>
  </target>

  <macrodef name="printProperty">
    <attribute name="property" />
    <sequential>
      <echo message="@{property}: ${@{property}}" />
    </sequential>
  </macrodef>


  <target name="debug-allJavaProperties">
    <echoproperties regex="^java\..*$" />
  </target>
  <target name="debug-allOSProperties">
    <echoproperties regex="^os\..*$" />
  </target>

  <!--
    initOSes is to make sure the values of os, ws, and arch are set.
    We need them to match their "osgi.X" counterparts, so users often will
    need to simply set the "osgi.X" values as system variables, since
    our ability to guess varies from OS to OS and VM to VM ... but, if
    the osgi.X values are not set, we'll take a guess based on common systems.
  -->
  <target name="initOSes">

    <condition
      property="guessed.os"
      value="win32">
      <os family="windows" />
    </condition>
    <condition
      property="guessed.os"
      value="macosx">
      <os family="mac" />
    </condition>
    <condition
      property="guessed.os"
      value="linux">
      <or>
        <os family="unix" />
      </or>
    </condition>
    <!-- if not set above, set to a ridiculous value, that will at least give hint of action to take once it causes a failure -->
    <property
      name="guessed.os"
      value="Value of 'os' could not be determined. 'os' must be set as system variable." />

    <condition
      property="os"
      value="${os}"
      else="${guessed.os}">
      <isset property="os" />
    </condition>

    <!-- luckily, these days, not multiple windowing systems, for common OSes -->
    <condition
      property="guessed.ws"
      value="win32">
      <os family="windows" />
    </condition>
    <condition
      property="guessed.ws"
      value="cocoa">
      <os family="mac" />
    </condition>
    <condition
      property="guessed.ws"
      value="gtk">
      <os family="unix" />
    </condition>
    <!-- if not set above, set to a ridiculous value, that will at least give hint of action to take once it causes a failure -->
    <property
      name="guessed.ws"
      value="Value of 'ws' could not be determined. 'ws' must be set as system variable." />

    <condition
      property="ws"
      value="${ws}"
      else="${guessed.ws}">
      <isset property="ws" />
    </condition>

    <!-- not sure this will work well? -->
    <condition
      property="guessed.arch"
      value="x86_64">
      <or>
        <os arch="x86_64" />
        <os arch="amd64" />
      </or>
    </condition>
    <condition
      property="guessed.arch"
      value="x86">
      <or>
        <os arch="x86" />
        <os arch="i386" />
        <os arch="i586" />
      </or>
    </condition>
    <!-- if not set above, set to a ridiculous value, that will at least give hint of action to take once it causes a failure -->
    <property
      name="guessed.ws"
      value="Value of 'arch' could not be determined. 'arch' must be set as system variable." />

    <condition
      property="arch"
      value="${arch}"
      else="${guessed.arch}">
      <isset property="arch" />
    </condition>

  </target>

  <target
    name="test-getJavaMajorVersion"
    depends="debug-allJavaProperties,debug-allOSProperties,getJavaMajorVersion">
    <printProperty property="javaMajorVersion" />
    <printProperty property="java.version" />
    <printProperty property="java.runtime.version" />
    <printProperty property="java.vm.info" />
    <printProperty property="java.specification.version" />
    <printProperty property="java.vendor" />
    <printProperty property="ant.version" />
    <printProperty property="ant.java.version" />
    <!-- <antcall target="printMainProperties" /> -->
  </target>

  <target
    name="test-initOSes"
    depends="debug-allProperties,initOSes">
    <printProperty property="os" />
    <printProperty property="ws" />
    <printProperty property="arch" />
  </target>

  <target
    name="test-all"
    depends="init,test-initOSes,test-getJavaMajorVersion">
  </target>

  <target
    name="debug-allProperties"
    depends="init">
    <echoproperties />
  </target>
</project>

Back to the top