This document outlines workflow the tips and tricks from Session Framework contributors.
Follow fuchsia.dev's Getting Started and Developer Workflow instructions to get your development environment set up.
The layout of the //src/session
directory follows the Fuchsia Source Code Layout.
The session_manager
code lives in //src/session/bin/session_manager
. High level descriptions of the contents in the session subdirectories are as follows:
examples
: example session implementations, where each example demonstrates a set of related functionality (e.g., a graphical session, a session which instantiates an element proposer)fidl
: internal FIDL definitionstools
: tools which interact with the session_manager
and running session
lib
: libraries which support the development of sessionstests
: integration tests for tools
and bin
fx set
Run the following command to build all libraries, binaries, and tests:
fx set core.x64 --with-base=//src/session,//src/session/bin/session_manager:session_manager.config --with //src/session:tests
Note: use --with
for the tests, otherwise each run-test
invocation will trigger an OTA.
fx run-test
Run the following command to build and execute the tests for a given area:
fx run-test <test>
To find the name to substitute for <test>
:
BUILD.gn
file.unittest_package
rule.See the Rust Editor Configuration page for general Rust IDE setup instructions.
To provide functionality like go-to-definition and autocomplete most IDE integrations require a Cargo.toml
for your project. The session framework codebase contains many projects, and it's tedious to generate each Cargo.toml
file manually.
To generate Cargo.toml
files for all the session framework projects, run:
# Find and build all the Rust targets. $ fx build $(ag -G 'BUILD\.gn' 'rustc_(library|binary)\(' src/session/ | sed 's/\(.*\)\/BUILD\.gn:[0-9]\+:rustc_\(library\|binary\)("\([a-z_]\+\)") {/\1:\3/g') # Find all the Rust targets and gen-cargo for each one. $ for TARGET in $(ag -G 'BUILD\.gn' 'rustc_(library|binary)\(' src/session/ | sed 's/\(.*\)\/BUILD\.gn:[0-9]\+:rustc_\(library\|binary\)("\([a-z_]\+\)") {/\1:\3/g'); do fx gen-cargo $TARGET; done
Each git commit
is uploaded as a separate change to Gerrit. git rebase
makes it easier to split changes up into separate commits and still edit intermediate commits.
Consider the following scenario:
The author can then use git rebase -i HEAD~3
to select the commits they want to edit. The author can then, for each commit:
git rebase --continue
to move to the next change to edit.Once all the commits have been edited, the author then re-uploads the changes.
When resolving merge conflicts it's often useful to rebase a change on origin/master
instead of JIRI_HEAD
(which is what is checked out when running jiri update
). JIRI_HEAD
only updates as changes roll through global integration, whereas origin/master
contains all submitted changes.