Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugin to sbt 1.0.2 #9

Merged
merged 15 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scala:
- 2.11.11

script:
- sbt clean scripted headerCheck
- sbt clean scripted scalafmt headerCheck
- "git diff --exit-code || (echo ERROR: Git changes detected, please regenerate the readme and run scalafmt with: sbt headerCreate scalafmt && exit 1)"
#after_success:
# - sbt coveralls
Expand Down
19 changes: 9 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ publishMavenStyle := true

sbtPlugin := true

scalaVersion := "2.10.6"
scalaVersion := "2.12.3"

resolvers += Resolver.sonatypeRepo("snapshots")

Expand All @@ -34,7 +34,6 @@ publishTo := {
Some(Opts.resolver.sonatypeStaging)
}

ScriptedPlugin.scriptedSettings
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M",
"-Dplugin.version=" + version.value)
Expand Down Expand Up @@ -72,32 +71,32 @@ libraryDependencies ++= Seq(
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"org.planet42" % "laika-sbt" % "0.7.0",
"org.planet42" % "laika-sbt" % "0.7.5",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"com.eed3si9n" % "sbt-assembly" % "0.14.5",
"com.eed3si9n" % "sbt-assembly" % "0.14.6",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"com.jsuereth" % "sbt-pgp" % "1.0.0",
"com.jsuereth" % "sbt-pgp" % "1.1.0",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"org.xerial.sbt" % "sbt-sonatype" % "1.1",
"org.xerial.sbt" % "sbt-sonatype" % "2.0",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"com.typesafe.sbt" % "sbt-site" % "1.3.1",
"com.typesafe.sbt" % "sbt-site" % "1.3.2",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"com.github.gseitz" % "sbt-release" % "1.0.6",
"com.github.gseitz" % "sbt-release" % "1.0.7",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Expand All @@ -112,12 +111,12 @@ libraryDependencies ++= Seq(
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"de.heikoseeberger" % "sbt-header" % "4.0.0",
"de.heikoseeberger" % "sbt-header" % "4.1.0",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
),
Defaults.sbtPluginExtra(
"com.lucidchart" % "sbt-scalafmt" % "1.10",
"com.lucidchart" % "sbt-scalafmt" % "1.15",
(sbtBinaryVersion in pluginCrossBuild).value,
(scalaBinaryVersion in pluginCrossBuild).value
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.16
sbt.version=1.0.2
15 changes: 6 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.10")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
addSbtPlugin("org.planet42" % "laika-sbt" % "0.7.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "4.0.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "4.1.0")
2 changes: 1 addition & 1 deletion project/scripted.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libraryDependencies += { "org.scala-sbt" % "scripted-plugin" % sbtVersion.value }
libraryDependencies += { "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value }
103 changes: 64 additions & 39 deletions src/main/scala/nl/biopet/sbtbiopet/BiopetPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import com.typesafe.sbt.site.laika.LaikaSitePlugin
import com.typesafe.sbt.site.laika.LaikaSitePlugin.autoImport.LaikaSite
import com.typesafe.sbt.site.{SitePlugin, SiteScaladocPlugin}
import de.heikoseeberger.sbtheader.HeaderPlugin
import laika.sbt.LaikaSbtPlugin.LaikaKeys.{Laika, rawContent}
import laika.sbt.LaikaPlugin.autoImport.{Laika, laikaRawContent}
import org.scoverage.coveralls.CoverallsPlugin
import sbt.Keys._
import sbt.{Def, _}
Expand Down Expand Up @@ -188,7 +188,7 @@ object BiopetPlugin extends AutoPlugin {
siteSubdirName in SiteScaladoc := {
if (isSnapshot.value) { "develop/api" } else s"${version.value}/api"
},
rawContent in Laika := true, //Laika use raw HTML content in markdown.
laikaRawContent in Laika := true, //Laika use raw HTML content in markdown.
includeFilter in ghpagesCleanSite := biopetCleanSiteFilter.value,
biopetGenerateDocs := biopetGenerateDocsFunction().value,
biopetGenerateReadme := biopetGenerateReadmeFunction().value,
Expand All @@ -201,16 +201,16 @@ object BiopetPlugin extends AutoPlugin {
* The merge strategy that is used in biopet projects
*/
protected def biopetMergeStrategy: String => MergeStrategy = {
case PathList(ps @ _ *) if ps.last endsWith "pom.properties" =>
case PathList(ps @ _*) if ps.last endsWith "pom.properties" =>
MergeStrategy.first
case PathList(ps @ _ *) if ps.last endsWith "pom.xml" =>
case PathList(ps @ _*) if ps.last endsWith "pom.xml" =>
MergeStrategy.first
case x if Assembly.isConfigFile(x) =>
MergeStrategy.concat
case PathList(ps @ _ *)
case PathList(ps @ _*)
if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) =>
MergeStrategy.rename
case PathList("META-INF", xs @ _ *) =>
case PathList("META-INF", xs @ _*) =>
xs map {
_.toLowerCase
} match {
Expand Down Expand Up @@ -284,8 +284,7 @@ object BiopetPlugin extends AutoPlugin {
f.getPath.contains("develop")
} else {
f.getPath.contains(s"${version.value}") ||
f.getPath == new java.io.File(ghpagesRepository.value,
"index.html").getPath
f.getPath == new java.io.File(ghpagesRepository.value, "index.html").getPath
}
}
}
Expand All @@ -295,45 +294,71 @@ object BiopetPlugin extends AutoPlugin {
* Accesses the tools main method to generate documentation using our custom built-in documentation function
*/
protected def biopetGenerateDocsFunction(): Def.Initialize[Task[Unit]] =
Def.task[Unit] {
Def.taskDyn {
if (biopetIsTool.value) {
import Attributed.data
val r = (runner in Compile).value
val args = Seq("--generateDocs",
s"outputDir=${biopetDocsDir.value.toString}," +
s"version=${version.value}," +
s"release=${!isSnapshot.value}",
version.value)
val classPath = (fullClasspath in Compile).value
r.run(
s"${(mainClass in assembly).value.get}",
data(classPath),
args,
streams.value.log
)
.foreach(sys.error)
}
Def
.task[Unit] {
val r = (runner in Compile).value
val classPath = (fullClasspath in Runtime).value

val streamsLogValue = streams.value.log

val args = Seq("--generateDocs",
s"outputDir=${biopetDocsDir.value.toString}," +
s"version=${version.value}," +
s"release=${!isSnapshot.value}",
version.value)

val mainClassString = (mainClass in assembly).value match {
case Some(x) => x
case _ =>
throw new IllegalStateException(
"Mainclass should be defined for a tool.")
}
import Attributed.data
r.run(
mainClassString,
data(classPath),
args,
streamsLogValue
)

}
.dependsOn(compile in Compile)
} else Def.task[Unit] {}
}

/*
* Accesses the tools main method to generate a README using our custom built-in documentation function
*/
protected def biopetGenerateReadmeFunction(): Def.Initialize[Task[Unit]] =
Def
.task[Unit] {
if (biopetIsTool.value) {
import sbt.Attributed.data
val r: ScalaRun = (runner in Compile).value
val args = Seq("--generateReadme", biopetReadmePath.value.toString)
val classPath = (fullClasspath in Compile).value
r.run(
s"${(mainClass in assembly).value.get}",
Def.taskDyn {
if (biopetIsTool.value) {
Def
.task[Unit] {
val r = (runner in Compile).value
val classPath = (fullClasspath in Runtime).value

val args = Seq("--generateReadme", biopetReadmePath.value.toString)

val streamsLogValue = streams.value.log

val mainClassString = (mainClass in assembly).value match {
case Some(x) => x
case _ =>
throw new IllegalStateException(
"Mainclass should be defined for a tool.")
}
import Attributed.data
r.run(
mainClassString,
data(classPath),
args,
streams.value.log
streamsLogValue
)
.foreach(sys.error)
}
}
.dependsOn(compile in Compile)

}
.dependsOn(compile in Compile)
} else Def.task[Unit] {}
}
}

This file was deleted.

4 changes: 1 addition & 3 deletions src/sbt-test/sbtbiopet/developtool/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
sys.props.get("plugin.version") match {
case Some(x) => addSbtPlugin("com.github.biopet" % "sbt-biopet" % x)
case _ => addSbtPlugin("com.github.biopet" % "sbt-biopet" % "0.2-SNAPSHOT")
/* case _ => sys.error("""|The system property 'plugin.version' is not defined.
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
*/
}