-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generalized rootPackageAssetFor
method or equivalent.
#78
Comments
localPackagePathFor
method or equivalent.rootPackageAssetFor
method or equivalent.
Love the general idea. We should discuss... |
So |
It just gives you an |
But if it doesn't copy anything over, doesn't that mean the |
The asset may or may not exist, this method could be used by the |
It seems confusing to me that the system would provide a function that canonicalizes a particular location for external packages without providing corresponding infrastructure to actual create those assets. |
It does provide the infrastructure, through |
Maybe a more full example would help, lets say you want to produce a metadata file for all dart files, but you don't want to publish that metadata with each package. You might have a Future build(BuildStep buildStep) {
var metaId = rootPackageAssetIdFor(buildStep.input.id).addExtension('.meta');
var metaContents = getMetaFor(buildStep.input.stringContents);
var metaAsset = new Asset(metaId, metaContents);
buildStep.writeAsString(metaAsset);
} Then a later Future build(BuildStep buildStep) {
var metaId = rootPackageAssetIdFor(buildStep.input.id).addExtension('.meta');
var meta = await buildStep.readAsString(metaId);
/// etc
} |
Okay, that makes sense. I think it's fine as long as you're careful to explain that it's just a convention, and provide an example like the one above. |
closing as I don't think we actually need this any more. |
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):The
rootPackageAssetFor
method would return a path likelib/$someSpecialFolder/${original.package}/${original.path}
wheresomeSpecialFolder
is a special folder name that we decide to reserve for this purpose.The text was updated successfully, but these errors were encountered: