Skip to content

Skylark: cfg="data" is deprecated, but you're forced to use it for attributes named "data" #4316

Closed
@tvolkert

Description

@tvolkert

addTargets(getPrerequisites(ruleContext, "data", Mode.DATA), RunfilesProvider.DATA_RUNFILES);

That check means that any attributes named data but configured for either the target or host configurations will cause the build to fail:

Caused by: java.lang.IllegalStateException: /.../BUILD:<line>:<column>: <rule> attribute data is not configured for the data configuration
	at com.google.devtools.build.lib.analysis.RuleContext.checkAttribute(RuleContext.java:1028)
	at com.google.devtools.build.lib.analysis.RuleContext.getPrerequisites(RuleContext.java:718)
	at com.google.devtools.build.lib.analysis.Runfiles$Builder.getPrerequisites(Runfiles.java:1165)
	at com.google.devtools.build.lib.analysis.Runfiles$Builder.addDataDeps(Runfiles.java:1012)

I'm told that new Skylark rules should not be using the data configuration, as it's deprecated and exists merely for legacy reasons. If that's the case, we shouldn't be forcing users to use it for attributes that happened to be named "data".

@laurentlb

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions