Subversion Repositories DevTools

Rev

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

Rev 7093 Rev 7094
Line 1042... Line 1042...
1042
                }
1042
                }
1043
                
1043
                
1044
                //  Now have an mBuildOrder
1044
                //  Now have an mBuildOrder
1045
                //  Mark the first package in the build order as the one to be built
1045
                //  Mark the first package in the build order as the one to be built
1046
                //
1046
                //
-
 
1047
                //  
-
 
1048
                //  
1047
                Package build = ReleaseManager.NULL_PACKAGE;
1049
                Package build = ReleaseManager.NULL_PACKAGE;
1048
                if (!mBuildOrder.isEmpty()) {
1050
                if (!mBuildOrder.isEmpty()) {
1049
                    build = mBuildOrder.get(0).mPkg;
1051
                    build = mBuildOrder.get(0).mPkg;
1050
                    build.mBuildFile = 1;
1052
                    build.mBuildFile = 1;
1051
                    
1053
                    
Line 1165... Line 1167...
1165
                                 {
1167
                                 {
1166
                                     BuildExclusion buildExclusion = new BuildExclusion(pkg.mId, p.mId, null, p.mTestBuildInstruction);
1168
                                     BuildExclusion buildExclusion = new BuildExclusion(pkg.mId, p.mId, null, p.mTestBuildInstruction);
1167
                                     it.add(buildExclusion);
1169
                                     it.add(buildExclusion);
1168
                                     mLogger.info("Indirectly Excluded Package {}", pkg.mAlias);  
1170
                                     mLogger.info("Indirectly Excluded Package {}", pkg.mAlias);  
1169
 
1171
 
1170
                                     ArrayList<Package> usedBy = usedByAnyPackages(p, mPackageCollectionAll );
1172
                                     ArrayList<Package> usedBy = usedByAnyPackages(pkg, mPackageCollectionAll );
1171
                                     toExclude.addAll(usedBy);
1173
                                     toExclude.addAll(usedBy);
1172
                                 }
1174
                                 }
1173
                             }
1175
                             }
1174
                         }
1176
                         }
1175
                     }
1177
                     }
Line 1252... Line 1254...
1252
     * 
1254
     * 
1253
     * @return
1255
     * @return
1254
     */
1256
     */
1255
    private PlanResults planCollection(String name, ArrayList<Package> packageCollection, boolean mode)
1257
    private PlanResults planCollection(String name, ArrayList<Package> packageCollection, boolean mode)
