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

Tries to fix scripted tests isolating them #223

Closed
wants to merge 4 commits into from
Closed
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
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: scala

jdk:
- oraclejdk8

matrix:
include:
- scala: 2.12.3
jdk: oraclejdk8
env:
- SBT_VERSION=1.0.1
# TODO test sbt 0.13.16/(2.12.3) vs 0.13.16(2.10.6) in matrix
- scala: 2.12.3
jdk: oraclejdk8
- scala: 2.10.6
env:
- SBT_VERSION=0.13.16

Expand All @@ -25,10 +25,9 @@ install:
- gem install jekyll -v 3.2.1

script:
- sbt ^^$SBT_VERSION clean compile test
- if [ "$TRAVIS_BRANCH" = "master" ]; then
sbt ^^$SBT_VERSION scripted;
fi
- sbt ++$TRAVIS_SCALA_VERSION ^^$SBT_VERSION clean compile test
- sbt ++$TRAVIS_SCALA_VERSION ^^$SBT_VERSION publishLocal;
- sbt ++$TRAVIS_SCALA_VERSION ^^$SBT_VERSION tests/scripted;

after_success:
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
Expand Down
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ pgpSecretRing := file(s"$gpgFolder/secring.gpg")
lazy val `sbt-microsites` = (project in file("."))
.settings(moduleName := "sbt-microsites")
.settings(pluginSettings: _*)
.settings(testScriptedSettings: _*)
.enablePlugins(JekyllPlugin)

lazy val tests = (project in file("tests"))
.settings(moduleName := "sbt-tests")

