Revert "Revert "Use FlutterProject to locate files (#18913)" (#19409)"  (#19456)

With a fix of a path being printed relative instead of absolute.
diff --git a/packages/flutter_tools/test/ios/cocoapods_test.dart b/packages/flutter_tools/test/ios/cocoapods_test.dart
index b65e757..fe43de4 100644
--- a/packages/flutter_tools/test/ios/cocoapods_test.dart
+++ b/packages/flutter_tools/test/ios/cocoapods_test.dart
@@ -9,7 +9,6 @@
 import 'package:flutter_tools/src/base/common.dart';
 import 'package:flutter_tools/src/base/io.dart';
 import 'package:flutter_tools/src/cache.dart';
-import 'package:flutter_tools/src/flutter_manifest.dart';
 import 'package:flutter_tools/src/project.dart';
 import 'package:flutter_tools/src/ios/cocoapods.dart';
 import 'package:flutter_tools/src/ios/xcodeproj.dart';
@@ -25,7 +24,7 @@
   FileSystem fs;
   ProcessManager mockProcessManager;
   MockXcodeProjectInterpreter mockXcodeProjectInterpreter;
-  Directory projectUnderTest;
+  FlutterProject projectUnderTest;
   CocoaPods cocoaPodsUnderTest;
   InvokeProcess resultOfPodVersion;
 
@@ -46,7 +45,8 @@
     fs = new MemoryFileSystem();
     mockProcessManager = new MockProcessManager();
     mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter();
-    projectUnderTest = fs.directory(fs.path.join('project', 'ios'))..createSync(recursive: true);
+    projectUnderTest = new FlutterProject(fs.directory('project'));
+    projectUnderTest.ios.directory.createSync(recursive: true);
     cocoaPodsUnderTest = new CocoaPods();
     pretendPodVersionIs('1.5.0');
     fs.file(fs.path.join(
@@ -124,22 +124,10 @@
   });
 
   group('Setup Podfile', () {
-    File podFile;
-    File debugConfigFile;
-    File releaseConfigFile;
-
-    setUp(() {
-      debugConfigFile = fs.file(fs.path.join('project', 'ios', 'Flutter', 'Debug.xcconfig'));
-      releaseConfigFile = fs.file(fs.path.join('project', 'ios', 'Flutter', 'Release.xcconfig'));
-      podFile = fs.file(fs.path.join('project', 'ios', 'Podfile'));
-    });
-
     testUsingContext('creates objective-c Podfile when not present', () async {
-      final FlutterManifest manifest =
-          await new FlutterProject.fromPath('project').manifest;
-      cocoaPodsUnderTest.setupPodfile('project', manifest);
+      cocoaPodsUnderTest.setupPodfile(projectUnderTest.ios);
 
-      expect(podFile.readAsStringSync(), 'Objective-C podfile template');
+      expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Objective-C podfile template');
     }, overrides: <Type, Generator>{
       FileSystem: () => fs,
     });
@@ -150,24 +138,22 @@
         'SWIFT_VERSION': '4.0',
       });
 
-      final FlutterManifest manifest =
-          await new FlutterProject.fromPath('project').manifest;
-      cocoaPodsUnderTest.setupPodfile('project', manifest);
+      final FlutterProject project = new FlutterProject.fromPath('project');
+      cocoaPodsUnderTest.setupPodfile(project.ios);
 
-      expect(podFile.readAsStringSync(), 'Swift podfile template');
+      expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Swift podfile template');
     }, overrides: <Type, Generator>{
       FileSystem: () => fs,
       XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
     });
 
     testUsingContext('does not recreate Podfile when already present', () async {
-      podFile..createSync()..writeAsStringSync('Existing Podfile');
+      projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
 
-      final FlutterManifest manifest =
-          await new FlutterProject.fromPath('project').manifest;
-      cocoaPodsUnderTest.setupPodfile('project', manifest);
+      final FlutterProject project = new FlutterProject.fromPath('project');
+      cocoaPodsUnderTest.setupPodfile(project.ios);
 
-      expect(podFile.readAsStringSync(), 'Existing Podfile');
+      expect(projectUnderTest.ios.podfile.readAsStringSync(), 'Existing Podfile');
     }, overrides: <Type, Generator>{
       FileSystem: () => fs,
     });
