3

. . We are migrating to Rational Team Concert (RTC) and want to leverage its 'component' definitions. Components used in a stream result in a local scm workspace which is flat and its physical root is not in scm, like this:

|- workspace-name
   | component1
   | component2
   <empty>

Files in source code only exist in component folders, workspace-name is just a filesystem parent so unless I copied code into there at build time, it is empty of build files or code.

I found numerous good questions and answers on, e.g., flat project layouts, generic component layout, and an excellent primer on how Gradle works re: logical vs physical layouts. These still didn't quite address my confusion.

What I'm trying to do is this:

|- workspace-name
   | component1
   | component2
   | buildSrc

I have this in buildSrc/settings.gradle:

includeFlat '../component1/compa','../component2'

Right off the bat it gives me error that my custom task (defined in buildSrc\src\main\groovy\CustomTask.groovy) does not exist (could not find property 'CustomTask' on project ':component1/compa').

I believe that's because buildSrc should be in the projectroot directory itself (as implied by gradle docs) , e.g.:

|- workspace-name
   | component1
   | component2
     | buildSrc

Which leads me to think that maybe I need a dummy component which becomes both the logical parent as well as the buildSrc parent.

My question is, if I have no physical root, what's the "best" place to put my settings.gradle file? Each component will need code from the custom tasks to build so I'm also looking for the best place for that (if not in the dummy component). Thank you!

Andy

Community
  • 1
  • 1
AndyJ
  • 1,204
  • 3
  • 14
  • 28

2 Answers2

1

I would try to stay away of dummy component, and:

  • either store a buildSrc folder in each component, with component-specific Gradle files
  • or store all buidSrc Gradle file in one component, and having a script able to copy/create what is needed in each component when a build is requested.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your feedback. I'm a bit wary of having to copy build scripts to different places. – AndyJ Oct 15 '13 at 20:06
1

There can only be one buildSrc per build, and you put it in the right place. However, buildSrc is its own build, and it doesn't make sense to make it include projects of the main build (as you apparently tried). Also the argument to includeFlat isn't a file path. Not quite sure what you are trying to achieve here.

As for the main build's settings.gradle, if you can't put it into the root directory, the other option is to put it into a directory named master. (This is a built-in convention and cannot be reconfigured.)

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
  • Thanks for the feedback - I'll investigate using "master". My purpose of using includeFlat was to try to build the project relationships from the adjacent-level "dummy" folder. Looks like that was the right angle though at least now it has a smarter name. – AndyJ Oct 15 '13 at 20:08