Is there a way to generate custom extensions in Gradle via plugin to use in build script? - gradle

I have a use case where I need to generate custom extensions just like the ones generated for libs.versions.toml but for completely different purpose. So I wonder if I can make Gradle generate them via plugin.
I searched in Gradle docs but did not find any clue.

Related

Groovy files from a plugin

I want to know if it's possible to get the groovy files in place of the .class files of a plugin.
The scenario is as follows:
The system uses some plugins (made by the company);
These plugins use another and another...
it's something like this:
-> GenericSystem
-> PluginA
-> PluginB
-> Plugin1
-> PluginBase
In Grails 5 plugin classes are accessible in .class, but I would like to know if it is possible to generate .groovy instead of .class.
It would be interesting to have the .groovy files instead of the .class so that, if maintenance is needed in plugins, the developer can test the project without having to generate a new version of the plugin.
I tried to find something in the grails documentation or on the internet, but to no avail.
It would be interesting to have the .groovy files instead of the
.class so that, if maintenance is needed in plugins, the developer can
test the project without having to generate a new version of the
plugin.
Our plugin system is not setup to support that. A well designed plugin will provide options for customizing and testing the behavior of the plugin, but not by way of providing source code instead of bytecode. The bytecode has to be provided, and is what will be loaded by the plugin runtime system.

How do I make a custom gradle template?

https://github.com/townsfolk/gradle-templates
After much reading in forums, gradle's jira, and githubs, it seems the above plugin is the popular choice for getting maven archetype-like functionality in Gradle.
It comes with multiple templates to choose from, but how do I make my own?
Is there a guide or something that can kick start me into making my own template?
I have a setup I made to generate a new application with all the boiler plate pieces my company requires. I was able to generate this from an existing project using maven archetypes. I want to accomplish the same in Gradle so I can also take advantage of the ability to run groovy scripts when the generation occurs.
So far it looks like the only way to do this is to fork that project and make my own plugin with added template files and such.
Know this is a old question, but there is a wiki page on how to create your own templates:
https://github.com/townsfolk/gradle-templates/wiki/Template-Customization

Generating an uber/fat/shade sources-jar (and javadoc-jar) using Gradle

Does anyone know how to make a uber/fat/shade sources-jar (and javadoc-jar) using Gradle?
The generated Jar should not only contain the sources of the current project but also the sources of it's dependencies. I have been looking at, among others, a vanilla way and a way using the Shadow Plugin. Both work great at creating a normal uber/fat/shade jar, but none of them seems to support a way to create a sources-jar.
Use Shadow Plugin. In Maven it is called shade plugin. Does same thing. It produces an executable uber jar!

Is it possible to use wro4j to parse files and generate 'sass' versions of css without applying any bundling?

We are trying to run a SASS parser over our CSS files as part of our Maven build, but do not want them to be bundled together at the same time during this phase of the Maven life cycle.
However, I cannot see a simple way of using wro4J to do this without specifying each individual file as its own bundlem which just doesn't feel right. Have I missed some configurationm or is bundling so much at the core of the design of wro4J that it must be used like this?
This feature is not supported by wro4j yet, but it is planned to be added in future. In the meantime, you can use SassCssProcessor with a custom maven plugin which just applies the processor on each resource from a configured folder. The link to the issue describing the feature you need: https://github.com/wro4j/wro4j/issues/583

How to use auto_import feature with FreeMarker and maven or ant (not servlet)

I'd like to test using freemarker to automatically build my html files at compile time (not use the servlet) and want to use the auto_import feature so I don't have to re define the template for each file. I can either use ANT or Maven. How do you use the auto_import feature to automatically load templates within FreeMarker using either ANT or Maven?
auto_imports is just one of the many FreeMarker settings, and it has nothing to do with servlets, Maven or Ant. So if you can process the files with Ant or Maven (one way is using the Maven FMPP plugin or the Ant FMPP task), then you should be able to use use auto_imports as well.
Update: There's an issue with FMPP (until 0.9.15 is released): it doesn't know this setting, so you can't set it through FMPP. But instead it has "Header and footer choosing", which is even more flexible. See: http://fmpp.sourceforge.net/settings.html
Have you tried FMPP?
FMPP is a general-purpose text file preprocessor tool that uses FreeMarker templates.
It can be used via command-line or Ant and might provide all the features you need.

Resources