proud-dentist-22844
06/01/2023, 11:11 PMcontent with dependencies (actually looking at the feasibility to get rid of all of the SpecialCasedDependencies fields like content).
If you put file(s) or resource(s) in the jvm_war(dependencies=...) field, are they ignored today (I hope the answer is yes)? Or do they somehow end up in one of the JARs on the classpath? It's not clear to me from reading through the rules.witty-crayon-22786
06/02/2023, 12:33 AMIf you putthe latter. there is slightly different handling fororfile(s)in theresource(s)field, are they ignored today (I hope the answer is yes)? Or do they somehow end up in one of the JARs on the classpath?jvm_war(dependencies=...)
content vs dependencies, but both are actually “dependencies” which should be tracked ./pants dependencies, --changed, etc.witty-crayon-22786
06/02/2023, 12:34 AMSpecialCasedDependencies, i wasn’t necessarily suggesting getting rid of having multiple dependencies fields: ideally, TransitiveTargets would support collecting multiple Dependencies fieldsproud-dentist-22844
06/02/2023, 12:36 AMwitty-crayon-22786
06/02/2023, 12:39 AMwitty-crayon-22786
06/02/2023, 12:40 AMdef include_dep_field(target: Target, field: Dependencies | SpecialCasedDependencies) -> bool: ...witty-crayon-22786
06/02/2023, 12:41 AMDependencies with more subclasses: that’s a larger project, but)proud-dentist-22844
06/02/2023, 1:09 AMwitty-crayon-22786
06/02/2023, 1:19 AMfast-nail-55400
06/02/2023, 3:47 PMcontent and dependencies are different is that the content is unpacked inside the WAR while jars from dependencies are notfast-nail-55400
06/02/2023, 3:49 PMfast-nail-55400
06/02/2023, 3:55 PMfast-nail-55400
06/02/2023, 3:56 PMfast-nail-55400
06/02/2023, 3:57 PMcontent and dependencies together.proud-dentist-22844
06/02/2023, 5:18 PMproud-dentist-22844
06/02/2023, 5:18 PMproud-dentist-22844
06/02/2023, 9:27 PMDependencies fields on jvm_war would be problematic because tgt.get(Dependencies) would (since we always subclass that) get the first field that subclasses Dependencies with one big gotcha: The fields are sorted by alias, so jvm_war_tgt[Dependencies] would return the content field since that sorts before the dependencies field.
So, we would probably need to extend the Target interface so that you can ask for all fields that subclass a given field (Dependencies in this case), and then you would create a DependenciesRequest for each one.
Or, we need to be able to sort the subclassed fields in some other way, for example by preferring one that has the same alias as the parent class.witty-crayon-22786
06/02/2023, 9:38 PMTarget.get_all(Field) would be reasonable... most callsites wouldn't care, but some wouldwitty-crayon-22786
06/02/2023, 9:39 PMproud-dentist-22844
06/03/2023, 12:21 AMFieldSet uses a super class type, and we allow multiple fields of that type, it might not get the right field. 😞 https://github.com/pantsbuild/pants/blob/main/src/python/pants/engine/target.py#L1234
Luckily, the VisibilityFieldSet is the only FieldSet I've found that has a dataclass field for dependencies: Dependencies , the other field sets that require a Dependencies field only include it in required_fields.
`VisibilityFieldSet`: https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/visibility/lint.py#L25-L28
@curved-television-6568 I wonder how we could change the lint rule that uses that field set so it can handle multiple dependencies fields per target. So far, I'm assuming that DependenciesRequest will be for one target+field, so if there are multiple Dependencies fields, then we need multiple `DependenciesRequest`s.curved-television-6568
06/03/2023, 1:07 AMproud-dentist-22844
06/03/2023, 1:49 AMinclude_special_cased_dependencies flag, not eliminating SpecialCasedDepencies in my PR (and therefore merging that with Dependencies). OK. I think I can do that - the rest is a really big rabbit hole that I was getting lost in.witty-crayon-22786
06/03/2023, 4:21 AM