runfiles 0.9.0
runfiles: ^0.9.0 copied to clipboard
Bazel runfiles library for Dart. Locates data files at runtime.
Changelog #
0.9.0 #
Breaking #
dart_binaryresolves relative imports when its ownsrcsinclude a generated file- Removed
colocate_entrypointfromutils.bzl Runfiles.rlocationthrows on..and.path segments, as Bazel's runfiles libraries doRunfiles.rlocationreturns absolute paths unchanged and reads escaped manifest linesRunfiles.rlocationfinds files inside tree artifacts and in aMANIFESTinRUNFILES_DIR- Codegen rules make dependencies'
resourcesvisible to generators in a sandbox and on RBE - Codegen shims read the
pubspec.yamlandanalysis_options.yamla target passes inasset_deps - Codegen generators in a persistent worker cannot read files their dependencies did not declare
pub.from_lock()andpub.package()refuse a hosted package without asha256pub.from_lock()andpub.package()refuse asha256that is not 64 lowercase hex digitspub.from_lock()fails when two locks give one version different digestspub.package()fetches pub.dev archives that have padding after the gzip stream- Pub packages drop symlinks that point outside the package, as pub does
- Fetched pub packages are reused across output bases from the repository cache
dart_librarychecks its imports in its own_validationoutput group- Imports by
file:, other schemes,../lib/paths or escaping paths fail the import check - A
partitsdart_librarydoes not hold fails the import check $(location)of akerneloraot-snapshotdart_binarynames a launcher, not the outputkernelandaot-snapshotdart_binarys run withbazel runand as another target'sdatabazel run @rules_dart//dartworks on Windows and writes no analytics into your home- Removed
DartInfo.package_nameandDartInfo.lib_root; readDartInfo.packages DartInfo.depsmaps each dependency to a tuple of its package namesdart_testrunfiles hold only the Dart VM; a test running SDK commands adds@rules_dart//dart- Compile, analyze, format, codegen and web actions take only the SDK files their tool reads
- Removed
dart_toolchain.sdk_root;dart_toolchain.sdktakes adart_sdk_files, the SDK by use - Removed
DartSdkInfo.sdk_rootandDartSdkInfo.tool_files; readDartSdkInfo.files dart_info()takespackages, each built by the newDartPackageInfo(...)dart/pub:pub_library.bzlexportsDartPackageMemberInfofor other rule sets' pub package kindsdart/pub:pub_graph.bzlexports the dependency-cycle planningpub.from_lock()uses- Pub package repositories read
pubspec.yamlwithpackage:yamland refuse what pub refuses - Added
read_pubspecin//dart/pub:pubspec.bzlfor other rule sets' repository rules - Removed
parse_pubspec_depsandparse_pubspec_sdk_constraint; useread_pubspec dart_analyzeruns analysis and fixes in persistent workers, which keep an analysis server- Removed
//dart:analysis_shutdown_workaround;//dart:analysis_worker=falserunsdart analyze dart_testrecompiles only the edited library's modules after an edit inside a function body--@rules_dart//dart:outline_kernel=falsecompiles dependents against full kernelspub.from_lock()fetchesgitpackages at their lockedresolved-ref, refusing any other reffetch_pub_gitfetches a locked git package for other rule sets' repository rulesdart_link_hookhooks see their package's generated sources and only its declared files- Rules calling
dart_link_hook_actionsdeclareCOPY_TO_DIRECTORY_TOOLCHAINS - A root
dart.toolchainpin is used exactly; a dependency requesting a newer SDK fails the build dart.toolchain(allow_upgrade_by_dependencies = True)lets dependencies raise the root's SDK pinexecutable_defines_configlets a rule add defines derived from its attributes to its modules- Removed
module_defines_transition; useexecutable_defines_config dart_entry_kernel_actiontakes nodefines; it compiles inexecutable_defines(ctx)- Codegen and code assets below
dart_tests with differentdefinesare built once - Gazelle copies a test file's
@Tags([...])into itsdart_testtags - Gazelle removes hand-written
dart_testtags not marked# keep, logging each dart_testtakesinclude_tags/exclude_tags;DART_TEST_TAGSnarrows one rundart_testno longer readsdart_test.yaml; its settings go on the targetpub.from_lock(resolve = ...)serves a locked package from your own target, everywherepub.from_lock()fails on apathpackage not in itsresolve,build_from_pubspecorignoreddart_libraryin a directory under a package'slib/builds as part of that package- A
dart_libraryunderlib/that names nopackageis named for its package root, notlib - A target whose package root is ambiguous (a
libinside alib/) fails, naming the fix dart_codegenin or underlib/finds its package root without a same-package dep- Gazelle resolves each imported file, relative imports included, to the rule listing it
- Gazelle emits
dart_binaryanddart_testforbin/andtest/of a package below the root - A pub package's language version is the lower bound of its
environment.sdk, as pub computes it - Removed
derive_language_version;read_pubspecreturnslanguage_version dart_whole_program_kernel_actioncompiles a whole program for anyDartKernelSdkInfoplatformDartKernelSdkInfo.runtimes(fromdart_kernel_runtime) replacesplatformanddefinesdart_binaryrefuses--resolve-dwarf-paths, which gen_snapshot cannot apply to its kernels- The Gazelle plugin is
@rules_dart_gazelle_plugin//dart, from modulerules_dart_gazelle_plugin - Removed
@rules_dart//gazelle/dart; rules_dart no longer depends ongazelleorrules_go - Removed Dart SDKs 3.11.x and 3.12.x; the oldest
dart.toolchainversion is 3.13.2 - Removed
pub.package(deps = ...); a package's dependencies come from its pubspec pub.package()fails at fetch when its pubspec depends on a package nothing supplies- Gazelle generates
dart_binaryanddart_testinbin/andtest/with nopubspec.yaml - Gazelle reads a package's name and version only from the
pubspec.yamlat its root - Gazelle fails where
dart_package_metadata, directives andpubspec.yamldisagree - A first-party
hook/build.dartstated asbuild_hookfails the build unless code assets replace it - Removed
dart_library.has_unreplaced_hook; state the hook asdart_package_metadata.build_hook pub.package()packages with an unreplacedhook/build.dartfail;ignore_hook = Trueopts out- Gazelle no longer writes a
dart_libraryfor a package'shook/directory - Gazelle writes a builder's
build.yamloptions into its codegen targets'config - Gazelle fails, naming each, on the parts of
build.yamlit cannot carry into the build - Renamed
DartKernelSdkInfo.runtimetoaot_runtime - Moved
dart/pub/pub_lock_hub.bzltodart/pub/private/ - Renamed
DartPackageInfo.lib_roottopackage_root - Renamed
derive_lib_roottoderive_package_root - Renamed
DartPackageInfo.has_unreplaced_hooktounreplaced_hook - Removed
dart_format;bazel run @rules_dart//dart/format -- <patterns>formats as the check does - Removed
dart_fix;bazel run @rules_dart//dart/fix -- <patterns>fixes any number of targets - Removed
dart_binarycompile_mode"jit-snapshot"; use"kernel","aot-snapshot"or"exe" - Removed
//dart/ext/tools:check_dual_build_collisions pub.package()andpub.from_lock()build the highest version any module or lock asks for- A root request another module raises warns;
pub.settings(check_direct_dependencies)sets that - Removed
pub.from_lock.on_version_conflict; the highest version is always built ignore_hooksandignore_hookin a module other than the root fail the build@rules_dart//dart/pub:pub_versions.bzlexportsselect_pub_versionfor other rule sets- A package the root's lock lists from git overrides another module's lock entry for it
- Renamed
dart_analyzable_infotodart_analyzable_info_no_package,srcsnowentry_srcs - Renamed
dart_analyzable_info_with_packagetodart_analyzable_info; it takespackages - Renamed
DartAnalyzableInfo.srcstoentry_srcs; removedpackage_srcs, usedart_info.srcs dart_analyzable_inforefuses anentry_srcsfile under a package'slib/- Gazelle writes one
dart_libraryper package, at its root, holding all of itslib/ - Gazelle names an annotated source's targets for its path under
lib/ - Gazelle deletes the BUILD files it wrote under
lib/and fails on one holding more - Gazelle keeps in
srcsa.g.dartor similar file that no codegen target produces - Removed
json_serializable_libraryand the other*_librarycodegen macros <builder>_codegenmacros write a builder's codegen targets, for adart_library'ssrcs- Gazelle puts annotated sources and what they generate in the package's one
dart_library - Gazelle builds plain and annotated sources of a package that import each other
dart_package_metadataalso states a package'sversion,license_file, hooks andcode_assets- Removed the package facts from
dart_library; name adart_package_metadatawithpackage - Removed
package_nameandlanguage_versionfrom the codegen rules - Removed
package_nameandlanguage_versionfromdart_binary,dart_testand the web binaries - An executable naming a
dart_package_metadatais in its package wherever its BUILD file is - Targets of one package that name different
dart_package_metadata, or one none, fail the build - A package's build hook, license and code assets reach programs through any of its targets
- Added
package_info_from_metadata(), the package record of a target namingdart_package_metadata - A program's own
packageships its code assets and runs its link hook, as a dependency's - Added
program_packages(): a program's own package and those its deps reach - Gazelle writes a
dart_package_metadataat each package root, named by every rule it writes - Gazelle states hooks and
license_file(NOTICES, elseLICENSE) on the metadata - Gazelle drops inline package facts from rules and moves a library's
code_assetsto the metadata - Gazelle rewrites the metadata's name and language version unless marked
# keep - Removed
go_router_libraryand Gazelle's@TypedGoRoute; a Flutter rule set ships that codegen - The codegen builder API moved from
dart/ext/_shared:defs.bzlto@rules_dart//dart/ext:defs.bzl - The combining shim moved to
@rules_dart//dart/ext/combining_shim:bin - Gazelle puts every directory below a
pubspec.yamlin that package,tool/andexample/included - Gazelle treats a
dart_package_metadatawith no pubspec as a package root # gazelle:dart_package_nameanddart_language_versionno longer apply inside a nested package- Targets naming two
dart_package_metadatafor one package root fail where they meet - Gazelle names the
dart_package_metadatait writespubspec-metadata, and fails on two - A pub package's
dart_package_metadatais//:pubspec-metadatain its repository utils.bzlexportspackage_identity_attrs()andresolve_package_identityresolve_package_identitytakes a declaration from another target and returns its rootutils.bzlexportsexecutable_package_record()for an executable in a declared packagelibrary_package()builds a library's package record, asdart_librarydoes, from itspackagedart_analyzereads dependencies from analyzer summaries; off withdart:analysis_summaries=falsedart_analyzer_sourceanddart_analyzer_toolchainbuild a Dart SDK's summary analyzerdart_info()takes the rule'sctx, and its rule merges inSUMMARY_ATTRSdart_info(analysis_deps = ...)names libraries only the analyzer reads, such assky_enginedart_testruns a test in its package's root inside runfiles, asdart testdoes- Renamed
dart_binary.code_assets_from_depstocode_assets_from_packages; no alias MODULAR_KERNEL_ATTRandmodular_kernel(ctx)inutils.bzlread//dart:modular_kerneldart_entry_kernel_actionrequiresMODULAR_KERNEL_ATTRand fails when it is off.bzlfiles underdart/privateanddart/pub/privatecan be loaded only from rules_dartoverhead-release.yamlreleases only a commit CI passed on; callers grantactions: read- Renamed
dart_code_asset.shared_librarytofileanddart_code_asset.system_uritouri - Renamed
DartCodeAssetInfo.dynamic_librarytofileandDartCodeAssetInfo.system_uritouri - Removed
dart_source_set; use bazel_lib'scopy_to_directorywithdart_library.srcs_dir - Renamed
generator_bintogeneratorondart_codegenanddart_aggregate_codegen - Renamed
dart_sqlcodegen.generator_bintogenerator - Removed
.dartscript generators andgenerator_script; use adart_binaryBuilder shim - Removed
dart_link_hook; usedart_program_assets, linked when it hasrecorded_uses - Removed
dart_link_hook_actions; usedart_program_assets_actions - Removed
link_hook_runner_attr; useprogram_assets_attrsandPROGRAM_ASSETS_TOOLCHAINS - Added
DartProgramAssetsInfo: the assets a program ships, by id, and what each link hook emits - A link hook may emit whatever data assets of its package the program needs
dart_package_metadata.link_hook_assetspromises data assets a hook always emits- Added
program_asset_file(), one asset of a program by id, known at analysis time dart_binaryanddart_testload the libraries of their packages'linked_code_assets- Removed
collect_transitive_code_assets; useprogram_kernel_code_assets - Removed
resolve_code_assetsandcode_asset_identity; useprogram_kernel_code_assets - A
dart_library,dart_testordart_binarydep that none of its files imports fails the build features = ["-dart_unused_deps"]turns the unused-dependency check off- A rule returns
DartUsedWithoutImportInfofor a dep its dependents need not import library_import_checkandLIBRARY_IMPORT_CHECKER_ATTRSlet a library rule check its own importsimport_check_output_groupstakesgenerated, files the rule writes whose imports are usesbazel run @rules_dart//dart/unused_depsremoves deps that none of a target's files imports- Removed
import_check_validation; useimport_check_output_groups
Added #
dart_js_binaryanddart_wasm_binarybuilddepsfor the platform in theirplatform- A library can
select()per web compiler on@rules_dart//dart/constraints:jsand:wasm dart_analysis_test.web_platformschecks web-only code on each web platformweb_platform_config_settingsconfigures an analysis test's target as a web binary doesRunfiles.environmentgives the variables a child process needs to find the runfilespub_test_runnerin@rules_dart//dart/pub:pub_library.bzldeclarespackage:testwith its runner--@rules_dart//dart:track_creation_locationsrecords creation locations in VM builds and testsnon_dart_transitionbuilds a non-Dart target once across runtimes, defines and creation trackingdart_binarypasses define values containing commas through wholedart_binary's kernel is compiled by frontend_server and is about 3.6% smaller@rules_dart//dart/kernel_listreads, rewrites and joins kernel lists for test launchersdart_testruns from a kernel list instead of storing its own copy of the program--@rules_dart//dart:kernel_list=falserestores joined test kernelsdart_link_kernel_actiontakeskernel_listand returns the files a list names--@rules_dart//dart:runner_snapshothalves a short test's start-up with a cached runner snapshot--test_env=RULES_DART_RUNNER_SNAPSHOT_DIR=<dir>puts the runner snapshot cache in<dir>DartPackageInfo.license_filenames a package's license file, read bypackage_license_file()dart_package_info()takes alicense_filepub.from_lock()andpub.package()packages name their rootNOTICES, elseLICENSEpub_lock_package.bzlexportsis_relative_git_urlfor rule authorsbazel run @rules_dart//dart/pub -- get|upgraderuns pub from the pinned Dart SDKpub.from_lock()errors give the@rules_dart//dart/pubcommand that re-resolves each lockpackage:runfilesreads theMANIFESTin a runfiles directory found beside the executablepub.from_lock(build_from_pubspec = [...])builds a lock'spathpackage from its directorypub.from_lock(ignored = {...})namespathpackages nothing may depend on, with the reasonfetch_pub_pathin//dart/pub:pub_lock_package.bzlserves a path package to other rule sets- The outline stripper is built from the source of the Dart toolchain's own SDK version
dart_kernel_sourcebuilds a Dart release's outline stripper, for another platform's kernelsdart_outline_toolchainregisters the outline stripper of a Dart SDK of your own- Codegen rules give generators a
pubspec.yamlwith the package's name, language version anddeps - A codegen
asset_depspubspec whose name or language version differs from the target's fails dart_kernel_sourcebuilds the outline stripper from a Dart SDK checkout given aspathfetch_dart_kernel_sourceserves a Dart checkout'spkg/kerneland outline stripper below a prefix- Gazelle puts a test helper from another
test/directory in the test'ssrcs - Drift's codegen
configreaches its discover, analyzer and part stages - Gazelle writes
drift_dev'sbuild.yamloptions into drift's codegenconfig dart_compile_actionis exported from@rules_dart//dart:utils.bzlmerged_package_recordbuilds the record of a target that is itself a package//dart:utils.bzlexportspackage_lib_prefixpub.cycle()declares pub packages that depend on each other, which then build as one library- Pub packages in an undeclared cycle fail when built, giving the
pub.cycle()to add - A root
pub.cycle()that is not exactly a cycle at the fetched versions fails pub.package()packages can be members of apub.cycle(), as locked ones can- The
dioanddio_web_adaptercycle is curated, so it needs nopub.cycle() bazel coveragereports the line coverage ofdart_testtargets as LCOV@rules_dart//dart:coverage_converterandtest_coveragegive test rules LCOV coveragebazel coverageleaves out lines and files marked// coverage:ignore-*- Gazelle writes a test's
@TestOnastarget_compatible_with builder_shim_librarybuilds the codegen shim runner against a caller's pub hub# gazelle:dart_builderregisters a builder another module ships, from the root BUILD file# gazelle:dart_build_yaml_ignore <path>has Gazelle build without one part ofbuild.yamldart_data_assetanddart_package_metadata.data_assetsdeclare a build hook's data assets--test_env=DART_TEST_ORDERING_SEED=<seed>shuffles adart_test's casesdart_code_asset.shared_librarytakes a prebuilt.so,.dylibor.dllfile--@rules_dart//dart:split_debug_infoputsdart_binarydebug info in adebug_infogroupdart_binary.dart_compile_flagsrefuses--save-debugging-info; usesplit_debug_infoutils.bzlexportsSPLIT_DEBUG_INFO_ATTRandsplit_debug_info(ctx)dart_library.datafiles reach the runfiles of every binary and test that depends on itdart_info()takesdata, carried asDartInfo.runfilesutils.bzlexportscollect_transitive_runfiles(ctx, deps)- Pub package repositories state a
pkg:pubpurl inpackage_metadatafor SBOM tools - Dart SDK repositories state a
pkg:generic/dart-sdkpurl inpackage_metadata //dart/ext/sqlite3and//dart/ext/webcryptostate SQLite's and BoringSSL'spackage_metadatapub_hosted_purl,pub_git_purlandpub_package_identitybuild a pub spoke's identity- Link hooks receive their packages' code assets; only those they keep, as declared, ship
- Added
vm_code_config()anddart_program_assets_actions(code_config): the target hooks see - Added
dart_linked_code_assetanddart_package_metadata.linked_code_assets - A linked program's library for a
linked_code_assetexports only the symbols its uses reach - Added
program_assets_action_args(): a program's assets for an action, in a param file program_assets_action_args(data, code)hands only the data, or the code by name- Added
program_kernel_code_assets(): every code asset a program's kernel maps - Added
@rules_dart//dart/program_assets, whoseProgramAssets.readreads what ships dart_program_assetswrites<name>.program_assets, which a test reads from runfiles- A link hook emitting names that differ only in case, or a file and its directory, fails
- The
pubextension reports every unpinned package and lock disagreement in one failure dart_package_cyclebuilds workspace packages that import each other as one targetdart_package_memberholds one package of adart_package_cycle- The import check's missing-package error points at
dart_package_cycle # gazelle:dart_cycledeclares packages that import each other, which Gazelle builds as one- Gazelle fails on packages that import each other with no
dart_cycle, naming the directive pub.from_lock()names the fix for a cycle between aresolvepackage and pub packages- Codegen rules take the
dart_package_members of a cycle indepsand read their sources dart_package_cycle.srcsholds what generators write for the members' sources- Gazelle writes the codegen targets of packages a
dart_cycledirective declares
Changed #
- The
dart_analyzeformat check no longer re-runs when only a target's dependencies change - Analysis,
dart_binaryanddart_testre-analyze faster in workspaces with many packages dart_testno longer recompiles its entrypoint when only libraries it does not import change- The Dart SDK is downloaded and extracted once per machine, not once per output base
- A body edit in a library no longer reruns the import check of every library above it
DartInfohastransitive_src_dirs, the directories amongtransitive_srcs- The code generators' pub packages are on their latest versions (analyzer 14.7.0)
- Without a runfiles tree,
dart_testno longer copies its own program and kernels - Without a runfiles tree, a
dart_testfinds other repositories' runfiles beside its own pubextension results are no longer written toMODULE.bazel.lockdart_testwithout a runfiles tree (Windows) lays out only its owndata, sources and resources
Fixed #
dart_compile_flagsaccepts a-D,--defineor--enable-experimentvalue as a separate item--verbosityindart_compile_flagsfilters front-end messages tooCOPY_TO_DIRECTORY_TOOLCHAINSworks in modules that do not depend onbazel_lib- A
dart_teststarted from another target'sdataruns its own test @hub//:<name>resolves for a locked package that is also declared withpub.package()- A fetched pub package depending on a package nothing in the build supplies fails, naming both
bazel query @rules_dart//...works from a module that depends on rules_dartdart_testanddart_binarybuild when the target name has a/, such assub/x_testdart_codegenoutput forbin/andtest/sources imports them by relative pathdart_codegenfails when a generator writes its temporary staging path into the outputdart_testmodule compiles in a persistent worker read only their declared inputs- Gazelle writes the deps of a
dart_binaryordart_testnamed for its own package - Gazelle no longer gives a
dart_librarya pub dep on the package it provides - Codegen actions fail with an error when the analyzer or a builder resource cannot be released
pub.from_lock()fails on a lock with a duplicate package or key, or a second YAML document- Pub packages are extracted with a hermetic bsdtar from
tar.bzl, never the hosttar - A pub archive with an absolute or
..entry name is refused, as pub refuses it dart_binaryno longer runspub geton the workspace's pubspec in unsandboxed builds- Codegen for a package that states no language version runs at the SDK's version, not 3.0
- Codegen warnings show for every action a persistent worker runs, not only its first
- Gazelle adds json_serializable for a freezed class with a
fromJsonfactory - Gazelle's multi-builder codegen chains build: each stage gets its source's deps and parts
- Gazelle sets a macro's
annotation_depwhen its runtime package is not in@pub_deps - Codegen macros accept
depsthat already list theirannotation_dep - Gazelle puts a
test/helper in thesrcsof each test importing it, not adart_test - Gazelle deletes the
dart_testan earlier version made of a test helper - Gazelle ignores
importandexportlines inside string literals and comments - Gazelle writes codegen for an annotated source with no BUILD file above it
pub.package()without asha256names the pub.dev API URL whosearchive_sha256gives itdart_analyzeworkers on Windows stop their analysis server when the worker is killed- Gazelle writes a
dart_binaryfor each file with amainintool/,example/and the like - A
dart_builder_runtime_depoverride replaces the builder's default runtime library indeps --@rules_dart//dart:extra_dart_definesno longer reaches build tools in the exec configuration- Flipping a test or analysis flag of
@rules_dart//dartno longer rebuilds build tools dart_librarymodule compiles no longer hang after one of their modules fails to compiledart_analyzeanddart_fixreserve more memory for large programs analyzed from source- A web binary's platform error names
:vmfor a platform that carries no web compiler dart_js_binaryproduces the<name>.js.mapits script points atdart_wasm_binary's source map names sources relative to itself, not by sandbox path- The highest of several requests for a package now counts
+buildmetadata, as pub does pub.from_lock()refuses a malformed lock instead of skipping its packages- The import check accepts
import '' as self;, as ffigen writes it - The import check refuses an import with a query or fragment, which loads a second copy
dart_testandkernel/aot-snapshotdart_binaryno longer read the workspace's.dart_toolutils.bzlexportsEMPTY_PACKAGE_CONFIG_ATTRandempty_package_config(ctx)- Codegen fails on a source with syntax errors, naming them, unless the builder allows them
- Releases attach API docs for the public .bzl files
- Depends on rules_cc 0.2.28
- The module's
package_metadatastates its Apache-2.0 license dart_testwithout a runfiles tree (Windows) lays out runfiles that are symlinks
Full Changelog: https://github.com/aran/rules_dart/compare/v0.8.1...v0.9.0