lazy val docs = (project in file("docs"))
.settings(moduleName := "docs")
// .settings(micrositeSettings: _*)
Expand Down
23 changes: 5 additions & 18 deletions project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import com.typesafe.sbt.site.SitePlugin.autoImport._
// import microsites.MicrositeKeys._
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt.ScriptedPlugin.autoImport._
import sbt._
import sbtbuildinfo.BuildInfoPlugin.autoImport._
import sbtorgpolicies.model.{sbtV, scalac}
Expand All @@ -25,8 +24,6 @@ object ProjectPlugin extends AutoPlugin {
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
"jgit-repo" at "http://download.eclipse.org/jgit/maven"),
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2"),
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.0"),
libraryDependencies ++= Seq(
"com.47deg" %% "org-policies-core" % "0.6.2",
%%("moultingyaml"),
Expand All @@ -47,6 +44,10 @@ object ProjectPlugin extends AutoPlugin {
}

Seq(
Defaults.sbtPluginExtra(
"com.47deg" % "sbt-org-policies" % "0.6.2",
sbtBinaryVersionValue,
scalaBinaryVersionValue),
Defaults.sbtPluginExtra(
"org.tpolecat" % "tut-plugin" % tutPluginVersion,
sbtBinaryVersionValue,
Expand All @@ -56,20 +57,6 @@ object ProjectPlugin extends AutoPlugin {
}
)

lazy val testScriptedSettings: Seq[(Def.Setting[_])] =
Seq(
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq(
"-Xmx2048M",
"-XX:ReservedCodeCacheSize=256m",
"-XX:+UseConcMarkSweepGC",
"-Dplugin.version=" + version.value,
"-Dscala.version=" + scalaVersion.value
)
}
)

lazy val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "microsites"
Expand Down Expand Up @@ -134,7 +121,7 @@ object ProjectPlugin extends AutoPlugin {
(compile in Compile).asRunnableItemFull,
(test in Test).asRunnableItemFull,
(publishLocal in Global).asRunnableItemFull,
"scripted".asRunnableItemFull,
"tests/scripted".asRunnableItemFull,
(jsFullOptGenerateTask in ProjectRef(file("."), "kazari")).asRunnableItem,
"docs/tut".asRunnableItem
)
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 = 1.0.1
sbt.version = 0.13.16
9 changes: 1 addition & 8 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.6.2")

libraryDependencies += {
lazy val sbtVersionValue = (sbtVersion in pluginCrossBuild).value

scalaVersion.value match {
case "2.10.6" => "org.scala-sbt" % "scripted-plugin" % sbtVersionValue
case _ => "org.scala-sbt" %% "scripted-plugin" % sbtVersionValue
}
}
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
2 changes: 0 additions & 2 deletions src/sbt-test/microsites/basic/build.sbt

This file was deleted.

16 changes: 0 additions & 16 deletions src/sbt-test/microsites/change-default-paths/build.sbt

This file was deleted.

23 changes: 0 additions & 23 deletions src/sbt-test/microsites/microsites-config-keys/test

This file was deleted.

2 changes: 0 additions & 2 deletions src/sbt-test/microsites/microsites-tasks/build.sbt

This file was deleted.

27 changes: 0 additions & 27 deletions src/sbt-test/microsites/microsites-tasks/test

This file was deleted.

11 changes: 0 additions & 11 deletions src/sbt-test/microsites/scala-2-12/build.sbt

This file was deleted.

11 changes: 0 additions & 11 deletions src/sbt-test/microsites/tut-compile/build.sbt

This file was deleted.

13 changes: 13 additions & 0 deletions tests/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
scalaVersion := "2.10.6"

scriptedSettings

scriptedDependencies := (scriptedDependencies dependsOn (compile in Test)).value

scriptedLaunchOpts ++= Seq(
"-Xmx2048M",
"-XX:ReservedCodeCacheSize=256m",
"-XX:+UseConcMarkSweepGC",
"-Dplugin.version=" + version.value,
"-Dscala.version=" + scalaVersion.value
)
12 changes: 12 additions & 0 deletions tests/src/sbt-test/microsites/basic/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
enablePlugins(MicrositesPlugin)

scalaVersion := sys.props("scala.version")

lazy val check = TaskKey[Unit]("check")

check := {
val checkPathFile: File = file((crossTarget in Compile).value.getAbsolutePath + "/resource_managed/main/jekyll")

if(!checkPathFile.exists())
sys.error("Jekyll directory doesn't exist.")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# check that the sbt-microsites plugin works on a minimal project

> makeMicrosite

$ exists target/scala-2.11/resource_managed/main/jekyll
> check
38 changes: 38 additions & 0 deletions tests/src/sbt-test/microsites/change-default-paths/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import microsites._

enablePlugins(MicrositesPlugin)

scalaVersion := sys.props("scala.version")

micrositeExtraMdFiles := Map(
file("README.md") -> ExtraMdFileConfig(
"index.md",
"home"
)
)

micrositeExtraMdFilesOutput := (target in Compile).value / "extra_md_override"

micrositeImgDirectory := (resourceDirectory in Compile).value / "images"
micrositeCssDirectory := (resourceDirectory in Compile).value / "styles"

lazy val check = TaskKey[Unit]("check")

check := {
val baseTargetPath = (crossTarget in Compile).value.getAbsolutePath + "/resource_managed/main/jekyll/"

// check images and styles at resource_managed folder

if(!file(baseTargetPath + "img/scala.png").exists())
sys.error("scala.png doesn't exist.")

if(!file(baseTargetPath + "img/sbt.png").exists())
sys.error("sbt.png doesn't exist.")

if(!file(baseTargetPath + "css/override-1.css").exists())
sys.error("override-1.css doesn't exist.")

if(!file(baseTargetPath + "css/override-2.css").exists())
sys.error("override-2.css doesn't exist.")

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# check that the sbt-microsites plugin work well changing the default paths

> makeMicrosite

# check images and styles at resource_managed folder

$ exists target/scala-2.11/resource_managed/main/jekyll/img/scala.png
$ exists target/scala-2.11/resource_managed/main/jekyll/img/sbt.png
$ exists target/scala-2.11/resource_managed/main/jekyll/css/override-1.css
$ exists target/scala-2.11/resource_managed/main/jekyll/css/override-2.css
> check

# check images and css at site folder

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import microsites._

enablePlugins(MicrositesPlugin)
scalaVersion := "2.11.8"

scalaVersion := sys.props("scala.version")

micrositeGitHostingService := GitLab
micrositeGitHostingUrl := "https://gitlab.com/gitlab-org/gitlab-ce"
Expand All @@ -19,6 +20,11 @@ def getLines(fileName: String) =
lazy val check = TaskKey[Unit]("check")

check := {
val checkPathFile: File = file((crossTarget in Compile).value.getAbsolutePath + "/resource_managed/main/jekyll")

if(!checkPathFile.exists())
sys.error("Jekyll directory doesn't exist.")

val content = getLines("target/site/index.html").mkString

if (!content.contains("View on GitLab"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# check that the sbt-microsites plugin works customizing which git hosting is used from sbt

> makeMicrosite

$ exists target/scala-2.11/resource_managed/main/jekyll

# check the index.html file

> check
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import microsites._

enablePlugins(MicrositesPlugin)
scalaVersion := "2.12.1"

scalaVersion := sys.props("scala.version")

micrositeConfigYaml := ConfigYml(
yamlCustomProperties = Map("org" -> "Test"),
Expand All @@ -17,6 +18,11 @@ def getLines(fileName: String) =
lazy val check = TaskKey[Unit]("check")

check := {
val checkPathFile: File = file((crossTarget in Compile).value.getAbsolutePath + "/resource_managed/main/jekyll")

if(!checkPathFile.exists())
sys.error("Jekyll directory doesn't exist.")

val content = getLines("target/site/_config.yml").mkString

if (!content.contains("org: Test"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# check that the sbt-microsites plugin works customizing the _config.yml file from sbt

> makeMicrosite

$ exists target/scala-2.12/resource_managed/main/jekyll

# check the _config.yml file

> check
Loading