anjia / blog

博客,积累与沉淀
106 stars 4 forks source link

Servo 快速上手 #7

Open anjia opened 5 years ago

anjia commented 5 years ago

介绍如何编译、运行、调试 Servo 环境 setup environment to compile, run, debug

  1. build
    • ./mach build -d
    • ./mach build -r
  2. run
    • servo的二进制在target/debug/servotarget/release/servo目录下
    • 可以直接运行二进制,但是更推荐用 ./mach
      • ./mach run -d -- http://github.com 等价于
      • ./target/debug/servo http://github.com
  3. ./mach
    • mach 是一个 python 的 utility
      • 它做了很多事情,让我们操作起来更轻松,eg.build, run, run tests, update dependencies
      • 应用范围:除了编辑文件和操作git之外,其它的事情都是通过mach完成的
    • ./mach --help
    • ./mach run -d [mach options] -- [servo options]
      • -- 把 mach options 和 servo options 分开
        • -- 不必须,但是建议用它。因为 mach 和 servo 有一些同名的选项,eg. --help --debug
    • 需知晓
      • mach commands ./mach --help
      • servo options ./mach run -- --help
  4. Rust
    • 之前没见过 Rust 也没事,但必须知道一些基本知识
      • [Match]() 和 [Patterns]()
      • [Options]()
      • [Expression]()
      • [Traits]()
      • 确保知道 println! 如何工作,尤其是 [formatting traits]()
  5. Cargo 和 Crates
    • 一个 Rust library 就叫 crate
    • Servo 用了大量的 crate(依赖项),它们位于 Cargo.toml 这些文件里
    • Servo 分为 components 和 ports(有同名文件夹)
      • Cargo.toml 每个文件夹下都有自己的依赖项
      • Cargo.lock 依赖项的特定版本
    • 若要升级 git
      • 正常的 Rust 项目,cargo update -p std_image
      • 但是 Servo 里,./mach cargo-update -p std_image
    • 关于 Cargo 及相关的两个文件
  6. Working on a Crate
  7. Debugging
  8. Test
    • 没有 test 的 PR 不会被合并。均在 tests 目录下
    • 更新一个测试
    • 新增一个测试
  9. Documentation
  10. Ask questions

以上仅为快照,更多详情见 Hacking Quickstart

anjia commented 5 years ago

更多:Tag label names and definitions

Issues: 包括 bugs 和 feature requests 根据 label 和 tag 来找自己感兴趣的话题

anjia commented 5 years ago

Servo Starters. 新手认领任务,Rust / Servo

Servo Starters is a list of easy tasks that are good for beginners to Rust or Servo.

anjia commented 5 years ago

提 PR 的注意事项

Github workflow