Closed
Description
You can't output files in other packages, but it is common to want to output a file which corresponds to a file in another package (maybe its the compiled js file, or a metadata file). Sometimes these files can just be published with that package, but there are a lot of situations where that might not be the ideal case, and it makes sense for the application package to do all the code generation.
My proposed solution is to add the following as methods on BuildStep
(which has a package graph representation):
/// Gives a path corresponding to [original] in the local package.
AssetId rootPackageAssetFor(AssetId original);
// Should this return a Uri or a String?
String assetIdToUri(AssetId id);
// Should this take a Uri or a String for the first arg?
// Relative paths will be relative to [from]. Should this be an optional arg?
AssetId uriToAssetId(String uri, AssetId from);
The rootPackageAssetFor
method would return a path like lib/$someSpecialFolder/${original.package}/${original.path}
where someSpecialFolder
is a special folder name that we decide to reserve for this purpose.