anchor.diff:      byteStore ??= MemoryByteStore();
       performanceLog ??= PerformanceLog(StringBuffer());
   
  -    DartSdkManager sdkManager = DartSdkManager(sdkPath);
  -
       if (scheduler == null) {
         scheduler = AnalysisDriverScheduler(performanceLog);
         scheduler.start();
       }
   
  -    // TODO(brianwilkerson) Move the required implementation from the old
  -    // ContextBuilder to this class and remove the old class.
  -    old.ContextBuilderOptions options = old.ContextBuilderOptions();
  +    SummaryDataStore? summaryData;
  +    if (librarySummaryPaths != null) {
  +      summaryData = SummaryDataStore(librarySummaryPaths);
  +    }
  +
  +    var workspace = contextRoot.workspace;
  +    var sdk = _createSdk(
  +      workspace: workspace,
  +      sdkPath: sdkPath,
  +      sdkSummaryPath: sdkSummaryPath,
  +    );
  +
  +    // TODO(scheglov) Ensure that "librarySummaryPaths" not null only
  +    // when "sdkSummaryPath" is not null.
  +    if (sdk is SummaryBasedDartSdk) {
  +      summaryData?.addBundle(null, sdk.bundle);
  +    }
  +
  +    var sourceFactory = workspace.createSourceFactory(sdk, summaryData);
  +
  +    var options = _getAnalysisOptions(contextRoot, sourceFactory);
  +    if (updateAnalysisOptions != null) {
  +      updateAnalysisOptions(options);
  +    }
  +
  +    var driver = AnalysisDriver.tmp1(
  +      scheduler: scheduler,
  +      logger: performanceLog,
  +      resourceProvider: resourceProvider,
  +      byteStore: byteStore,
  +      sourceFactory: sourceFactory,
  +      analysisOptions: options,
  +      packages: _createPackageMap(
  +        contextRoot: contextRoot,
  +      ),
  +      enableIndex: enableIndex,
  +      externalSummaries: summaryData,
  +      retainDataForTesting: retainDataForTesting,
  +      fileContentCache: fileContentCache,
  +    );
  +
       if (declaredVariables != null) {
  -      options.declaredVariables = _toMap(declaredVariables);
  -    }
  -    if (sdkSummaryPath != null) {
  -      options.dartSdkSummaryPath = sdkSummaryPath;
  -    }
  -    if (librarySummaryPaths != null) {
  -      options.librarySummaryPaths = librarySummaryPaths;
  -    }
  -    options.defaultAnalysisOptionsFilePath = contextRoot.optionsFile?.path;
  -    options.defaultPackageFilePath = contextRoot.packagesFile?.path;
  -
  -    old.ContextBuilder builder =
  -        old.ContextBuilder(resourceProvider, sdkManager, options: options);
  -    builder.analysisDriverScheduler = scheduler;
  -    builder.byteStore = byteStore;
  -    builder.enableIndex = enableIndex;
  -    builder.performanceLog = performanceLog;
  -    builder.retainDataForTesting = retainDataForTesting;
  -
  -    old.ContextRoot oldContextRoot = old.ContextRoot(
  -        contextRoot.root.path, contextRoot.excludedPaths.toList(),
  -        pathContext: resourceProvider.pathContext);
  -    AnalysisDriver driver = builder.buildDriver(
  -      oldContextRoot,
  -      contextRoot.workspace,
  -      fileContentCache: fileContentCache,
  -      updateAnalysisOptions: updateAnalysisOptions,
  -    );
  +      driver.declaredVariables = declaredVariables;
  +      driver.configure();
  +    }
   
       // AnalysisDriver reports results into streams.
       // We need to drain these streams to avoid memory leak.
  
positive.code: import 'package:analyzer/dart/analysis/declared_variables.dart';
  import 'package:analyzer/file_system/file_system.dart';
  import 'package:analyzer/file_system/physical_file_system.dart';
  import 'package:analyzer/src/context/builder.dart' as old
      show ContextBuilder, ContextBuilderOptions;
  import 'package:analyzer/src/context/context_root.dart' as old;
  import 'package:analyzer/src/dart/analysis/byte_store.dart'
      show ByteStore, MemoryByteStore;
  import 'package:analyzer/src/dart/analysis/driver.dart'
  
negative.code: import 'package:analyzer/src/dart/analysis/file_content_cache.dart';
  import 'package:analyzer/src/dart/analysis/performance_logger.dart'
      show PerformanceLog;
  import 'package:analyzer/src/dart/sdk/sdk.dart';
  import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
  import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
  import 'package:analyzer/src/generated/source.dart';
  import 'package:analyzer/src/hint/sdk_constraint_extractor.dart';
  import 'package:analyzer/src/summary/package_bundle_reader.dart';
  import 'package:analyzer/src/summary/summary_sdk.dart';
  import 'package:analyzer/src/task/options.dart';
  import 'package:analyzer/src/workspace/workspace.dart';
  import 'package:cli_util/cli_util.dart';
  
  /// An implementation of a context builder.
  