Each valdi module contains a BUILD.bazel file which has a single call to valdi_module macros. The macro setups a few targets and aliases to build the module from source using the Valdi Toolchain.
The list of targets created by the valdi_module macro includes:
module_name:module_nametarget which builds just the.valdimodulefile. It is the default target and can be referenced asmodule_namefor example//src/valdi_modules/src/valdi/jasmine.module_name:module_name_kttarget which builds theandroid_libraryand packages the Valdi generated Kotlin code, if any. It depends on the Valdi module target above and adds the.valdimoduleand other resources to thedataattribute.module_name:module_name_objctarget which builds theobjc_libraryand packages the Valdi generated Objective-C code, if any. It depends on the Valdi module target above and adds the.valdimoduleand other resources to thedataattribute.module_name:module_name_objc_apitarget which builds theobjc_libraryand wraps the generated Objective-C API code, if any. It also depends on themodule_name_objctarget above.module_name:{ModuleName}an alias pointing atmodule_name:module_name_objcto keep the compatibility with iOSmodule_name:{ModuleName}Typesan alias pointing atmodule_name:module_name_objc_apito keep the compatibility with iOS
To build a single module using the default, macOS toolchain:
bazel build //src/valdi_modules/src/valdi/jasmineTo build the Android target:
bazel build //src/valdi_modules/src/valdi/jasmine --platforms=@snap_platforms//os:android_arm64To build the iOS target:
bazel build //src/valdi_modules/src/valdi/jasmine --platforms=//bzl/platforms:ios_x64To ease the burden of writing and maintainting BUILD.bazel Valdi provides a script to automatically generate/update/format BUILD.bazel files based on module.yaml content. In addition to that, the CI infrastructure includes a pre-cool hook to validate BUILD.bazel files.
To add a new dependency:
- Update
module.yaml - Run the script:
./scripts/regenerate_valdi_modules_build_bazel_files.shYou can run your tests using bazel test directly. See documentation about it here: Testing.
Once implemented, users will be able to run linting for a single module using Bazel.
- Updating proto config doesn't trigger a valdi module rebuild