Skip to content

Commit

Permalink
Each sub-project gets its own tags file
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbertc committed Jan 9, 2015
1 parent 1e65615 commit b2d1694
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/scala/net/ceedubs/sbtctags/SbtCtags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ object SbtCtags extends Plugin {
Seq(srcDir, depSrcDir)
},

Keys.parallelExecution in ThisBuild := false,

CtagsKeys.ctagsGeneration in ThisBuild := defaultCtagsGeneration,

CtagsKeys.genCtags <<= (Keys.thisProjectRef, Keys.state, CtagsKeys.dependencySrcUnzipDir, CtagsKeys.ctagsParams, CtagsKeys.ctagsGeneration, CtagsKeys.ctagsSrcDirs, Keys.streams) map genCtags)
Expand All @@ -57,8 +55,8 @@ object SbtCtags extends Plugin {
val languagesArgs = if (ctagsParams.languages.isEmpty) "" else s"--languages=${ctagsParams.languages.mkString(",")}"
val extraArgs = ctagsParams.extraArgs.mkString(" ")
// will look something like "ctags --exclude=.git --exclude=log --languages=scala -f .tags -R src/main/scala target/sbt-ctags-dep-srcs"
val ctagsCmd = s"${ctagsParams.executable} $excludeArgs $languagesArgs -a -f ${ctagsParams.tagFileName} $extraArgs -R $dirArgs"
context.log.info(s"running this command to generate ctags: $ctagsCmd")
val ctagsCmd = s"${ctagsParams.executable} $excludeArgs $languagesArgs -f ${ctagsParams.tagFileName} $extraArgs -R $dirArgs"
context.log.info(s"Running this command to generate ctags: $ctagsCmd")
Process(ctagsCmd, Some(new File(context.buildStructure.root)), Seq.empty: _*).!
}

Expand All @@ -68,6 +66,7 @@ object SbtCtags extends Plugin {
val buildStruct = extracted.structure
val log = streams.log
val project = Project.getProject(projectRef, buildStruct)

log.info(s"Processing project named: ${project.get.id}")
EvaluateTask(buildStruct, Keys.updateClassifiers, state, projectRef).fold(state)(Function.tupled { (state, result) =>
result match {
Expand All @@ -86,7 +85,10 @@ object SbtCtags extends Plugin {
val existingCtagsSrcDirs = ctagsSrcDirs.filter(_.exists)
log.debug(s"existing ctags src dirs: $existingCtagsSrcDirs")
log.info(s"Generating tag file")
ctagsGeneration(CtagsGenerationContext(ctagsParams, existingCtagsSrcDirs, buildStruct, streams.log))

val tagPath = s"${project.get.base.getAbsolutePath}/.${ctagsParams.tagFileName}"
val projectCtagParams = ctagsParams.copy(tagFileName = tagPath)
ctagsGeneration(CtagsGenerationContext(projectCtagParams, existingCtagsSrcDirs, buildStruct, streams.log))
state
case x =>
log.error(s"error trying to update classifiers to find source jars: $x")
Expand Down

0 comments on commit b2d1694

Please sign in to comment.