Subversion Repositories DevTools

Rev

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

Rev 7077 Rev 7078
Line 364... Line 364...
364
	 *     User resets to NULL when the ripple can be resumed. This is stored as an 'n'
364
	 *     User resets to NULL when the ripple can be resumed. This is stored as an 'n'
365
	 * 
365
	 * 
366
	 */
366
	 */
367
    public char mRippleStop;
367
    public char mRippleStop;
368
    
368
    
369
    /**
-
 
370
     *  The calculated ripple build plan for this package
-
 
371
     *  Will not be calculated for all packages, just those of interest
-
 
372
     *  All packages that can (not must) be built when this package is built
-
 
373
     *  The list will not include packages that cannot be built at the moment
-
 
374
     *  
-
 
375
     *  Does not include this package
-
 
376
     */
-
 
377
    public ArrayList<Package> mRipplePlan = null;
-
 
378
    
-
 
379
    /** The duration (seconds) of the last build of this package
369
    /** The duration (seconds) of the last build of this package
380
     *  Used to estimate the cost of building the package
370
     *  Used to estimate the cost of building the package
381
     *  A WIP packages gets the buildTime of the package its based upon
371
     *  A WIP packages gets the buildTime of the package its based upon
382
     */
372
     */
383
    public int mBuildTime;
373
    public int mBuildTime;
384
 
374
 
385
    /** Calculated time ( seconds) that is may take to build this package and then ripple packages that depend on it
-
 
386
     *  both directly and indirectly. Based on mRipplePlan. 
-
 
387
     */
-
 
388
    public int mRippleTime = 0;
-
 
389
    
-
 
390
    /** Used in the calculation of a ripple plan
375
    /** Used in the calculation of a ripple plan
391
     * 
376
     * 
392
     */
377
     */
393
    public int mRippleOrder = 0;
378
    public int mRippleOrder = 0;
394
    
379
    
Line 549... Line 534...
549
     * Constructor for unit test purposes
534
     * Constructor for unit test purposes
550
     * Performs a partial copy of a package - sufficient for test purposes
535
     * Performs a partial copy of a package - sufficient for test purposes
551
     * @param base      - Base package  
536
     * @param base      - Base package  
552
     * @param newPvId   - New pvid of the package
537
     * @param newPvId   - New pvid of the package
553
     */
538
     */
554
    @SuppressWarnings("unchecked")
-
 
-
 
539
 
555
    public Package(int newPvId, Package base) {
540
    public Package(int newPvId, Package base) {
556
        
541
        
557
        mId = newPvId;
542
        mId = newPvId;
558
        mPid = base.mPid;
543
        mPid = base.mPid;
559
        mName = base.mName;
544
        mName = base.mName;
Line 566... Line 551...
566
        mRippleField = base.mRippleField;
551
        mRippleField = base.mRippleField;
567
        mBuildTime = base.mBuildTime;
552
        mBuildTime = base.mBuildTime;
568
        mHasAutomatedUnitTests = base.mHasAutomatedUnitTests;
553
        mHasAutomatedUnitTests = base.mHasAutomatedUnitTests;
569
        mSeqId = base.mSeqId;
554
        mSeqId = base.mSeqId;
570
        
555
        
571
        mBuildFailureEmailCollection = (Vector<String>) base.mBuildFailureEmailCollection.clone();
556
        mBuildFailureEmailCollection = new Vector<String>(base.mBuildFailureEmailCollection);
572
        mPackageDependencyCollection = (Vector<Package>) base.mPackageDependencyCollection.clone();
557
        mPackageDependencyCollection = new Vector<Package>(base.mPackageDependencyCollection);
573
        mDependencyIDCollection = (Vector<Integer>) base.mDependencyIDCollection.clone();
558
        mDependencyIDCollection = new Vector<Integer>(base.mDependencyIDCollection);
574
        mDependencyCollection = (Vector<String>) base.mDependencyCollection.clone();
559
        mDependencyCollection = new Vector<String>(base.mDependencyCollection);
575
        mBuildStandardCollection = (Vector<BuildStandard>) base.mBuildStandardCollection.clone();
560
        mBuildStandardCollection = new Vector<BuildStandard>( base.mBuildStandardCollection);
576
        
561
        
577
    }
562
    }
-
 
563
    
-
 
564
    /** Generate a nice text string useful for debugging
-
 
565
     * 
-
 
566
     */
-
 
567
    public String toString()
-
 
568
    {
-
 
569
        return mId + ":" + mAlias;
-
 
570
    }
