Dealing with global variables

I’m trying to import GradleFx plugin into my project. The problem with it is that for some reason the plugin is designed in such a way that instead of setting configuration values on per-task basis, all settings are global… The plugin is a mess and a total disaster in every respect, but writing a replacement would be both tiresome and not worth anyone’s time, so here’s the question: how do I isolate the settings one plugin made global such that they would only apply to some tasks. For example, this plugin relies on global variable “mainClass” to tell what the main class of the target binary should be, on global variable “type”, which, if set to “swf” will invoke “mxmlc” compiler, and if set to “swc” will invoke “compc” compiler and so on. I need to build about fifty different SWFs in one project and a handful of “swc” in the same project.

I was looking into “subprojects” Gradle “construct”, but the documetnation is very poor, to the point I can’t figure out whether it talks about something that can be defined inside one file or that it is a way of handle multiple biuld files.

From what I understand from your description is that your project is a multi-project build. It’s not clear to me how you apply the extension in your build. My guess is that you apply it to just the root project or to all projects using the ‘allprojects’ method.

It sounds like you are on the path by using the ‘subprojects’ method assuming that you really want to apply the logic of the GradleFx plugin to all subprojects. In that case you define the following in your root project.

subprojects {
    // configure the plugin extension

I’m not sure what multy-project build means in Gradle. It is a single file with multiple targets in it.

Short description of the task: I have about 50-70 TTF files, for which I generate AS3 wrapper classes (SWF linker works in such a way that in order to access resources in the loaded binary one has to link them to classes). Per each class generated I also generate a preview of the font (a PNG image with a few letters from the font being transcoded) and a SWF (from the previously generated AS3 class).

The number of TTF files varies between builds. In fact, the most likely reason for the build is that the number of files had changed. Files can be added, deleted or renamed.

The later precludes me from creating a build file per font. (This would be equivalent for me to just compling them manually).

Since I posted, I resumed to writing a wrapper for MXMLC and COMPC, but I would still like to know how to deal with such problem. Most importanlty, I’m bugged by the question why would anyone ever use GradleFx task, since it looks like a very bad solution for any problem (at least from the perspective I’m looking now), but I give it the benefit of doubt: maybe I don’t understand something about it…

So, is it customary for Gradle plugins to import tasks (not task classes) into your project? (If so, why would anyone want this?). Is it customary for Gradle plugins to declare global constants on the project-wide scale (and if so, why would anyone want to do this?).

Did I understand it correctly, that ‘subprojects’ is the way to recursively invoke another Gralde scripts rather than group projects declared in the same script (I find the second to be a much better solution for projects of any scale, and am wondering why would anyone want to have build script split into parts based on what target is being built rather than what functionality the module contains).