Build Rules

์•ˆ๋“œ๋กœ์ด๋“œ ๋นŒ๋“œ ์‹œ์Šคํ…œ(Soong)์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—ฌ๋Ÿฌ ๋ชจ๋“ˆ์„ ํ†ตํ•ด ๋Ÿฌ์ŠคํŠธ๋ฅผ ์ง€์›ํ•œ๋‹ค:

Module TypeDescription
rust_binary๋Ÿฌ์ŠคํŠธ ๋ฐ”์ด๋„ˆ๋ฆฌ(Rust binary)๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
rust_library๋Ÿฌ์ŠคํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , rlib์™€ dylib variants๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
rust_fficc๋ชจ๋“ˆ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Rust C library๋ฅผ ์ƒ์„ฑํ•˜๊ณ , static and shared variants๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
rust_proc_macroproc-macro Rust library๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ ํ”Œ๋Ÿฌ๊ทธ์ธ๊ณผ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค.
rust_teststandard Rust test harness๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Ÿฌ์ŠคํŠธ ํ…Œ์ŠคํŠธ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
rust_fuzzlibfuzzer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋Ÿฌ์ŠคํŠธ fuzz ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
rust_protobuf์†Œ์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ํŠน์ • protobuf์— ๋Œ€ํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” ๋Ÿฌ์ŠคํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
rust_bindgen์†Œ์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ  C ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•œ ๋Ÿฌ์ŠคํŠธ ๋ฐ”์ธ๋”ฉ์„ ํฌํ•จํ•˜๋Š” ๋Ÿฌ์ŠคํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค

๋‹ค์Œ์€ rust_binary์™€ rust_library๋ฅผ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค.

The Android build system (Soong) supports Rust via a number of modules:

Module TypeDescription
rust_binaryProduces a Rust binary.
rust_libraryProduces a Rust library, and provides both rlib and dylib variants.
rust_ffiProduces a Rust C library usable by cc modules, and provides both static and shared variants.
rust_proc_macroProduces a proc-macro Rust library. These are analogous to compiler plugins.
rust_testProduces a Rust test binary that uses the standard Rust test harness.
rust_fuzzProduces a Rust fuzz binary leveraging libfuzzer.
rust_protobufGenerates source and produces a Rust library that provides an interface for a particular protobuf.
rust_bindgenGenerates source and produces a Rust library containing Rust bindings to C libraries.

We will look at rust_binary and rust_library next.