"Fossies" - the Fresh Open Source Software Archive

Member "flutter-1.22.4/packages/flutter_tools/lib/src/ios/migrations/xcode_build_system_migration.dart" (13 Nov 2020, 1536 Bytes) of package /linux/misc/flutter-1.22.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2014 The Flutter Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
    4 
    5 import '../../base/file_system.dart';
    6 import '../../base/logger.dart';
    7 import '../../project.dart';
    8 import 'ios_migrator.dart';
    9 
   10 // Xcode legacy build system no longer supported by Xcode.
   11 // Set in https://github.com/flutter/flutter/pull/21901/.
   12 // Removed in https://github.com/flutter/flutter/pull/33684.
   13 class XcodeBuildSystemMigration extends IOSMigrator {
   14   XcodeBuildSystemMigration(
   15     IosProject project,
   16     Logger logger,
   17   ) : _xcodeWorkspaceSharedSettings = project.xcodeWorkspaceSharedSettings,
   18       super(logger);
   19 
   20   final File _xcodeWorkspaceSharedSettings;
   21 
   22   @override
   23   bool migrate() {
   24     if (!_xcodeWorkspaceSharedSettings.existsSync()) {
   25       logger.printTrace('Xcode workspace settings not found, skipping build system migration');
   26       return true;
   27     }
   28 
   29     final String contents = _xcodeWorkspaceSharedSettings.readAsStringSync();
   30 
   31     // Only delete this file when it is pointing to the legacy build system.
   32     const String legacyBuildSettingsWorkspace = '''
   33     <key>BuildSystemType</key>
   34     <string>Original</string>''';
   35 
   36     // contains instead of equals to ignore newline file ending variance.
   37     if (contents.contains(legacyBuildSettingsWorkspace)) {
   38       logger.printStatus('Legacy build system detected, removing ${_xcodeWorkspaceSharedSettings.path}');
   39       _xcodeWorkspaceSharedSettings.deleteSync();
   40     }
   41 
   42     return true;
   43   }
   44 }