Subversion Repositories DevTools

Rev

Rev 4123 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4123 Rev 4280
Line 2... Line 2...
2
 
2
 
3
import com.erggroup.buildtool.daemon.ResumeTimerTask;
3
import com.erggroup.buildtool.daemon.ResumeTimerTask;
4
import com.erggroup.buildtool.ripple.ReleaseManager;
4
import com.erggroup.buildtool.ripple.ReleaseManager;
5
import com.erggroup.buildtool.smtp.Smtpsend;
5
import com.erggroup.buildtool.smtp.Smtpsend;
6
import com.erggroup.buildtool.ripple.RippleEngine;
6
import com.erggroup.buildtool.ripple.RippleEngine;
7
import com.erggroup.buildtool.ripple.MutableString;
-
 
-
 
7
 
8
 
8
 
9
import java.io.BufferedReader;
9
import java.io.BufferedReader;
10
import java.io.File;
10
import java.io.File;
11
import java.io.FileNotFoundException;
11
import java.io.FileNotFoundException;
12
import java.io.FileOutputStream;
12
import java.io.FileOutputStream;
Line 51... Line 51...
51
  /**
51
  /**
52
   * @aggregation composite
52
   * @aggregation composite
53
   */
53
   */
54
  protected ReleaseManager mReleaseManager;
54
  protected ReleaseManager mReleaseManager;
55
 
55
 
56
  /**configured GBEBUILDFILTER for this BuildThread
-
 
57
   * @attribute
-
 
58
   */
-
 
59
  protected String mGbebuildfilter = null;
-
 
60
 
-
 
61
  /**unit test support
56
  /**unit test support
62
   * @attribute
57
   * @attribute
63
   */
58
   */
64
  protected String mUnitTest = "";
59
  protected String mUnitTest = "";
65
 
60
 
Line 665... Line 660...
665
 
660
 
666
  /**abstract method
661
  /**abstract method
667
   */
662
   */
668
  protected abstract char getMode();
663
  protected abstract char getMode();
669
 
664
 
670
  /**injects GBE_BUILDFILTER into the passed buildFileContent
-
 
-
 
665
  /**
671
   * builds a buildFile from the buildFileContent
666
   * builds a buildFile from the buildFileContent
672
   * triggers ant to operate on the buildFile
667
   * triggers ant to operate on the buildFile
673
   */
668
   */
674
  protected void deliverChange(String buildFileContent, String target, boolean master)
669
  protected void deliverChange(String buildFileContent, String target, boolean master)
