Subversion Repositories DevTools

Rev

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

Rev 7201 Rev 7231
Line 990... Line 990...
990
                        //      WIPs/RIPPLES done in the course of doing the basic plan
990
                        //      WIPs/RIPPLES done in the course of doing the basic plan
991
                        mLogger.warn("Use basic plan, then modified full plan");
991
                        mLogger.warn("Use basic plan, then modified full plan");
992
                        mBuildOrder.addAll(basicPlan.planCollection);
992
                        mBuildOrder.addAll(basicPlan.planCollection);
993
 
993
 
994
                        fullPlan = postRipplePlan("Full-Ripples", basicPlan, false);
994
                        fullPlan = postRipplePlan("Full-Ripples", basicPlan, false);
-
 
995
                        
-
 
996
                        //  Insert a marker package to indicate a 'newPlan'
-
 
997
                        PlannedPackage pp = new PlannedPackage( new Package() );
-
 
998
                        pp.mBuildLevel = -1;
-
 
999
                        mBuildOrder.add(pp);                     
-
 
1000
 
995
                        mBuildOrder.addAll(fullPlan.planCollection);
1001
                        mBuildOrder.addAll(fullPlan.planCollection);
996
                        
1002
                        
997
                    } else {
1003
                    } else {
998
                        //  Use the full plan
1004
                        //  Use the full plan
999
                        mLogger.warn("Use full plan");
1005
                        mLogger.warn("Use full plan");
Line 1206... Line 1212...
1206
                 
1212
                 
1207
                 //
1213
                 //
1208
                 //  Examine the build order and 'delete' entries with a -ve mBuildFile
1214
                 //  Examine the build order and 'delete' entries with a -ve mBuildFile
1209
                 //  These will be the product of pvApply errors and the packages that depend on them
1215
                 //  These will be the product of pvApply errors and the packages that depend on them
1210
                 //
1216
                 //
1211
                 //  Insert a dummy marker between build plans
-
 
1212
                 //     Detect the index of the insertion point
-
 
1213
                 //
-
 
1214
                 int lastLevel = -1;
-
 
1215
                 int listIndex = 0;
-
 
1216
                 int insertMarker = -1;
-
 
1217
                 for (Iterator<PlannedPackage> it = mBuildOrder.listIterator(); it.hasNext(); )
1217
                 for (Iterator<PlannedPackage> it = mBuildOrder.listIterator(); it.hasNext(); )
1218
                 {
1218
                 {
1219
                     PlannedPackage pkg = it.next();
1219
                     PlannedPackage pkg = it.next();
1220
                     if (pkg.mPkg.mBuildFile < 0)
1220
                     if (pkg.mPkg.mBuildFile < 0)
1221
                     {
1221
                     {
1222
                         it.remove();
1222
                         it.remove();
1223
                         mLogger.warn("Purge mBuildOrder {}", pkg.mPkg);
1223
                         mLogger.warn("Purge mBuildOrder {}", pkg.mPkg);
1224
                         continue;
1224
                         continue;
1225
                     }
1225
                     }
1226
                     
-
 
1227
                     if ( pkg.mBuildLevel < lastLevel && insertMarker < 0)
-
 
1228
                     {
-
 
1229
                         insertMarker = listIndex;
-
 
1230
                     }
-
 
1231
                     listIndex++;
-
 
1232
                     lastLevel = pkg.mBuildLevel;
-
 
1233
                 }
1226
                 }
1234
                 
1227
                 
-
 
1228
                 //
-
 
1229
                 // If the first entry is a 'new Plan' marker, then remove it
-
 
1230
                 //     It will be the result of applyPvs that failed
1235
                 if (insertMarker > 0)
1231
                 if ( !mBuildOrder.isEmpty() )
1236
                 {
1232
                 {
1237
                     PlannedPackage pp = new PlannedPackage( new Package() );
1233
                     PlannedPackage pkg = mBuildOrder.get(0);
1238
                     pp.mBuildLevel = -1;
1234
                     if (pkg.mBuildLevel < 0)
1239
                     mBuildOrder.add(insertMarker, pp);                     
1235
                         mBuildOrder.remove(0);
1240
                 }
1236
                 }
1241
                
1237
                
1242
                //
1238
                //
1243
                //  To fit in with the old algorithm ( ie: could be improved )
1239
                //  To fit in with the old algorithm ( ie: could be improved )
1244
                //  Insert marks into all packages
1240
                //  Insert marks into all packages
Line 1512... Line 1508...
1512
        //  Basically:
1508
        //  Basically:
1513
        //      Scan the collection looking for any package whose dependencies do not exist in the collection
1509
        //      Scan the collection looking for any package whose dependencies do not exist in the collection
1514
        //      or they have been allocated a build level.
1510
        //      or they have been allocated a build level.
1515
        //
1511
        //
1516
        //      Need to do this in waves so that we can correctly determine the build level.
1512
        //      Need to do this in waves so that we can correctly determine the build level.
-
 
1513
        //
1517
        //  
1514
        //
-
 
1515
        //  Need two metrics out of this process
-
 
1516
        //      buildGroup - all packages in a given group depend entirely on packages in lower numbers groups
-
 
1517
        //      buildLevel - This is a function of the number of parallel builds that can be performed
-
 
1518
        //                   and 
-
 
1519
        
-
 
1520
        
1518
        //
1521
        //
1519
        for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1522
        for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1520
        {
1523
        {
1521
            PlannedPackage p = it.next();
1524
            PlannedPackage p = it.next();
1522
            p.mProcessed = true;
1525
            p.mProcessed = true;
Line 1556... Line 1559...
1556
                    }
1559
                    }
1557
                }
