Customizing gradle for unsupported language - gradle

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?

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 set build tags in source file

New to go. I'm familiar with the ability to consume build tags in source files like so:
// +build linux arm,!linux
but is there any way to create/export build tags in a source file? Something like:
// +build +custom_tag_name
I'm trying to do what the -tags argument does inside of a source file instead of adding it to a makefile so that when a library is added to a project, it will "set" certain tags that can be used in other files.
You can't do that. Source files can only set build constraints on themselves, they can't satisfy constraints. Constraints can only be satisfied as noted - implicitly by the environment, or explicitly via the -tags flag. Build constraints are a way to achieve environment-sensitive conditional compilation. Using one source file to control the build of another doesn't really make sense; you know at build time whether file A is in the build, so you know whether file B should be in the build. This seems like an XY Problem, possibly better solved by a mechanism similar to that of the SQL drivers (registering a handler in an init function) or something like that?

Method to make IncludeDirs available to external tool

I'm currently trying to make splint available as an external tool in Visual Studio 2010.
It has problems with finding all includes for the file, since it seems that the INCLUDE variable is only set at build time and I haven't found any other possibility to extract the include files in any way.
My question: Would there be any way to extract the IncludeDir field from the current file's project's Properties page, ideally with the VC++'s AdditionalIncludeDirectories?
Note also that AdditionalIncludeDirectories is per file, as it can be changed for individual source files as well as on the project level, and if it contains macros it can evaluate differently for each source file too!
I'm not familiar with driving the MSBuild objects via the API, but that's used by the IDE. Whether that way or by simply running MSBuild.exe, you need to get it to figure out all the properties, conditions, etc. and then tell you the result. If everything is well behaved, you could create a target that also uses the ClCompile item array and emits the %(AdditionalIncludeDirectories) metadata somehow such as writing it to a file or passing it to your other tool somehow. That's what's used to generate the /I parameters to CL, and you can get the same values.
If things are not well behaved in that necessary values are changed during the detailed build process, you would need to get the same prelims done just like the ClCompile target normally does, too. Or just override ClCompile with your own (last definition of a target is used) so it certainly is in the same context.
Either way, there are places where build script files can be automatically included into all projects, so you can add your stuff there or use a command argument (I think) to MSBuild to add another Include.
—John

Automatically extracting gcc -I paths for indexing source code in Emacs

After reading:
A Gentle Introduction to CEDET
A Functional Introduction to CEDET-EDE
I learn that when creating a project folder with an existing make file and source code, I can have semantic index the files by either:
defining a simple EDE project with:
(ede-cpp-root-project ... :system-include-path '( "~/exp/include/boost_1_37" )
or by specifying the include paths to semantic directly with
(semantic-add-system-include "~/exp/include/boost_1_37" 'c++-mode)
But this still requires me to type the paths manually. Is there any way to automatically extract the include paths for semantic from an existing make file?
Background:
Some IDEs have a function to autodiscover gcc -I paths from an existing make file. For example, in Eclipse, you can create a project on a path with an existing make file and source code, and Eclipse would infer the include paths for its "intellisense" when building the project (I presume Eclipse parses the output of GNU make to do this). I would like to do the same in Emacs.
The answer is "yes": There's a way to discover this include path. AFAIK the code for it hasn't been written yet (tho I may be mistaken on this one). All you need to do is to run make -n and look for the "-I" in the output. Of course, the devil is in the details, but it should be possible to write a proof-of-concept fairly easily.

How to create packages for different configurations of the same product in PackageScript?

we call Mac PackageMaker from an Ant script, to build our product installation package.
I would like to pass a parameter 'productConfiguration', that will direct the package to include or exclude certain components, e.g. in order to create a smaller Trial version package.
What is the correct way to achieve that?
Notes:
In Windows we use InstallShield's Features, Conditions, Release Flags, Configuration Flags.
Are there similar concepts in PackageMaker?)
Where is the documentation of pkmkdoc spec 1.12?
The only way I can think of, is to generate [some of] the xml files inside the install.pmdoc smart folder, using templates. But it looks very inelegant to me.
Packagemaker doesn't contain a lot of sophisticated features for things like this. I would suggest tweaking the ant script by creating a separate build target that builds the trial installer. This target can customize both the files included and the PackageMaker parameters.

Resources