Answer
The third_party
directory is meant for modules that are managed outside of the Fuchsia tree. In the top-level .gitignore
the directory is excluded (link):
/third_party/*
You can see that this folder is mostly empty in git (link). It is first populated during bootstrap (link), which internally uses jiri update
to fetch repos specified in the integration manifest (e.g. for third_party
).
You would maintain your module in a separate git
repo. For development, you would clone this repo into a sub-directory in third-party
. Because of the .gitignore
entry, it will not be tracked by the Fuchsia git
.
Example
Files:
third_party/hello_world/BUILD.gn
third_party/hello_world/hello_world.cc
BUILD.gn
:
import("//build/package.gni")
group("hello_world") {
deps = [ ":hello-world-cpp" ]
}
executable("bin") {
output_name = "my_hello_world_cpp"
sources = [ "hello_world.cc" ]
}
package("hello-world-cpp") {
deps = [ ":bin" ]
binaries = [
{
name = "my_hello_world_cpp"
},
]
}
hello_world.cc
:
#include <iostream>
int main(int argc, char** argv) {
std::cout << "Hello, World (out-of-tree)!" << std::endl;
return 0;
}
Build and run:
$ fx set bringup.x64 --with //third_party/hello_world
$ fx build
$ fx qemu
$ my_hello_world_cpp
Hello, World (out-of-tree)!