mirror of https://github.com/sbt/sbt.git
Plugins can now only be Scala sources. BND should be usable in a plugin now.
This commit is contained in:
parent
87f79a3f8c
commit
ee87e10a9f
|
|
@ -135,6 +135,8 @@ final class BuilderProject(val info: ProjectInfo, val pluginPath: Path, rawLogge
|
|||
final class PluginBuilderProject(val info: ProjectInfo) extends BasicBuilderProject with ReflectiveTasks
|
||||
{
|
||||
override def name = "Plugin Builder"
|
||||
// don't include Java sources because BND includes Java sources in its jar (#85)
|
||||
def pluginSourceFilter: NameFilter = "*.scala"
|
||||
lazy val pluginUptodate = propertyOptional[Boolean](false)
|
||||
def tpe = "plugin definition"
|
||||
def managedSourcePath = path(BasicDependencyPaths.DefaultManagedSourceDirectoryName)
|
||||
|
|
@ -167,7 +169,7 @@ final class BuilderProject(val info: ProjectInfo, val pluginPath: Path, rawLogge
|
|||
{
|
||||
FileUtilities.clean(managedSourcePath, log) orElse
|
||||
Control.lazyFold(plugins.get.toList) { jar =>
|
||||
Control.thread(FileUtilities.unzip(jar, extractTo(jar), sourceFilter, log)) { extracted =>
|
||||
Control.thread(FileUtilities.unzip(jar, extractTo(jar), pluginSourceFilter, log)) { extracted =>
|
||||
if(!extracted.isEmpty)
|
||||
logInfo("\tExtracted source plugin " + jar + " ...")
|
||||
None
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
// should not be interpreted as a source file
|
||||
public class JavaTest {
|
||||
}
|
||||
|
|
@ -2,5 +2,19 @@ import sbt._
|
|||
|
||||
trait TestPlugin extends DefaultProject
|
||||
{
|
||||
lazy val check = task { log.info("Test action"); None }
|
||||
lazy val check =
|
||||
task
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("JavaTest")
|
||||
Some("Java source should not be compiled as part of the plugin")
|
||||
}
|
||||
catch
|
||||
{
|
||||
case _: ClassNotFoundException =>
|
||||
log.info("Test action")
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
$ copy-file changes/TestPlugin.scala src/main/scala/TestPlugin.scala
|
||||
$ copy-file changes/JavaTest.java src/main/java/JavaTest.java
|
||||
> publish
|
||||
|
||||
> set project.name use-plugin-test
|
||||
|
|
|
|||
Loading…
Reference in New Issue