@@ -175,30 +161,32 @@
     testUsingContext('does not create Podfile when we cannot interpret Xcode projects', () async {
       when(mockXcodeProjectInterpreter.isInstalled).thenReturn(false);
 
-      final FlutterManifest manifest =
-          await new FlutterProject.fromPath('project').manifest;
-      cocoaPodsUnderTest.setupPodfile('project', manifest);
+      final FlutterProject project = new FlutterProject.fromPath('project');
+      cocoaPodsUnderTest.setupPodfile(project.ios);
 
-      expect(podFile.existsSync(), false);
+      expect(projectUnderTest.ios.podfile.existsSync(), false);
     }, overrides: <Type, Generator>{
       FileSystem: () => fs,
       XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
     });
 
     testUsingContext('includes Pod config in xcconfig files, if not present', () async {
-      podFile..createSync()..writeAsStringSync('Existing Podfile');
-      debugConfigFile..createSync(recursive: true)..writeAsStringSync('Existing debug config');
-      releaseConfigFile..createSync(recursive: true)..writeAsStringSync('Existing release config');
+      projectUnderTest.ios.podfile..createSync()..writeAsStringSync('Existing Podfile');
+      projectUnderTest.ios.xcodeConfigFor('Debug')
+        ..createSync(recursive: true)
+        ..writeAsStringSync('Existing debug config');
+      projectUnderTest.ios.xcodeConfigFor('Release')
+        ..createSync(recursive: true)
+        ..writeAsStringSync('Existing release config');
 
-      final FlutterManifest manifest =
-          await new FlutterProject.fromPath('project').manifest;
-      cocoaPodsUnderTest.setupPodfile('project', manifest);
+      final FlutterProject project = new FlutterProject.fromPath('project');
+      cocoaPodsUnderTest.setupPodfile(project.ios);
 
-      final String debugContents = debugConfigFile.readAsStringSync();
+      final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
       expect(debugContents, contains(
           '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"\n'));
       expect(debugContents, contains('Existing debug config'));
-      final String releaseContents = releaseConfigFile.readAsStringSync();
+      final String releaseContents = projectUnderTest.ios.xcodeConfigFor('Release').readAsStringSync();
       expect(releaseContents, contains(
           '#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"\n'));
       expect(releaseContents, contains('Existing release config'));
@@ -210,9 +198,9 @@
   group('Process pods', () {
     testUsingContext('prints error, if CocoaPods is not installed', () async {
       pretendPodIsNotInstalled();
-      projectUnderTest.childFile('Podfile').createSync();
+      projectUnderTest.ios.podfile.createSync();
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
       );
       verifyNever(mockProcessManager.run(
@@ -231,7 +219,7 @@
     testUsingContext('throws, if Podfile is missing.', () async {
       try {
         await cocoaPodsUnderTest.processPods(
-          appIosDirectory: projectUnderTest,
+          iosProject: projectUnderTest.ios,
           iosEngineDir: 'engine/path',
         );
         fail('ToolExit expected');
@@ -278,7 +266,7 @@
       ));
       try {
         await cocoaPodsUnderTest.processPods(
-          appIosDirectory: projectUnderTest,
+          iosProject: projectUnderTest.ios,
           iosEngineDir: 'engine/path',
         );
         fail('ToolExit expected');
@@ -295,14 +283,14 @@
     });
 
     testUsingContext('run pod install, if Podfile.lock is missing', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Existing lock file.');
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: false,
       );
@@ -318,14 +306,14 @@
     });
 
     testUsingContext('runs pod install, if Manifest.lock is missing', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: false,
       );
@@ -344,17 +332,17 @@
     });
 
     testUsingContext('runs pod install, if Manifest.lock different from Podspec.lock', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Different lock file.');
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: false,
       );
@@ -373,17 +361,17 @@
     });
 
     testUsingContext('runs pod install, if flutter framework changed', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Existing lock file.');
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: true,
       );
@@ -402,20 +390,20 @@
     });
 
     testUsingContext('runs pod install, if Podfile.lock is older than Podfile', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Existing lock file.');
       await new Future<void>.delayed(const Duration(milliseconds: 10));
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..writeAsStringSync('Updated Podfile');
       await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: false,
       );
@@ -433,17 +421,17 @@
     });
 
     testUsingContext('skips pod install, if nothing changed', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Existing lock file.');
       final bool didInstall = await cocoaPodsUnderTest.processPods(
-        appIosDirectory: projectUnderTest,
+        iosProject: projectUnderTest.ios,
         iosEngineDir: 'engine/path',
         dependenciesChanged: false,
       );
@@ -459,13 +447,13 @@
     });
 
     testUsingContext('a failed pod install deletes Pods/Manifest.lock', () async {
-      projectUnderTest.childFile('Podfile')
+      projectUnderTest.ios.podfile
         ..createSync()
         ..writeAsStringSync('Existing Podfile');
-      projectUnderTest.childFile('Podfile.lock')
+      projectUnderTest.ios.podfileLock
         ..createSync()
         ..writeAsStringSync('Existing lock file.');
-      projectUnderTest.childFile('Pods/Manifest.lock')
+      projectUnderTest.ios.podManifestLock
         ..createSync(recursive: true)
         ..writeAsStringSync('Existing lock file.');
 
@@ -482,13 +470,13 @@
 
       try {
         await cocoaPodsUnderTest.processPods(
-          appIosDirectory: projectUnderTest,
+          iosProject: projectUnderTest.ios,
           iosEngineDir: 'engine/path',
           dependenciesChanged: true,
         );
         fail('Tool throw expected when pod install fails');
       } on ToolExit {
-        expect(projectUnderTest.childFile('Pods/Manifest.lock').existsSync(), isFalse);
+        expect(projectUnderTest.ios.podManifestLock.existsSync(), isFalse);
       }
     }, overrides: <Type, Generator>{
       FileSystem: () => fs,