578
 
571
 
579
    /**
572
    /**
580
     * accessor for unit test purposes
573
     * accessor for unit test purposes
581
     */
574
     */
582
    public int getId()
575
    public int getId()
Line 1465... Line 1458...
1465
        mLogger.error("completeTest. Returning");
1458
        mLogger.error("completeTest. Returning");
1466
    }
1459
    }
1467
 
1460
 
1468
 
1461
 
1469
    /**
1462
    /**
1470
     * Returns true if the package is a part of a circular dependency
1463
     * Returns true if the package is a part of a circular dependency within the provided collection
1471
     * 
1464
     * 
1472
     * If the package depends on a package with a circular dependency then the function
1465
     * If the package depends on a package with a circular dependency then the function
1473
     * will return false.
1466
     * will return false.
1474
     */
1467
     */
1475
    public boolean hasCircularDependency(RippleEngine ripEng)
1468
    public boolean hasCircularDependency(ArrayList<Package> packageCollection)
1476
    {
1469
    {
1477
        mLogger.debug("hasCircularDependency: {}", mAlias);
1470
        mLogger.debug("hasCircularDependency: {}", mAlias);
1478
        boolean retVal = detectCircularDependency(mAlias, ripEng, null);
1471
        boolean retVal = detectCircularDependency(mAlias, packageCollection, null);
1479
        mLogger.info("hasCircularDependency returned {} ", retVal);
1472
        mLogger.info("hasCircularDependency returned {} ", retVal);
1480
        return retVal;
1473
        return retVal;
1481
    }
1474
    }
-
 
1475
    
-
 
1476
    /** Reset the circular dependency testing information
-
 
1477
     * 
-
 
1478
     * @param packageCollection - Collection of packages to process
-
 
1479
     */
-
 
1480
    public static void resetCircularDependency(ArrayList<Package> packageCollection)
-
 
1481
    {
-
 
1482
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
-
 
1483
        {
-
 
1484
            Package p = it.next();
-
 
1485
            p.mCheckedCircularDependency = false;
-
 
1486
            p.mHasCircularDependency = false;
-
 
1487
            p.mBreadCrumb = 0;
-
 
1488
        }
-
 
1489
    }
1482
 
1490
 
1483
    /**
1491
    /**
1484
     * Returns true is a part of a circular dependency
1492
     * Returns true is a part of a circular dependency
1485
     * Will examine all the packages sub dependencies and mark those that do have a
1493
     * Will examine all the packages sub dependencies and mark those that do have a
1486
     * circular dependency.
1494
     * circular dependency.
Line 1491... Line 1499...
1491
     * 
1499
     * 
1492
     *  Assumes that the caller will walk ALL packages and flag those with a circular
1500
     *  Assumes that the caller will walk ALL packages and flag those with a circular
1493
     *  dependence AND those that depend on that package.
1501
     *  dependence AND those that depend on that package.
1494
     * 
1502
     * 
1495
     */
1503
     */
1496
    private boolean detectCircularDependency(String alias, RippleEngine ripEng, Package parent)
1504
    private boolean detectCircularDependency(String alias, ArrayList<Package> packageCollection, Package parent)
1497
    {
1505
    {
1498
        mLogger.debug("detectCircularDependency");
1506
        mLogger.debug("detectCircularDependency");
1499
        boolean retVal = false;
1507
        boolean retVal = false;
1500
        
1508
        
1501
        // if this package has yet to be checked for circular dependency
1509
        // if this package has yet to be checked for circular dependency
Line 1521... Line 1529...
1521
                
1529
                
1522
                // Recurse down the dependencies and sub dependencies
1530
                // Recurse down the dependencies and sub dependencies
1523
                for (Iterator<String> it2 = mDependencyCollection.iterator(); it2.hasNext();)
1531
                for (Iterator<String> it2 = mDependencyCollection.iterator(); it2.hasNext();)
1524
                {
1532
                {
1525
                    String dependencyAlias = it2.next();
1533
                    String dependencyAlias = it2.next();
-
 
1534
                    
-
 
1535
                    // Scan the collection looking for the specified package alias
-
 
1536
                    for (Iterator<Package> it = packageCollection.iterator(); it.hasNext();)
-
 
1537
                    {
-
 
1538
                        Package dependency = it.next();
-
 
1539
 
1526
                    Package dependency = ripEng.findPackage(dependencyAlias);
1540
                        if ( dependency.mAlias.compareTo( dependencyAlias ) == 0 )
-
 
1541
                        {
1527
                    dependency.detectCircularDependency(alias, ripEng, this);
1542
                            dependency.detectCircularDependency(alias, packageCollection, this);
-
 
1543
                            break;
-
 
1544
                        }
-
 
1545
                    }
1528
                }
1546
                }
1529
                
1547
                
1530
                if (mBreadCrumb == 2)
1548
                if (mBreadCrumb == 2)
1531
                {
1549
                {
1532
                    mHasCircularDependency = true;
1550
                    mHasCircularDependency = true;
Line 1568... Line 1586...
1568
    {
1586
    {
1569
        for (Iterator<Package> it = al.iterator(); it.hasNext(); )
1587
        for (Iterator<Package> it = al.iterator(); it.hasNext(); )
1570
        {
1588
        {
1571
            Package p = it.next();
1589
            Package p = it.next();
1572
            p.mIsProcessed = false;
1590
            p.mIsProcessed = false;
-
 
1591
            p.mProcessed = false;
-
 
1592
            if (p.mBuildFile > 0)
-
 
1593
                p.mBuildFile = 0;
-
 
1594
            p.mRippleOrder = 0;
1573
        }
1595
        }
1574
    }
1596
    }
1575
    
1597
    
1576
    /** Reset the rippleOrder flag on a collection of packages
1598
    /** Reset the rippleOrder flag on a collection of packages
1577
     * 
1599
     * 
Line 1598... Line 1620...
1598
        public int compare (Package p1, Package p2) {
1620
        public int compare (Package p1, Package p2) {
1599
                return p1.mSeqId - p2.mSeqId;
1621
                return p1.mSeqId - p2.mSeqId;
1600
        }
1622
        }
1601
    };
1623
    };
1602
    
1624
    
1603
    /** Comparator for sorting package collections by mRippleTimme and mRippleOrder
1625
    /** Comparator for sorting package collections by mBuildTime and mRippleOrder
1604
     *  Preserve rippleOrder
1626
     *  Preserve rippleOrder
1605
     *  
1627
     *  
1606
     */
1628
     */
1607
    public static final Comparator<Package> PlanComparator = new Comparator<Package>() {
1629
    public static final Comparator<Package> BuildOrderComparitor = new Comparator<Package>() {
1608
        
1630
        
1609
        /**
1631
        /**
1610
         * Returns -ve: p1 is less than p2
1632
         * Returns -ve: p1 is less than p2
1611
         *           0: p1 = p2
1633
         *           0: p1 = p2
1612
         *         +ve: p1 > p2
1634
         *         +ve: p1 > p2
1613
         */
1635
         */
1614
        public int compare (Package p1, Package p2) {
1636
        public int compare (Package p1, Package p2) {
1615
            if (p1.mRippleOrder == p2.mRippleOrder)
1637
            if (p1.mRippleOrder == p2.mRippleOrder)
1616
            {
1638
            {
1617
                return p1.mRippleTime - p2.mRippleTime;
1639
                return p1.mBuildTime - p2.mBuildTime;
1618
            }
1640
            }
1619
            
1641
            
1620
            return p1.mRippleOrder - p2.mRippleOrder;
1642
            return p1.mRippleOrder - p2.mRippleOrder;
1621
            
1643
            
1622
        }
1644
        }
1623
    };
1645
    };
1624
    
1646
    
1625
    /** Comparator for sorting package collections by mRippleTimme (only)
-
 
1626
     *  
-
 
1627
     */
-
 
1628
    public static final Comparator<Package> RippleTimeComparator = new Comparator<Package>() {
-
 
1629
        
-
 
1630
        /**
-
 
1631
         * Returns -ve: p1 is less than p2
-
 
1632
         *           0: p1 = p2
-
 
1633
         *         +ve: p1 > p2
-
 
1634
         */
-
 
1635
        public int compare (Package p1, Package p2) {
-
 
1636
            return p1.mRippleTime - p2.mRippleTime;
-
 
1637
        }
-
 
1638
    };
-
 
1639
    
-
 
1640
 
-
 
1641
    /**
1647
    /**
1642
     * entity class supporting the ERG version numbering standard:
1648
     * entity class supporting the ERG version numbering standard:
1643
     * <major>.<minor>.<patch/build> patch/build is at least a 4 digit number
1649
     * <major>.<minor>.<patch/build> patch/build is at least a 4 digit number
1644
     * whose last 3 digits represent the build
1650
     * whose last 3 digits represent the build
1645
     */
1651
     */