Copying images from various directories AsciiDoctor gradle - gradle

I have a simple question (documentation does not seem to provide a straightforward answer).
I am trying to copy over various resources (images in this case) while running an asciidoctor gradle task.
The directory structure is not the best, meaning that the adoc files and the assorted images are not logically placed but this is something that I cannot change.
I am trying to find a why to do so and I stumbled across the resources option of asciidoctor. Now my main question is how can I configure it correctly in order for it go through all the directories in the base directory and copy over whatever is not a .adoc file over to the target directory (while maintaining the same folder structure)?

Probably you don't need it anymore, but for anyone interested:
The solution is now described in 'Processing Auxiliary Files' section of Asciidoctor Gradle plugin docs.
Here you can see example:
resources {
from(sourceDir) {
include 'images/**'
include 'resources/**'
include 'some_dir/**/*.png'
exclude 'other_dir/**/notThisOne.png'
}
}

If you have a gradle-script anyway, you could use gradles copy task. Just define all sources of your images and copy them to one directory.
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Copy.html

Related

Which build tool supports a separated config folder so that no config files are in the src folder?

i am looking for a build tool that allows me to store the build tool with additional pre and postscripts as well as the build configs in folders separated from the source code.
Most build tools i tried work with config files directly in the source code folder.
Could you recommend something?
I know that it sounds like i am missusing the concept and should simply insert config files in the source code folder. Yet the reasoning behind this will blow up this post without adding a lot of value.
SCons can do it several different ways.
Though Repository() might be the simplest.
See: https://scons.org/doc/production/HTML/scons-user.html#idm46358268990080

How to ignore a .go file in a module?

I am rewriting in Go a home-grade program of mine that was previously in Python, learning on the way. As I reconsider whole sections of the code, it would be great if I could ignore some .go files I wrote (they throw compilation errors which is OK as they are not synchronized with my latest approach to the problem).
I could move them out of the directory, or rename them but I was wondering whether there would be a more idiomatic way to ignore some .go files in a module directory?
Build tags fit perfectly to your use case.
A Build Constraint or also known as Build Tag is used to include or exclude files in a package during a build process. With this, we can build different types of builds from the same source code.
So if you want to exclude a file from the build process, give it a different Build Tag. For example if you use //go:build exclude at the top of the file when you perform go build it won't be included. Note that exclude can be any word.
For more details on the Build Tags check out the following article by Dave Cheney here
TLDR
Add
//go:build exclude for go v1.17 and above
// +build exclude
at the top of the file you wish to ignore.

What is the maven convention for a directory for test files?

So we have a project that is basically nothing but test files and other projects depend on it to run tests. Problem in the past has been that these items are being unpacked in locations outside of the target directory. That means you end up with modified files and new files, none of which are committed. The files are XML and are used to generate other files. What is the Maven standard location for these files? I'm looking here and I don't see anything that jumps out at me as a conventional location. I can wing it, of course, but I'd prefer to use a standard if it exists:
https://cwiki.apache.org/confluence/display/MAVEN/Maven+Properties+Guide
I'm considering this location:
${project.build.directory}/generated-test-resources/resources
The standard directory for test resoures like xml files is:
/src/test/resources
The way to include these test-only kind of projects is by using test-jar as described here.

Customizing gradle for unsupported language

I want to add support in Gradle for a new language.
In order to compile a single file (with explicit file name), I can do something like this:
task compileVCSVlog(type: Exec) {
commandLine 'vlogan', 'somefile.v'
}
But that's of course not good. I'd like to have some iteration over a list of source files.
I assume Gradle has some built in mechanism, that defines the expected src directory name, and make some list of files in it with specific extension (or maybe only those that are needed for an incremental compilation).
Looking at the documentation, I've found sourceSets, which seems to be Java-specific, and things like CSourceSet, CppSourceSet, etc. , which of course, are specific for their languages.
There is a LanguageSourceSet in the JavaDoc, but it seems too obfuscated for me. Is it really what I need? How should it be used? Maybe some usage example?
EDIT
I've come across working with files doc. Is that the preferred way of compiling list of files? Should it be combined with LanguageSourceSet?

Replace reST document with entire directory using Sphinx

My primary documentation for a project is Sphinx. I also have a large amount of JavaDocs that I'd like to integrate. The basic setup is:
sphinx_source/
javadocs_built/
Before building the Sphinx documents, I can copy the JavaDocs into a directory under sphinx_source.
How can I reference this directory with non-reST files in it from within Sphinx and have them be brought along during the build process?
You probably need to reference the files using the :download: directive.
See: here.
Note that you'll need to reference the files individually, so you may want to set up some kind of script to generate the references for you.

Resources