675
  {
670
  {
Line 688... Line 683...
688
    boolean logError = true;
683
    boolean logError = true;
689
    Project p = new Project();
684
    Project p = new Project();
690
    
685
    
691
    try
686
    try
692
    {
687
    {
-
 
688
      //    AbtSetUp
693
      // clear the file contents
689
      //    Create the build's xml file
-
 
690
      //
694
      if ( buildFileContent != null && target != null && target.compareTo("AbtSetUp") == 0 )
691
      if ( buildFileContent != null && target != null && target.compareTo("AbtSetUp") == 0 )
695
      {
692
      {
696
        FileOutputStream buildFileOutputStream = new FileOutputStream(buildFile, false);
693
        FileOutputStream buildFileOutputStream = new FileOutputStream(buildFile, false);
697
        buildFileOutputStream.close();
694
        buildFileOutputStream.close();
698
      
695
      
699
        StringReader buildFileContentStringReader = new StringReader(buildFileContent);
696
        StringReader buildFileContentStringReader = new StringReader(buildFileContent);
700
        BufferedReader buildFileBufferedReader = new BufferedReader(buildFileContentStringReader);
697
        BufferedReader buildFileBufferedReader = new BufferedReader(buildFileContentStringReader);
701
        
698
        
702
        // sanitise the buildFileContent
699
        // sanitise the buildFileContent
703
        // it may contain line.separators of "\n", "\r", or "\r\n" variety, depending on the location of the ripple engine
700
        //      it may contain line.separators of "\n", "\r", or "\r\n" variety, 
-
 
701
        //      depending on the location of the ripple engine
704
        String sanitisedBFC = new String();
702
        String sanitisedBFC = new String();
705
        String lf = new String( System.getProperty("line.separator") );
703
        String lf = new String( System.getProperty("line.separator") );
706
        int lineCount = 0;
-
 
707
        String line = new String();
704
        String line = new String();
708
        
705
        
709
        while( ( line = buildFileBufferedReader.readLine() ) != null)
706
        while( ( line = buildFileBufferedReader.readLine() ) != null)
710
        {
707
        {
711
          sanitisedBFC += line + lf;
708
          sanitisedBFC += line + lf;
712
          lineCount++;
-
 
713
          
-
 
714
          if ( lineCount == 2 )
-
 
715
          {
-
 
716
            // have read the first two lines
-
 
717
            String inject = "<property name=\"abt_MASTER\" value=\"";
-
 
718
            
-
 
719
            if ( master )
-
 
720
            {
-
 
721
              inject += "yes\"/>" + lf;
-
 
722
            }
-
 
723
            else
-
 
724
            {
-
 
725
              inject += "no\"/>" + lf;
-
 
726
            }
-
 
727
                        
-
 
728
            // insert a GBE_BUILDFILTER property if necessary
-
 
729
            if ( mGbebuildfilter != null && mGbebuildfilter.length() > 0 )
-
 
730
            {
-
 
731
              inject += "<property name=\"abt_GBE_BUILDFILTER\" value=\"" + mGbebuildfilter + "\"/>" + lf;
-
 
732
            }
-
 
733
            
-
 
734
            mLogger.info("deliverChange injecting " + inject);
-
 
735
            sanitisedBFC += inject;
-
 
736
          }
-
 
737
        }
709
        }
738
        buildFileBufferedReader.close();
710
        buildFileBufferedReader.close();
739
        FileWriter buildFileWriter = new FileWriter(buildFile);
711
        FileWriter buildFileWriter = new FileWriter(buildFile);
740
        buildFileWriter.write(sanitisedBFC);
712
        buildFileWriter.write(sanitisedBFC);
741
        buildFileWriter.close();
713
        buildFileWriter.close();
Line 850... Line 822...
850
    {
822
    {
851
      // do not run AbtSetUp on slave in metrics gathering mode
823
      // do not run AbtSetUp on slave in metrics gathering mode
852
      return;
824
      return;
853
    }
825
    }
854
    
826
    
855
    MutableString buildFilter = new MutableString();
-
 
856
    mReleaseManager.queryBuildFilter(mRconId, buildFilter);
-
 
857
    mGbebuildfilter = buildFilter.value;
-
 
858
 
-
 
859
    // run ant on the AbtSetUp target
827
    // run ant on the AbtSetUp target
860
    deliverChange(content, "AbtSetUp", master);
828
    deliverChange(content, "AbtSetUp", master);
861
  }
829
  }
862
  
830
  
863
  /**
831
  /**
Line 873... Line 841...
873
     "Cause: " + cause + "<p><hr>";
841
     "Cause: " + cause + "<p><hr>";
874
     
842
     
875
     try
843
     try
876
     {
844
     {
877
       Smtpsend.send(
845
       Smtpsend.send(
878
       rippleEngine.mMailServer, // mailServer
846
       rippleEngine.mMailServer,        // mailServer
879
       rippleEngine.mMailSender, // source
847
       rippleEngine.mMailSender,        // source
880
       rippleEngine.mGlobalTarget, // target
848
       rippleEngine.mGlobalTarget,      // target (list)
881
       null, // cc
849
       null,                            // cc
882
       null, // bcc
850
       null,                            // bcc
883
       "BUILD DAEMON INDEFINITE PAUSE", // subject
851
       "BUILD DAEMON INDEFINITE PAUSE", // subject
884
       body, // body
852
       body,                            // body
885
       null // attachment
853
       null                             // attachment
886
       );
854
       );
887
     }
855
     }
888
     catch( Exception e )
856
     catch( Exception e )
889
     {
857
     {
890
     }
858
     }