I'm trying to set up an artifact transform where o...
# community-support
l
I'm trying to set up an artifact transform where one of the "to" attributes depends on an extension. The problem is, lazy-loading the attribute with
attributeProvider
still tries to retrieve the extension property immediately and causes the plugin to fail to apply. (Line 23 of https://paste.ofcode.org/k36CjhiWRKJQkdv2FeyMZz) Running it in
project.afterEvaluate
does allow the plugin to be applied, but the artifact transform is unusable due to being applied so late. Does anyone know how to make this work?
The specific error is "Could not register artifact transform DevRuntimeJarTransform [...] Cannot query the value of extension 'platformExt' property 'platform' because it has no value available." In the buildscript though, it's definitely set:
Copy code
architectury {
	platformSetupLoomIde()
	neoForge()
	
	platformExt {
        platform.set(objects.named<MCPlatform>(MCPlatform.NEOFORGE))
	}
}
And refactoring the extension to make platform a String instead of a Named didn't fix it either. The attribute tries to resolve instantly either way, despite using
attributeProvider
.
I've confirmed by testing that it's the attribute causing the error, and not the parameter later on.
v
I don't think this works.
registerTransform
calls
doRegisterTransform
And
doRegisterTransform
calls
asImmutable()
on
from
and
to
which immediately realizes those lazy attributes. It would probably be better and clearer if on artifact transform registration no
attributeProvider
method were available.
l
So it's just not dynamic at all. Awesome. At least I know now.
v
Maybe you should post a feature request or bug report. I don't know whether it could be supported, or maybe the
attributeProvider
removed in that case, I'm just a user like you. 🙂