Subversion Repositories DevTools

Rev

Rev 7186 | Rev 7341 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7186 Rev 7333
Line 4... Line 4...
4
import java.io.FileInputStream;
4
import java.io.FileInputStream;
5
import java.io.FileOutputStream;
5
import java.io.FileOutputStream;
6
import java.io.FileWriter;
6
import java.io.FileWriter;
7
import java.io.IOException;
7
import java.io.IOException;
8
import java.util.ArrayList;
8
import java.util.ArrayList;
-
 
9
import java.util.HashMap;
9
import java.util.Iterator;
10
import java.util.Iterator;
-
 
11
import java.util.Map;
10
import java.util.Properties;
12
import java.util.Properties;
11
 
13
 
12
import org.slf4j.Logger;
14
import org.slf4j.Logger;
13
import org.slf4j.LoggerFactory;
15
import org.slf4j.LoggerFactory;
14
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.BuildException;
Line 21... Line 23...
21
import com.erggroup.buildtool.abt.RemoteExecution.LogOutput;
23
import com.erggroup.buildtool.abt.RemoteExecution.LogOutput;
22
import com.erggroup.buildtool.smtp.CreateUrls;
24
import com.erggroup.buildtool.smtp.CreateUrls;
23
import com.erggroup.buildtool.smtp.Smtpsend;
25
import com.erggroup.buildtool.smtp.Smtpsend;
24
import com.erggroup.buildtool.utilities.CommandBuilder;
26
import com.erggroup.buildtool.utilities.CommandBuilder;
25
import com.erggroup.buildtool.utilities.ElapseTime;
27
import com.erggroup.buildtool.utilities.ElapseTime;
-
 
28
import com.erggroup.buildtool.utilities.StringAppender;
26
import com.erggroup.buildtool.utilities.utilities;
29
import com.erggroup.buildtool.utilities.utilities;
27
 
30
 
28
public class ABT extends Task
31
public class ABT extends Task
29
{
32
{
30
    private String ls = System.getProperty( "line.separator" );
33
    private String ls = System.getProperty( "line.separator" );
Line 72... Line 75...
72
    private boolean useTestArchive = false;
75
    private boolean useTestArchive = false;
73
    private String loc;
76
    private String loc;
74
    private String unittests;
77
    private String unittests;
75
    private ArrayList<Depend> dependCollection = new ArrayList<Depend> ();
78
    private ArrayList<Depend> dependCollection = new ArrayList<Depend> ();
76
    private ArrayList<BuildInfo> buildInfoCollection = new ArrayList<BuildInfo>();
79
    private ArrayList<BuildInfo> buildInfoCollection = new ArrayList<BuildInfo>();
77
    private StringBuilder owners = new StringBuilder();;
80
    private StringAppender owners = new StringAppender(",");
78
    private Machine mMachine;
81
    private Machine mMachine;
79
    private String logBase;
82
    private String logBase;
80
 
83
 
81
    // set up in execute
84
    // set up in execute
82
    private BuildStandards packageStandard = BuildStandards.NONE;           // Build standard for the package
85
    private BuildStandards packageStandard = BuildStandards.NONE;           // Build standard for the package
Line 496... Line 499...
496
            // jats -locatefile=.jats.packageroot etool jats_metrics -mode=init -rootdir=.
499
            // jats -locatefile=.jats.packageroot etool jats_metrics -mode=init -rootdir=.
497
            // -locate=.jats.packageroot causes jats to cd to the folder containing the file .jats.packageroot
500
            // -locate=.jats.packageroot causes jats to cd to the folder containing the file .jats.packageroot
498
            // this file is created in the -path folder by jats release -extract
501
            // this file is created in the -path folder by jats release -extract
499
            // DEVI 51370 it is essential for metrics branch calculation the metrics utility is started within a static view
502
            // DEVI 51370 it is essential for metrics branch calculation the metrics utility is started within a static view
500
            //
503
            //
501
            command.init("jats" );
504
            command.init("jats" )
502
            command.add( "-locatefile=.jats.packageroot" );
505
                   .add( "-locatefile=.jats.packageroot" )
503
            command.add( "etool", "jats_metrics" );
506
                   .add( "etool", "jats_metrics" )
504
            command.add( "-mode=init" );
507
                   .add( "-mode=init" )
505
            command.add( "-rootdir=." );
508
                   .add( "-rootdir=." );
506
 
509
 
507
            runCommand( "Failure to collect metrics" );
510
            runCommand( "Failure to collect metrics" );
508
        }     
511
        }     
509
    }
512
    }
510
    
513
    
Line 532... Line 535...
532
            command.add( "-out=" + metrics.getAbsolutePath() );
535
            command.add( "-out=" + metrics.getAbsolutePath() );
533
 
536
 
534
            runCommand( "Failure to collect metrics" );
537
            runCommand( "Failure to collect metrics" );
535
        }    
538
        }    
536
    }
539
    }
-
 
540
   
-
 
541
    /** Generate BuildMetrics
-
 
542
     *  
-
 
543
     *  
-
 
544
     * @throws Exception 
-
 
545
     */
-
 