1256
    {
1258
    {
-
 
1259
        Phase phase = new Phase("PlanCollection"); 
1257
        ArrayList<PlannedPackage> ripplePlan = new ArrayList<PlannedPackage>();
1260
        ArrayList<PlannedPackage> ripplePlan = new ArrayList<PlannedPackage>();
1258
        PlanResults results = new PlanResults();
1261
        PlanResults results = new PlanResults();
1259
 
1262
 
1260
        //  Reset flags used in the calculations
1263
        //  Reset flags used in the calculations
1261
        Package.resetProcessed(packageCollection);
1264
        Package.resetProcessed(packageCollection);
1262
        
1265
        
1263
        //  Exclude all packages that cannot be built and all packages that depend on them
1266
        //  Exclude all packages that cannot be built and all packages that depend on them
1264
        //      First find packages to be directly excluded
1267
        //      First find packages to be directly excluded
1265
        ArrayList<Package>exclude = new ArrayList<Package>();
1268
        ArrayList<Package>exclude = new ArrayList<Package>();
-
 
1269
        phase.setPhase("Exclude Unbuildable");
1266
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
1270
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
1267
        {
1271
        {
1268
            Package p = it.next();
1272
            Package p = it.next();
1269
            if ( p.mBuildFile == -8 ) {
1273
            if ( p.mBuildFile == -8 ) {
1270
 
1274
 
Line 1280... Line 1284...
1280
            }
1284
            }
1281
        }
1285
        }
1282
        
1286
        
1283
        //  Exclude packages that have failed to be built
1287
        //  Exclude packages that have failed to be built
1284
        //      These are recorded in mBuildExclusionCollection
1288
        //      These are recorded in mBuildExclusionCollection
-
 
1289
        phase.setPhase("Exclude Build Failures");
1285
        for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
1290
        for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
1286
        {
1291
        {
1287
            BuildExclusion be = it.next();
1292
            BuildExclusion be = it.next();
-
 
1293
            mLogger.error("BE: {}", be);
1288
            if ( be.isABuildError() )
1294
            if ( !be.isAIndirectError() )
1289
            {
1295
            {
1290
                for (Iterator<Package> it1 = packageCollection.iterator(); it1.hasNext(); )
1296
                for (Iterator<Package> it1 = packageCollection.iterator(); it1.hasNext(); )
1291
                {
1297
                {
1292
                    Package p = it1.next();
1298
                    Package p = it1.next();
1293
                    if (p.mBuildFile >= 0 && p.mId == be.mId) {
1299
                    if (p.mBuildFile >= 0 && p.mId == be.mId) {
1294
                        p.mBuildFile  = -3;
1300
                        p.mBuildFile  = -3;
-
 
1301
                        mLogger.error("AddExclude {}",p);
1295
                        exclude.add(p);
1302
                        exclude.add(p);
1296
                        break;
1303
                        break;
1297
                    }
1304
                    }
1298
                }
1305
                }
1299
            }
1306
            }
1300
        }
1307
        }
1301
 
1308
 
1302
        
1309
        
1303
        //  Process the list of packages to be excluded
1310
        //  Process the list of packages to be excluded
1304
        //  Add to the list packages that depend on the excluded package that have not already been excluded
1311
        //  Add to the list packages that depend on the excluded package that have not already been excluded
-
 
1312
        phase.setPhase("ExcludeAllUsed");
1305
        while( !exclude.isEmpty() )
1313
        while( !exclude.isEmpty() )
1306
        {
1314
        {
1307
            Package p = exclude.remove(0);
1315
            Package p = exclude.remove(0);
1308
            p.mProcessed = true;
1316
            p.mProcessed = true;
1309
            p.mIsProcessed = true;
1317
            p.mIsProcessed = true;
Line 1330... Line 1338...
1330
        //  Process the list and determine packages that we can build right now
1338
        //  Process the list and determine packages that we can build right now
1331
        //      ie: they have not been excluded, have not already been discovered and do not depend on any package in the collection
1339
        //      ie: they have not been excluded, have not already been discovered and do not depend on any package in the collection
1332
        //      Continue to do this until all packages have been extracted
1340
        //      Continue to do this until all packages have been extracted
1333
        //      Allocate build levels as we go
1341
        //      Allocate build levels as we go
1334
        //
1342
        //
-
 
1343
        phase.setPhase("Determine Build Order");
1335
        boolean allProcessed = false;
1344
        boolean allProcessed = false;
1336
        int buildLevel = 1;
1345
        int buildLevel = 1;
1337
 
1346
 
1338
        do
1347
        do
1339
        {
1348
        {
Line 1436... Line 1445...
1436
        //  Now we have a collection packages that we can build right now
1445
        //  Now we have a collection packages that we can build right now
1437
        //      The packages currently have a build level set into mBuildFile
1446
        //      The packages currently have a build level set into mBuildFile
1438
        //
1447
        //
1439
        if (mDaemon)
1448
        if (mDaemon)
1440
        {
1449
        {
-
 
1450
            phase.setPhase("Calc Build Order");
-
 
1451
            //
1441
            //  Determine if we have a reason to build anything in this collection of buildable packages
1452
            //  Determine if we have a reason to build anything in this collection of buildable packages
1442
            //  Reset the calculated buildLevel - It will be calculated again
1453
            //  Reset the calculated buildLevel - It will be calculated again
1443
            //
1454
            //
1444
            ArrayList<PlannedPackage> toBuild = new ArrayList<PlannedPackage>();
1455
            ArrayList<PlannedPackage> toBuild = new ArrayList<PlannedPackage>();
1445
            for (Iterator<PlannedPackage> it = results.planCollection.iterator(); it.hasNext(); )
1456
            for (Iterator<PlannedPackage> it = results.planCollection.iterator(); it.hasNext(); )
Line 1485... Line 1496...
1485
                }
1496
                }
1486
                
1497
                
1487
                //  Sort the packages by buildOrder and buildTime
1498
                //  Sort the packages by buildOrder and buildTime
1488
                Collections.sort(ripplePlan, PlannedPackage.BuildOrderComparitor);
1499
                Collections.sort(ripplePlan, PlannedPackage.BuildOrderComparitor);
1489
                
1500
                
-
 
1501
                phase.setPhase("Display Build Order");
1490
                mLogger.error("Plan Build {} Time: {}", name, results.planTime);
1502
                mLogger.error("Plan Build {} Time: {}", name, results.planTime);
1491
                for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1503
                for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1492
                {
1504
                {
1493
                    PlannedPackage p = it.next();
1505
                    PlannedPackage p = it.next();
1494
                    mLogger.error("Plan: {} {} t:{}", p.mBuildLevel, p.mPkg.mAlias, p.mPkg.mBuildTime);
1506
                    mLogger.error("Plan: {} {} t:{}", p.mBuildLevel, p.mPkg.mAlias, p.mPkg.mBuildTime);
Line 1496... Line 1508...
1496
            }
1508
            }
1497
            
1509
            
1498
            //  Daemon mode: Returning calculated plan
1510
            //  Daemon mode: Returning calculated plan
1499
            results.planCollection = ripplePlan;
1511
            results.planCollection = ripplePlan;
1500
        }
1512
        }
1501
        
1513
    
-
 
1514
        phase.setPhase("EndPlanCollection");
1502
        return results;
1515
        return results;
1503
    }
1516
    }
1504
 
1517
 
1505
    /** Generate a plan based on a modified set of packages
1518
    /** Generate a plan based on a modified set of packages
1506
     * 
1519
     *