Skip to content

Updated obsolete URL#52158

Merged
jmagman merged 9 commits intoflutter:masterfrom
Dmitry-Borodin:url-fix
Mar 26, 2020
Merged

Updated obsolete URL#52158
jmagman merged 9 commits intoflutter:masterfrom
Dmitry-Borodin:url-fix

Conversation

@Dmitry-Borodin
Copy link
Copy Markdown
Contributor

@Dmitry-Borodin Dmitry-Borodin commented Mar 7, 2020

Description

Replaced obsolete URL to actual one

Related Issues

Fixes #51815

Tests

I added no tests:

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • [] The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
    Actually, this^^ reports thousands of errors. But they are not related to my changes.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • [ x] No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Replace with the names of who gave advice
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot
Copy link
Copy Markdown
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 7, 2020
@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@Dmitry-Borodin
Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Mar 7, 2020
@zanderso zanderso requested a review from jacob314 March 12, 2020 17:53
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that link still loses the #android-setup by the time you select your platform.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it won't be https://flutter.dev/docs/get-started/install anymore, I think it's still better then https://flutter.dev/setup/ that is redirect only

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would https://flutter.dev/docs/get-started/install without the anchor be better (since it doesn't imply any android info), plus create an issue to switch on https://flutter.dev/docs/get-started/install/windows, https://flutter.dev/docs/get-started/install/macos etc based on the current platform?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or you can make that platform switch happen in this review if you want, @Dmitry-Borodin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will check tomorrow how can easy can I get the platform in dart.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jmagman updated PR, made urls platform dependent, please take a look
I tested some random messages on my computer, but don't see a nice possibility how to add autotests to the project.
The code is straightforward and can run on any platform, so test will just copy the code it should test

@zanderso zanderso added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 19, 2020
@Dmitry-Borodin
Copy link
Copy Markdown
Contributor Author

I see CI error "flutter build is currently broken", but I don't see if I should do something about it. Looks like it's not related to my changes.

Comment thread packages/flutter_tools/lib/src/base/user_messages.dart Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try:

import 'globals.dart' as globals;
  String get _androidSdkInstallUrl {
    if (globals.platform.isMacOS) {
      return 'https://flutter.dev/docs/get-started/install/macos#android-setup';
    }
...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That I cannot compile on my machine

Unable to spawn isolate: lib/src/base/user_messages.dart:6:8: Error: Error when reading 'lib/src/base/globals.dart': No such file or directory
import 'globals.dart' as globals;
       ^

Why dart:io is forbidden? Isn't it a standard library of the language?

Copy link
Copy Markdown
Member

@jmagman jmagman Mar 23, 2020

Choose a reason for hiding this comment

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

That I cannot compile on my machine

I was just indicating how this is done everywhere else (so you can mock out the platform you're on in tests). grep around for isMacOS and you'll see how it's done.
You need to adjust the import to point to the relative path:

import '../globals.dart' as globals;

Why dart:io is forbidden? Isn't it a standard library of the language?

You would import lib/src/base/io.dart if you need something in there, see #7390 and #7385 re:testability.
But in your case the mockable platform logic is in globals.dart so just import that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much for clarification. Done.

Comment thread packages/flutter_tools/lib/src/base/user_messages.dart Outdated
@Dmitry-Borodin
Copy link
Copy Markdown
Contributor Author

^^ rebased on upstream master

@Dmitry-Borodin
Copy link
Copy Markdown
Contributor Author

Checked tests CI writing to logs - like devices_test.dart and ios_device_start_prebuilt_test.dart - those looks unrelated to my changes and are passing on my machine.

@jmagman
Copy link
Copy Markdown
Member

jmagman commented Mar 26, 2020

It is related.

  Unsupported operation: context.get<Platform> is not supported in test methods. Use Testbed or testUsingContext if accessing Zone injected values.
  test\src\common.dart 190:5                                    NoContext.get
  package:flutter_tools/src/globals.dart 69:34                  platform
  package:flutter_tools/src/base/user_messages.dart 298:17      UserMessages._androidSdkInstallUrl
  package:flutter_tools/src/base/user_messages.dart 115:18      UserMessages.androidSdkBuildToolsOutdated
  test\general.shard\android\android_workflow_test.dart 229:46  main.<fn>
  dart:async                                                    runZoned
  test\src\common.dart 167:14                                   testWithoutContext.<fn>

I took the liberty of pushing a new commit to your fork that injects the platform into UserMessages for testability, and I wrote unit tests for the change.

@jmagman
Copy link
Copy Markdown
Member

jmagman commented Mar 26, 2020

@zanderso Would you mind reviewing since I wrote part of it? None of these strings are overridden in g3.

Copy link
Copy Markdown
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

lgtm w/ nits

_androidSdk.sdkManagerPath,
kAndroidSdkMinVersion,
kAndroidSdkBuildToolsMinVersion.toString(),
_platform
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: need a trailing comma.


String _androidSdkInstallUrl(Platform platform) {
if (platform.isMacOS) {
return 'https://flutter.dev/docs/get-started/install/macos#android-setup';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe pull 'https://flutter.dev/docs/get-started/install' and 'android-setup' out into locals to avoid repeating them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done, though I think it's harder to read.
(The more correct thing would be to construct a Uri but that seems over-engineered for this one.)

@jmagman jmagman added waiting for tree to go green and removed waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds waiting for tree to go green labels Mar 26, 2020
@jmagman jmagman merged commit 5a3e7e4 into flutter:master Mar 26, 2020
@jmagman
Copy link
Copy Markdown
Member

jmagman commented Mar 26, 2020

Thank you for your contribution, @Dmitry-Borodin!

@Dmitry-Borodin Dmitry-Borodin deleted the url-fix branch March 26, 2020 23:41
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter doctor links to an obsolete URL

6 participants