1560
                }
1558
            }
1561
            }
1559
            
1562
            
1560
            //  Mark all the packages at this level as have been processed
1563
            //  Mark all the packages at this level as have been processed
1561
            //  Cannot do this while we are determining the packages in the level 
1564
            //  Cannot do this while we are determining the packages in the level
1562
            for (Iterator<PlannedPackage> it = thisLevel.iterator(); it.hasNext(); )
1565
            for (Iterator<PlannedPackage> it = thisLevel.iterator(); it.hasNext(); )
1563
            {
1566
            {
1564
                PlannedPackage p = it.next();
1567
                PlannedPackage p = it.next();
1565
                p.mProcessed = false;
1568
                p.mProcessed = false;
1566
            }
1569
            }
Line 1660... Line 1663...
1660
    }
1663
    }
1661
 
1664
 
1662
    /** 
1665
    /** 
1663
     *  Calculate a collection of packages that actively use the named package
1666
     *  Calculate a collection of packages that actively use the named package
1664
     *  A consumer package does NOT use the named package,
1667
     *  A consumer package does NOT use the named package,
-
 
1668
     *      If the package is marked as advisoryRipple
1665
     *      If the consumer is an SDK or is Pegged
1669
     *      If the consumer is an SDK or is Pegged
1666
     *      If the consumer is marked as advisoryRipple
-
 
1667
     *      If the consumer cannot be built
1670
     *      If the consumer cannot be built
-
 
1671
     *      
-
 
1672
     *  Used when planning which packages need to be built
1668
     *   
1673
     *   
1669
     * @param pkg - Package to process
1674
     * @param pkg - Package to process
1670
     * @param planCollection - collection of packages to scan
1675
     * @param planCollection - collection of packages to scan
1671
     *
1676
     *
1672
     * @return A collection of packages that actively 'use' the specified package
1677
     * @return A collection of packages that actively 'use' the specified package
1673
 
1678
 
1674
     */
1679
     */
1675
    private ArrayList<PlannedPackage> usedByPackages(PlannedPackage pkg, ArrayList<PlannedPackage> planCollection) {
1680
    private ArrayList<PlannedPackage> usedByPackages(PlannedPackage pkg, ArrayList<PlannedPackage> planCollection) {
1676
        
-
 
1677
        ArrayList<PlannedPackage> usedBy = new ArrayList<PlannedPackage>();
1681
        ArrayList<PlannedPackage> usedBy = new ArrayList<PlannedPackage>();
1678
        
1682
        
1679
        for (Iterator<PlannedPackage> it = planCollection.iterator(); it.hasNext(); )
1683
        //  If 'this' package is marked as advisory, then don't ripple its consumers
-
 
1684
        if ( !pkg.mPkg.mAdvisoryRipple )
1680
        {
1685
        {
1681
            PlannedPackage p = it.next();
-
 
1682
            
1686
            
1683
            //  Is this package 'actively used' in the current build
1687
            for (Iterator<PlannedPackage> it = planCollection.iterator(); it.hasNext(); )
1684
            if (p.mPkg.mBuildFile >= 0)
-
 
1685
            {
1688
            {
-
 
1689
                PlannedPackage p = it.next();
-
 
1690
 
1686
                for (Iterator<PkgDependency> it2 = p.mPkg.mDependencyCollection.iterator(); it2.hasNext(); )
1691
                //  If the (potential) consumer is an SDK or is Pegged, then we don't ripple its consumer
-
 
1692
                if  (!(p.mPkg.mIsSdk || p.mPkg.mIsPegged))
1687
                {
1693
                {
-
 
1694
                    //  Is this package 'actively used' in the current build
-
 
1695
                    if (p.mPkg.mBuildFile >= 0)
-
 
1696
                    {
-
 
1697
                        for (Iterator<PkgDependency> it2 = p.mPkg.mDependencyCollection.iterator(); it2.hasNext(); )
-
 
1698
                        {
1688
                    PkgDependency depEntry = it2.next();
1699
                            PkgDependency depEntry = it2.next();
1689
                    if (  pkg.mPkg.mAlias.compareTo( depEntry.alias ) == 0  ) {
1700
                            if (  pkg.mPkg.mAlias.compareTo( depEntry.alias ) == 0  ) {
1690
                        //  Have found a consumer of 'pkg'
1701
                                //  Have found a consumer of 'pkg'
-
 
1702
                                
1691
                        usedBy.add(p);
1703
                                usedBy.add(p);
-
 
1704
                                break;
1692
                        break;
1705
                            }
-
 
1706
                        }
1693
                    }
1707
                    }
1694
                }
1708
                }
1695
            }
1709
            }
1696
        }
1710
        }
1697
        
1711
        
1698
        return usedBy;
1712
        return usedBy;
1699
    }
1713
    }
1700
    
1714
    
1701
    /** 
1715
    /** 
1702
     *  Calculate a collection of packages that use the named package
1716
     *  Calculate a collection of packages that use the named package
-
 
1717
     *  
-
 
1718
     *  Used when determining which packages to exclude from a build
1703
     *   
1719
     *   
1704
     * @param pkg - Package to process
1720
     * @param pkg - Package to process
1705
     * @param packageCollection - collection of packages to scan
1721
     * @param packageCollection - collection of packages to scan
1706
     *
1722
     *
1707
     * @return A collection of packages that actively 'use' the specified package
1723
     * @return A collection of packages that actively 'use' the specified package