546
    private void genBuildInfo() throws Exception {
-
 
547
        
-
 
548
        // Always delete the (possibly created) output file
-
 
549
        File buildInfo = new File(utilities.catDir(basedir, rtagId + "abtBuildInfo.properties"));
-
 
550
        if ( buildInfo.exists() )
-
 
551
        {
-
 
552
            buildInfo.delete();
-
 
553
        }
-
 
554
        
-
 
555
        //  Generate a complete buildfilter for all the platforms in the build
-
 
556
        //  Build a unique set of platform names
-
 
557
        Map<String,Integer> platforms = new HashMap<String,Integer>();
-
 
558
        for (Iterator<Machine> it=abtData.machineCollection.iterator(); it.hasNext(); )
-
 
559
        {
-
 
560
            Machine ma = it.next();
-
 
561
            String buildFilter[] = ma.getBuildfilter().split("[\\s,]+");
-
 
562
            for (String platform:buildFilter)
-
 
563
            {
-
 
564
                platforms.put( platform, 1 );
-
 
565
            }
-
 
566
        }
-
 
567
        StringAppender buildFilter = new StringAppender(",");
-
 
568
        buildFilter.append(platforms.keySet().iterator());
-
 
569
        
-
 
570
        // Gather build information
-
 
571
        // jats -buildfilter aaa,bbb,ccc -locatefile=.jats.packageroot build buildinfo -buildinfo=file
-
 
572
        command.init("jats" );
-
 
573
        command.add( "-buildfilter", buildFilter.toString());
-
 
574
        addCommandLocate();
-
 
575
        
-
 
576
        if (buildStandard == BuildStandards.JATS )
-
 
577
        {
-
 
578
            command.add( "build", "buildinfo" );
-
 
579
        }
-
 
580
        else if (buildStandard == BuildStandards.ANT )
-
 
581
        {
-
 
582
            command.add( "etool", "antBuildInfo" );
-
 
583
            command.add( "-java=" + javaVersion.getJavaVersion() );
-
 
584
 
-
 
585
        }
-
 
586
        command.add( "-buildinfo=" + buildInfo.getAbsolutePath() );
-
 
587
 
-
 
588
        runCommand( "Failure to generate BuildInfo" );
537
    
589
    }
-
 
590
 
538
    /**
591
    /**
539
     * Generate the build dependency data file.
592
     * Generate the build dependency data file.
540
     * 
593
     * 
541
     * @exception Exception
594
     * @exception Exception
542
     */
595
     */
Line 1431... Line 1484...
1431
                logMsg("execute mailSender: ", mailSender);
1484
                logMsg("execute mailSender: ", mailSender);
1432
 
1485
 
1433
                for (Iterator<Owner> it=abtData.ownerCollection.iterator(); it.hasNext(); )
1486
                for (Iterator<Owner> it=abtData.ownerCollection.iterator(); it.hasNext(); )
1434
                {
1487
                {
1435
                    Owner owner = it.next();
1488
                    Owner owner = it.next();
1436
 
-
 
1437
                    if ( owners.length() > 0 )
-
 
1438
                    {
-
 
1439
                        owners.append(",");
-
 
1440
                    }
-
 
1441
                    owners.append(owner.getEmail());
1489
                    owners.append(owner.getEmail());
1442
                    logMsg("execute owner: ", owner.getEmail());
1490
                    logMsg("execute owner: ", owner.getEmail());
1443
                }
1491
                }
1444
                logMsg("execute owners: ", owners.toString());
1492
                logMsg("execute owners: ", owners.toString());
1445
            }
1493
            }
Line 1681... Line 1729...
1681
                wd = new File( basedir );
1729
                wd = new File( basedir );
1682
 
1730
 
1683
                // only now change the thread working directory back
1731
                // only now change the thread working directory back
1684
                thread.setWorkingDirectory( wd );
1732
                thread.setWorkingDirectory( wd );
1685
 
1733
 
1686
                File buildDirectory = new File(wd + getProject().getProperty("abt_package_location"));
1734
                File buildDirectory = new File(wd, getProject().getProperty("abt_package_location"));
1687
 
1735
 
1688
                if ( buildDirectory.exists() )
1736
                if ( buildDirectory.exists() )
1689
                {
1737
                {
1690
                    // jats jats_vcsrelease -label pkgTag -root=rtag_id/timestamp -tag=timestamp -noprefix -delete=2
1738
                    // jats jats_vcsrelease -label pkgTag -root=rtag_id/timestamp -tag=timestamp -noprefix -delete=2
1691
                    command.init("jats", "jats_vcsrelease" );
1739
                    command.init("jats", "jats_vcsrelease" );
Line 1844... Line 1892...
1844
                //  Init the metrics gathering process
1892
                //  Init the metrics gathering process
1845
                metricsBegin();
1893
                metricsBegin();
1846
                
1894
                
1847
                //  Generate auto.pl or <PackageName>depends.xml file
1895
                //  Generate auto.pl or <PackageName>depends.xml file
1848
                genbuild();
1896
                genbuild();
-
 
1897
                
-
 
1898
                //  Generate BuildInfo
-
 
1899
                genBuildInfo();
1849
    
1900
    
1850
                //  Active build
1901
                //  Active build
1851
                //      Build the target package unless we are simply doing metrics generation
1902
                //      Build the target package unless we are simply doing metrics generation
1852
                //
1903
                //
1853
                if ( !benign )
1904
                if ( !benign )