@@ -79,6 +79,43 @@ dependencies between packages are not supported when using hooks.
7979[ `BuildInput.sharedOutputDirectory` ] : {{site.pub-api}}/hooks/latest/hooks/HookInput/outputDirectoryShared.html
8080[ `metadata` ] : {{site.pub-api}}/hooks/latest/hooks/BuildInput/metadata.html
8181
82+ ### Environment variables {:.no_toc}
83+
84+ Hooks are executed in a semi-hermetic environment.
85+ This means that ` Platform.environment ` doesn't
86+ expose all environment variables from the parent process.
87+ This ensures that hook invocations are reproducible and cacheable, and
88+ don't depend on accidental environment variables.
89+
90+ However, some environment variables are necessary for
91+ locating tools (like compilers) or configuring network access.
92+ The following environment variables are
93+ passed through to the hook process:
94+
95+ * ** Path and system roots:**
96+ * ` PATH ` : Invoke native tools.
97+ * ` HOME ` , ` USERPROFILE ` : Find tools in default install locations.
98+ * ` SYSTEMDRIVE ` , ` SYSTEMROOT ` , ` WINDIR ` : Process invocations and
99+ CMake on Windows.
100+ * ` PROGRAMDATA ` : For ` vswhere.exe ` on Windows.
101+ * ** Temporary directories:**
102+ * ` TEMP ` , ` TMP ` , ` TMPDIR ` : Temporary directories.
103+ * ** HTTP proxies:**
104+ * ` HTTP_PROXY ` , ` HTTPS_PROXY ` , ` NO_PROXY ` : Network access behind proxies.
105+ * ** Clang/LLVM:**
106+ * ` LIBCLANG_PATH ` : Rust's ` bindgen ` + ` clang-sys ` .
107+ * ** Android NDK:**
108+ * ` ANDROID_HOME ` : Standard location for the Android SDK/NDK.
109+ * ` ANDROID_NDK ` , ` ANDROID_NDK_HOME ` , ` ANDROID_NDK_LATEST_HOME ` ,
110+ ` ANDROID_NDK_ROOT ` : Alternative locations for the NDK.
111+ * ** Nix:**
112+ * Any variable starting with ` NIX_ ` .
113+
114+ Any changes to these environment variables
115+ cause cache invalidation for hooks.
116+
117+ All other environment variables are stripped.
118+
82119## Assets
83120
84121Assets are the files that are produced by a hook and then
@@ -270,17 +307,17 @@ void main() {
270307There are several example projects to help you get started
271308with hooks and code assets :
272309
273- | **Project** | **Description** |
274- | ---------------------------- | --------------------------------------------------------------------------------------- |
275- | [`sqlite`][] | A package compiling, bundling, and using a native database engine. |
276- | [`mini_audio`][] | A package compiling, bundling, and using a native audio player. |
277- | [`stb_image`][] | A package compiling, bundling, and using a native image library. |
278- | [`host_name`][] | A package using a native system library. |
279- | [`native_add_library`][] | A package compiling, bundling, and using some simple C code. |
280- | [`native_add_app`][] | A Dart CLI application that depends on `native_add_library`. |
281- | [`download_asset`][] | A package bundling and using prebuilt assets that are downloaded in the build hook. |
310+ | **Project** | **Description** |
311+ | ---------------------------- | ------------------------------------------------------------------------------------------ |
312+ | [`sqlite`][] | A package compiling, bundling, and using a native database engine. |
313+ | [`mini_audio`][] | A package compiling, bundling, and using a native audio player. |
314+ | [`stb_image`][] | A package compiling, bundling, and using a native image library. |
315+ | [`host_name`][] | A package using a native system library. |
316+ | [`native_add_library`][] | A package compiling, bundling, and using some simple C code. |
317+ | [`native_add_app`][] | A Dart CLI application that depends on `native_add_library`. |
318+ | [`download_asset`][] | A package bundling and using prebuilt assets that are downloaded in the build hook. |
282319| [`native_dynamic_linking`][] | A package compiling, bundling, and using three native libraries that depend on each other. |
283- | [`use_dart_api`][] | A package that uses the C API of the Dart VM. |
320+ | [`use_dart_api`][] | A package that uses the C API of the Dart VM. |
284321
285322{: .table .table-striped }
286323
0 commit comments