Skip to content

Conversation

@sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Jun 28, 2018

A bit of cleanup of flutter_tools' handling of project directories and manifests.

Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

copyDirectorySync(
cache.getArtifactDirectory('gradle_wrapper'),
fs.directory(fs.path.join(projectDir, 'android')),
project.directory.childDirectory('android'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project.android?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

final File file = iosProject.xcodeConfigFor(mode);
if (file.existsSync()) {
final String content = file.readAsStringSync();
final String content = iosProject.xcodeConfigFor(mode).readAsStringSync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not retain the use of file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!
Done


final File podfileFile = iosProject.podfile;
final File podfileLockFile = iosProject.podfileLock;
final File manifestLockFile =iosProject.podManifestLock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space after =

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (!Cache.instance.fileOlderThanToolsStamp(propertiesFile)) {
Future<void> generateXcodeProperties({FlutterProject project}) async {
if ((await project.manifest).isModule ||
project.directory.childDirectory('ios').existsSync()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project.ios.directory.existsSync()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'main',
'java',
);
final String registryPath = fs.path.join(javaSourcePath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Move javaSourcePath, to the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Future<File> _androidLocalPropertiesFile;

Future<File> get generatedXcodePropertiesFile {
return _generatedXcodeProperties ??= manifest.then((FlutterManifest manifest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add <File> after then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

IosModuleProject get iosModule => new IosModuleProject(directory.childDirectory('.ios'));

Future<File> get androidLocalPropertiesFile {
return _androidLocalPropertiesFile ??= manifest.then((FlutterManifest manifest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add <File> after then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
File _flutterPluginsDotFile;

Future<Directory> get androidPluginRegistrantDirectory async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Directory is not where we should place the registrant. It is the Android sub project in which we should place the registrant. This discrepancy might be confusing.

Maybe androidPluginHost or similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better!
Done

}
Future<Directory> _androidPluginRegistrantDirectory;

Future<Directory> get iosPluginRegistrantDirectory async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

new FlutterProject(directory).directory.absolute.path,
directory.absolute.path,
);
directory.absolute.path,);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the ); back to whence it came.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, ok... will do );

Copy link
Contributor Author

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

copyDirectorySync(
cache.getArtifactDirectory('gradle_wrapper'),
fs.directory(fs.path.join(projectDir, 'android')),
project.directory.childDirectory('android'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

final File file = iosProject.xcodeConfigFor(mode);
if (file.existsSync()) {
final String content = file.readAsStringSync();
final String content = iosProject.xcodeConfigFor(mode).readAsStringSync();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!
Done


final File podfileFile = iosProject.podfile;
final File podfileLockFile = iosProject.podfileLock;
final File manifestLockFile =iosProject.podManifestLock;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (!Cache.instance.fileOlderThanToolsStamp(propertiesFile)) {
Future<void> generateXcodeProperties({FlutterProject project}) async {
if ((await project.manifest).isModule ||
project.directory.childDirectory('ios').existsSync()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'main',
'java',
);
final String registryPath = fs.path.join(javaSourcePath,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Future<File> _androidLocalPropertiesFile;

Future<File> get generatedXcodePropertiesFile {
return _generatedXcodeProperties ??= manifest.then((FlutterManifest manifest) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
Future<File> _generatedXcodeProperties;

File get flutterPluginsDotFile {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
File _flutterPluginsDotFile;

Future<Directory> get androidPluginRegistrantDirectory async {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better!
Done

}
Future<Directory> _androidPluginRegistrantDirectory;

Future<Directory> get iosPluginRegistrantDirectory async {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

new FlutterProject(directory).directory.absolute.path,
directory.absolute.path,
);
directory.absolute.path,);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, ok... will do );

@sigurdm sigurdm requested a review from szakarias July 6, 2018 13:20
@sigurdm
Copy link
Contributor Author

sigurdm commented Jul 6, 2018

@szakarias Could you take a look. Especially the latest commit?

# Conflicts:
#	packages/flutter_tools/lib/src/plugins.dart
Copy link
Contributor

@szakarias szakarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

class AndroidApk extends ApplicationPackage {
/// Path to the actual apk file.
final String apkPath;
final File apk;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

const String gradleManifestPath = 'android/app/src/main/AndroidManifest.xml';
const String gradleAppOutV1 = 'android/app/build/outputs/apk/app-debug.apk';
const String gradleAppOutDirV1 = 'android/app/build/outputs/apk';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

// command will grab a new AndroidApk after building, to get the updated
// IDs.
manifestPath = gradleManifestPath;
manifest = androidProject.gradleManifestFile;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set manifest outside the if and place it together with the exists check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return null;

final String manifestString = fs.file(manifestPath).readAsStringSync();
final String manifestString = fs.file(manifest).readAsStringSync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manifest is now a file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// Creates a new IOSApp from an existing app bundle or IPA.
factory IOSApp.fromPrebuiltApp(String applicationBinary) {
final FileSystemEntityType entityType = fs.typeSync(applicationBinary);
factory IOSApp.fromPrebuiltApp(File apk) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep applicationBinary as name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Future<ApplicationPackage> getApplicationPackageForPlatform(TargetPlatform platform, {
String applicationBinary
File apk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep applicationBinary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

package = await getApplicationPackageForPlatform(
targetPlatform,
applicationBinary: hotRunner.applicationBinary
apk: hotRunner.applicationBinary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep applicationBinary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sigurdm sigurdm merged commit 57d78cc into flutter:master Jul 16, 2018
sigurdm added a commit to sigurdm/flutter that referenced this pull request Jul 16, 2018
sigurdm added a commit that referenced this pull request Jul 16, 2018
teriyakijack added a commit to teriyakijack/flutter that referenced this pull request Jul 17, 2018
* flutter_master: (810 commits)
  Revert engine roll to 316b026
  roll engine to 316b026 (flutter#19419)
  Revert "enable lint unnecessary_const (flutter#19342)" (flutter#19423)
  enable lint unnecessary_const (flutter#19342)
  Chevrons in month picker are semi-transparent when the month is scrolled (flutter#19363)
  Revert "Use FlutterProject to locate files  (flutter#18913)" (flutter#19409)
  Extra debug information in run_release_test (flutter#19405)
  Fix typo (flutter#19402)
  Use FlutterProject to locate files  (flutter#18913)
  Revert "roll engine to 9af920e (flutter#19365)" (flutter#19376)
  roll engine to 9af920e (flutter#19365)
  increase cache size if image is loaded that is larger than max size (flutter#19352)
  Add Bash and Zsh command-line completion for flutter (flutter#19243)
  Support keyboardAppearance field for iOS (flutter#19244)
  Add option to silence driver extension errors (flutter#19247)
  Add HeroController to CupertinoApp (flutter#19326)
  have text finder convert Text.rich to plain text for comparison (flutter#19270)
  Correct contentPadding type in InputDecoration.debugFillProperties (flutter#19318)
  Revert "Revert "Use runTests in fuchsia tester. (flutter#19178)" (flutter#19321)" (flutter#19327)
  Roll engine to c5a63d (flutter#19288)
  ...
sigurdm added a commit to sigurdm/flutter that referenced this pull request Jul 17, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request Jul 19, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request Jul 19, 2018
sigurdm added a commit that referenced this pull request Jul 20, 2018
…" (#19456)

With a fix of a path being printed relative instead of absolute.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants