Adding support for new non-JVM language

What is the best place to look for examples to implement a SourceSet for a non-JVM language? The Scala/Clojure/Groovy source sets all build off the Java source sets, which are not quite appropriate. The C/C++ source sets seem to do a lot more than required and are all dependent on internal Gradle classes.

Any other examples I could look at? Or at least some pointers on what I would for an implementation would be appreciated

maybe look at the cpp plugin?

The native set (c,cpp,asm) is too complex an implementation to use as an archetype for many other languages.

The new source sets are the way forward not only for cpp, but also for the new jvm plugins as well as most other languages. And unless your source sets need additional properties, you don’t need to implement your own types anymore. Just be aware that the API is still incubating and breaking changes are possible.

Peter, I am still nto quite clear how I would go about to do something for arbiitrary language ‘Foo’ which might require it’s files to be in ‘src/foo’, ‘src/foo/test’, ‘src/foo/docs’.

Note: I have specifically chosen a layout which does not match with any of the existing languages supported by Gradle.

We’re actively working on making it easier to add support for a new language. This will be based on the current native language plugin implementations, as well as the the new ‘java-lang’ and ‘jvm-components’ plugins. Following this pattern is the way to go, although a lot of changes are planned in this area to make this a lot simpler.

What is the target platform/runtime for the language you want to support: the ‘native’ © runtime? the JVM? a Javascript interpreter? Something else?

I have pretty coy about this to date as I wanted to experiment first. However, I will mention at this point that I have been looking at Ruby. Some people might now that I have been involved with the line of jruby-gradle plugins of late.

One fo the things we are looking at is to call Rake (via JRuby) from Gradle. When using Rake there is a conventional file layout, more or less as below

lib
bin
data
doc
spec
 test

At this point I don’t think the tests can be spit away in the same way as we are used to for other (maybe it can, but I am not a Rake expert).

As a start I thought that maybe it could be hosted below ‘src/ruby’ and I have come up with the below Gradle psuedo-code

sources {
    main {
        ruby {
            source {
                srcDirs "src/ruby/lib"
                include "**/*.rb"
            }
            bin {
                 srcDirs "src/ruby/bin"
            }
            data {
                srcDirs "src/ruby/data"
            }
            doc {
                srcDirs "src/ruby/doc"
           }
           spec {
                srcDirs "src/ruby/spec"
           }
       }
   }
      test {
     ruby {
         source {
            srcDirs "src/ruby/test"
            include "**/*.rb"
         }
    }
}

WARNNG: it is really just a concept, nothing more, at this point in time.

Hopefully this will give you more of an idea.