Accessing native component executable to generate source from task


(Tom Stark) #1

I’m trying to build a custom native code generator from within a model and then use that executable to build other source for a different native component within the same project. The problem I’m having is accessing the executable from inside the task. Here is a snippet of the build.gradle:

ext {
   genDir = "${buildDir}/gen"
}

task genSrc {
    _// setup the inputs and outputs here_ 
   doLast {
      def srcGenerator = new File( **srcGenExe** )
       _// run the src generator for each file_
   }
}

model {

   components {
      srcGenExe(NativeExecutableSpec) {
          _// sources here_ 
      }

      someOtherExe( NativeExecutableSpec) {
         sources {
            cpp {
               builtBy genSrc 
            }
       }
   }
}

Problem: What is the correct syntax for accessing the executable from the task? (or is this possible?)

I already tried adding the task to the model but that creates a ‘cycle’ so I moved it outside the model.

Thanks.