New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update code sample cookbook background parsing #5798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miquelbeltran, please review
Hi @iapicca All the code changes need to be done on the original dart files as well and exported using the refresh code excerpts tool, rather than editing the mark down directly. Please look at the README.md and the https://github.com/dart-lang/site-shared/blob/master/doc/code-excerpts.md for more info on how to do it. |
That's what I was kind of assuming, but I didn't take the time to look at the site. @iapicca, are you willing to tackle that? If not, I will close the PR. |
@sfshaza2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I spotted a couple of issues.
null_safety_examples/cookbook/networking/background_parsing/lib/main_step2.dart
Outdated
Show resolved
Hide resolved
null_safety_examples/cookbook/networking/background_parsing/lib/main_step3.dart
Outdated
Show resolved
Hide resolved
Is this ready? Do you approve, @miquelbeltran? |
@sfshaza2 the code excerpts are not correct yet, I run the |
@miquelbeltran |
I've kicked off the workflow. @domesticmouse, do you have the privilege to kick off the workflow? |
My laptop is borked. I'm currently at seriously reduced capability. |
I see both tests
fails with the same output error
I'm not sure what I messed up |
Hey @iapicca, going from the logs, I suspect you need to update some snippets. The log includes the following instructions:
|
@domesticmouse /home/yakforward/projects/website/tool/env-set.sh: line 7: tool/shared/env-set.sh: No such file or directory which makes sense since site-shared/ does not contain
I'm probably missing something, as I mentioned I'm having hard time to understand the instructions provided |
Hey @johnpryan and @miquelbeltran, can you please have a look at this PR and give some guidance? I'm out of my depth here. |
Looks like your setup is not correct, you need to follow all the steps in the README.md (e.g. site-shared is a submodule which you need to update: https://github.com/flutter/website#2-clone-this-repo-and-its-submodules) |
@miquelbeltran prerequisitesinstalled nvm
yakforward@yakforward-yoga720 ~ $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14926 100 14926 0 0 55486 0 --:--:-- --:--:-- --:--:-- 55486
=> Downloading nvm from git to '/home/yakforward/.nvm'
=> Cloning into '/home/yakforward/.nvm'...
remote: Enumerating objects: 347, done.
remote: Counting objects: 100% (347/347), done.
remote: Compressing objects: 100% (295/295), done.
remote: Total 347 (delta 39), reused 163 (delta 27), pack-reused 0
Receiving objects: 100% (347/347), 203.77 KiB | 764.00 KiB/s, done.
Resolving deltas: 100% (39/39), done.
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm source string to /home/yakforward/.bashrc
=> Appending bash_completion source string to /home/yakforward/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
yakforward@yakforward-yoga720 ~ $ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
yakforward@yakforward-yoga720 ~ $ source ~/.bashrc
yakforward@yakforward-yoga720 ~ $ source ~/.nvm/nvm.sh
yakforward@yakforward-yoga720 ~ $ command -v nvm
nvm installed rvmyakforward@yakforward-yoga720 ~ $ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 2
gpg: imported: 2
yakforward@yakforward-yoga720 ~ $ \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
gpg: Signature made R 15 jaan 2021 20:46:22 EET
gpg: using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/home/yakforward/.rvm/archives/rvm-1.29.12.tgz'
Installing RVM to /home/yakforward/.rvm/
Adding rvm PATH line to /home/yakforward/.profile /home/yakforward/.mkshrc /home/yakforward/.bashrc /home/yakforward/.zshrc.
Adding rvm loading line to /home/yakforward/.profile /home/yakforward/.bash_profile /home/yakforward/.zlogin.
Installation of RVM in /home/yakforward/.rvm/ is almost complete:
* To start using RVM you need to run `source /home/yakforward/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
yakforward@yakforward-yoga720 ~ $ source ~/.rvm/bin/rvm
Ruby enVironment Manager 1.29.12 (latest) (c) 2009-2020 Michal Papis, Piotr Kuczynski, Wayne E. Seguin
Usage:
rvm [--debug][--trace][--nice] <command> <options>
for example:
rvm list # list installed interpreters
rvm list known # list available interpreters
rvm install <version> # install ruby interpreter
rvm use <version> # switch to specified ruby interpreter
rvm remove <version> # remove ruby interpreter (alias: delete)
rvm get <version> # upgrade rvm: stable, master
Available commands:
rvm has a number of common commands, listed below. Additional information about any command
can be found by executing `rvm help <command>`.
ruby installation
fetch # download binary or sources for selected ruby version
install # install ruby interpreter
list # show currently installed ruby interpreters
list known # list available interpreters
mount # install ruby from external locations
patchset # tools related to managing ruby patchsets
pkg # install a dependency package
reinstall # reinstall ruby and run gem pristine on all gems
remove # remove ruby and downloaded sources (alias: delete)
requirements # installs dependencies for building ruby
uninstall # uninstall ruby, keeping it's sources
upgrade # upgrade to another ruby version, migrating gems
running different ruby versions
current # print current ruby version and name of used gemsets
do # runs a command against specified and/or all rubies
gemdir # display path to current gem directory ($GEM_HOME)
use <version> # switch to given (and already installed) ruby version
use default # switch to default ruby, or system if none is set
use system # switch to system ruby
wrapper # creates wrapper executables for a given ruby & gemset
managing gemsets
gemset # manage gemsets
migrate # migrate all gemsets from one ruby to another
rvm configuration
alias # define aliases for `rvm use`
autolibs # tweak settings for installing dependencies automatically
group # tools for managing groups in multiuser installations
rvmrc # tools related to managing .rvmrc trust & loading gemsets
rvm maintenance
implode # removes the rvm installation completely
cleanup # remove stale source files & data associated with rvm
cron # manage setup for using ruby in cron
docs # tools to make installing ri and rdoc docs easier
get # upgrades RVM to latest head, stable or branched version
osx-ssl-certs # helps update OpenSSL certs installed by rvm on OS X
reload # reload rvm source itself
reset # remove all default and system settings
snapshot # backup/restore rvm installation
troubleshooting
config-get # display values for RbConfig::CONFIG variables
debug # additional information helping to discover issues
export # set temporary env variable in the current shell
fix-permissions # repairs broken permissions
repair # lets you repair parts of your environment, such as
# wrappers, env files and similar (general maintenance)
rubygems # switches version of rubygems for the current ruby
tools # general information about the ruby env
unexport # undo changes made to the environment by `rvm export`
user # tools for managing RVM mixed mode in multiuser installs
information and documentation
info # show the environment information for current ruby
disk-usage # display disk space occupied by rvm
notes # display notes with operating system specifics
version # display rvm version (equal to `rvm -v`)
additional global options
--debug # toggle debug mode on for very verbose output
--trace # toggle trace mode on to see EVERYTHING rvm is doing
--nice # process niceness (increase the value on slow computers, default 0)
For additional documentation please visit https://rvm.io verified diffutils being installedyakforward@yakforward-yoga720 ~ $ sudo apt install diffutils
[sudo] password for yakforward:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
diffutils is already the newest version (1:3.7-3ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. clone submodules
clone submodulesyakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ git submodule update --init --remote
Submodule 'examples/codelabs' (https://github.com/flutter/codelabs) registered for path 'examples/codelabs'
Submodule 'flutter' (https://github.com/flutter/flutter) registered for path 'flutter'
Submodule 'site-shared' (https://github.com/dart-lang/site-shared.git) registered for path 'site-shared'
Cloning into '/home/yakforward/projects/website/examples/codelabs'...
Cloning into '/home/yakforward/projects/website/flutter'...
Cloning into '/home/yakforward/projects/website/site-shared'...
Submodule path 'examples/codelabs': checked out '36644094b3a7c1c538e62dd569b80f184b9b4682'
Submodule path 'flutter': checked out 'b22742018b3edf16c6cadd7b76d9db5e7f9064b5'
Submodule path 'site-shared': checked out 'bb587252bc5904475370714d54e37ef3b31f784c' installationrun env-set.shyakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ source ./tool/env-set.sh
Setting environment variables from tool/env-set.sh
Downloading and installing node v12.22.1...
Downloading https://nodejs.org/dist/v12.22.1/node-v12.22.1-linux-x64.tar.xz...
###################################################################################################################################################################################################### 100,0%
Computing checksum with sha256sum
Checksums matched!
Now using node v12.22.1 (npm v6.14.12)
Creating default alias: default -> 12 (-> v12.22.1)
RVM current: system
Running: rvm install ruby-2.6.5
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/21.04/x86_64/ruby-2.6.5.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating systemyakforward password required for 'apt-get --quiet --yes update':
....
Installing required packages: gawk, bison, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, libgmp-dev, libssl-dev..........
Requirements installation successful.
Installing Ruby from source to: /home/yakforward/.rvm/rubies/ruby-2.6.5, this may take a while depending on your cpu(s)...
ruby-2.6.5 - #downloading ruby-2.6.5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.4M 100 13.4M 0 0 407k 0 0:00:33 0:00:33 --:--:-- 306k
ruby-2.6.5 - #extracting ruby-2.6.5 to /home/yakforward/.rvm/src/ruby-2.6.5.....
ruby-2.6.5 - #configuring......................................................................
ruby-2.6.5 - #post-configuration..
ruby-2.6.5 - #compiling....................................................................................................................................
ruby-2.6.5 - #installing................
ruby-2.6.5 - #making binaries executable..
ruby-2.6.5 - #downloading rubygems-3.0.9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 865k 100 865k 0 0 304k 0 0:00:02 0:00:02 --:--:-- 304k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.6.5 - #extracting rubygems-3.0.9.....
ruby-2.6.5 - #removing old rubygems........
ruby-2.6.5 - #installing rubygems-3.0.9................................................................
ruby-2.6.5 - #gemset created /home/yakforward/.rvm/gems/ruby-2.6.5@global
ruby-2.6.5 - #importing gemset /home/yakforward/.rvm/gemsets/global.gems..........................................................
ruby-2.6.5 - #generating global wrappers........
ruby-2.6.5 - #gemset created /home/yakforward/.rvm/gems/ruby-2.6.5
ruby-2.6.5 - #importing gemsetfile /home/yakforward/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.5 - #generating default wrappers........
ruby-2.6.5 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.5 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Command 'ruby' not found, but can be installed with:
sudo snap install ruby # version 3.0.1, or
sudo apt install ruby # version 1:2.7+2
See 'snap info ruby' for additional versions.
Ruby --version:
Configured RVM so it doesn't complain if it isn't first in PATH
INFO: git config push.recurseSubmodules is unset. Setting it to 'check':
+++ git config push.recurseSubmodules check
INFO: git config status.submodulesummary is set to 1.
run before-install.sh FAILED!yakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ ./tool/before-install.sh
Dart SDK appears to be installed: dart is /usr/bin/dart
Dart SDK version: 2.13.1 (stable) (Unknown timestamp) on "linux_x64"
::group::before_install.pub
Resolving dependencies... (2.8s)
+ _fe_analyzer_shared 22.0.0
+ analyzer 1.7.0 (1.7.1 available)
+ args 2.1.0
+ async 2.7.0
+ build 2.0.1
+ build_config 1.0.0
+ build_daemon 3.0.0
+ build_resolvers 2.0.2
+ build_runner 2.0.4
+ build_runner_core 7.0.0
+ built_collection 5.0.0
+ built_value 8.0.6
+ charcode 1.2.0
+ checked_yaml 2.0.1
+ cli_util 0.3.0
+ code_builder 4.0.0
+ code_excerpt_updater 0.0.0 from path site-shared/packages/code_excerpt_updater
+ code_excerpter 0.0.0 from path site-shared/packages/code_excerpter
+ collection 1.15.0
+ console 4.1.0
+ convert 3.0.0
+ crypto 3.0.1
+ csslib 0.17.0
+ dart_style 2.0.1
+ file 6.1.1
+ firebase 9.0.1
+ fixnum 1.0.0
+ frontend_server_client 2.1.0
+ github 8.1.0
+ glob 2.0.1
+ graphs 2.0.0
+ html 0.15.0
+ http 0.13.3
+ http_multi_server 3.0.1
+ http_parser 4.0.0
+ io 1.0.0
+ js 0.6.3
+ json_annotation 4.0.1
+ linkcheck 2.0.18
+ logging 1.0.1
+ matcher 0.12.10
+ meta 1.4.0
+ mime 1.0.0
+ package_config 2.0.0
+ path 1.8.0
+ pedantic 1.11.0
+ pool 1.5.0
+ pub_semver 2.0.0
+ pubspec_parse 1.0.0
+ shelf 1.1.4
+ shelf_web_socket 1.0.1
+ source_span 1.8.1
+ stack_trace 1.10.0
+ stream_channel 2.1.0
+ stream_transform 2.0.0
+ string_scanner 1.1.0
+ term_glyph 1.2.0
+ timing 1.0.0
+ typed_data 1.3.0
+ vector_math 2.1.0
+ watcher 1.0.0
+ web_socket_channel 2.1.0
+ yaml 3.1.0
Downloading firebase 9.0.1...
Downloading github 8.1.0...
Downloading build_runner 2.0.4...
Downloading timing 1.0.0...
Downloading stream_transform 2.0.0...
Downloading graphs 2.0.0...
Downloading code_builder 4.0.0...
Downloading build_runner_core 7.0.0...
Downloading build_daemon 3.0.0...
Downloading build_config 1.0.0...
Downloading built_collection 5.0.0...
Downloading build_resolvers 2.0.2...
Downloading built_value 8.0.6...
Downloading fixnum 1.0.0...
Downloading linkcheck 2.0.18...
Creation of temporary directory failed, path = '/home/yakforward/tmp' (OS Error: No such file or directory, errno = 2)
run before-install.sh FIXED!
yakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ mkdir ~/tmp
yakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ ./tool/before-install.sh
Dart SDK appears to be installed: dart is /usr/bin/dart
Dart SDK version: 2.13.1 (stable) (Unknown timestamp) on "linux_x64"
::group::before_install.pub
Resolving dependencies... (2.8s)
+ _fe_analyzer_shared 22.0.0
+ analyzer 1.7.0 (1.7.1 available)
+ args 2.1.0
+ async 2.7.0
+ build 2.0.1
+ build_config 1.0.0
+ build_daemon 3.0.0
+ build_resolvers 2.0.2
+ build_runner 2.0.4
+ build_runner_core 7.0.0
+ built_collection 5.0.0
+ built_value 8.0.6
+ charcode 1.2.0
+ checked_yaml 2.0.1
+ cli_util 0.3.0
+ code_builder 4.0.0
+ code_excerpt_updater 0.0.0 from path site-shared/packages/code_excerpt_updater
+ code_excerpter 0.0.0 from path site-shared/packages/code_excerpter
+ collection 1.15.0
+ console 4.1.0
+ convert 3.0.0
+ crypto 3.0.1
+ csslib 0.17.0
+ dart_style 2.0.1
+ file 6.1.1
+ firebase 9.0.1
+ fixnum 1.0.0
+ frontend_server_client 2.1.0
+ github 8.1.0
+ glob 2.0.1
+ graphs 2.0.0
+ html 0.15.0
+ http 0.13.3
+ http_multi_server 3.0.1
+ http_parser 4.0.0
+ io 1.0.0
+ js 0.6.3
+ json_annotation 4.0.1
+ linkcheck 2.0.18
+ logging 1.0.1
+ matcher 0.12.10
+ meta 1.4.0
+ mime 1.0.0
+ package_config 2.0.0
+ path 1.8.0
+ pedantic 1.11.0
+ pool 1.5.0
+ pub_semver 2.0.0
+ pubspec_parse 1.0.0
+ shelf 1.1.4
+ shelf_web_socket 1.0.1
+ source_span 1.8.1
+ stack_trace 1.10.0
+ stream_channel 2.1.0
+ stream_transform 2.0.0
+ string_scanner 1.1.0
+ term_glyph 1.2.0
+ timing 1.0.0
+ typed_data 1.3.0
+ vector_math 2.1.0
+ watcher 1.0.0
+ web_socket_channel 2.1.0
+ yaml 3.1.0
Downloading firebase 9.0.1...
Downloading github 8.1.0...
Downloading build_runner 2.0.4...
Downloading timing 1.0.0...
Downloading stream_transform 2.0.0...
Downloading graphs 2.0.0...
Downloading code_builder 4.0.0...
Downloading build_runner_core 7.0.0...
Downloading build_daemon 3.0.0...
Downloading build_config 1.0.0...
Downloading built_collection 5.0.0...
Downloading build_resolvers 2.0.2...
Downloading built_value 8.0.6...
Downloading fixnum 1.0.0...
Downloading linkcheck 2.0.18...
Changed 63 dependencies!
1 package has newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
::endgroup::
::group::before_install.flutter
Refreshing Flutter repo and running doctor:
+ cd flutter
+ git checkout stable
Branch 'stable' set up to track remote branch 'stable' from 'origin'.
Switched to a new branch 'stable'
+ git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
+ bin/flutter doctor
Downloading Dart SDK from Flutter engine a9d88a4d182bdae23e3a4989abfb7ea25954aad1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 198M 100 198M 0 0 1981k 0 0:01:42 0:01:42 --:--:-- 2249k
Building flutter tool...
Downloading Material fonts... 3.1s
Downloading Gradle Wrapper... 251ms
Downloading package sky_engine... 890ms
Downloading flutter_patched_sdk tools... 2,125ms
Downloading flutter_patched_sdk_product tools... 2,144ms
Downloading linux-x64 tools... 15.1s
Downloading linux-x64/font-subset tools... 1,298ms
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.0, on Linux, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
✗ No valid Android SDK platforms found in /usr/lib/android-sdk/platforms. Directory was empty.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
::endgroup::
run install.sh
update fragmentsrun tool/refresh-code-excerpts.sh
yakforward@yakforward-yoga720 ~/projects/website (fix-cookbook-background-parsing)$ tool/refresh-code-excerpts.sh Error: /home/yakforward/projects/website/src/docs/cookbook/networking/background-parsing.md:146 cannot read file "/home/yakforward/projects/website/tmp/_fragments/examples/../null_safety_examples/cookbook/networking/background_parsing/lib/main.dart.excerpt.yaml"
|
Can you please resolve conflicts? We can't land until conflicts with base are resolved. |
unfortunately I'm be able to follow up on this PR at this moment |
fix #6768
updating the current coda sample with the following
new code sample
testing the code above with the latest master on android physical device
doctor
everything seems to work as intended
logs