Skip to content

Add updateCommunityBuild command #5949

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

Merged
merged 1 commit into from
Feb 25, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import java.io.{PrintWriter, File}
import java.nio.charset.StandardCharsets.UTF_8
import org.junit.{Ignore, Test}
import org.junit.Assert.{assertEquals, fail}
import org.junit.experimental.categories.Category

@Category(Array(classOf[TestCategory]))
class CommunityBuildTest {
lazy val communitybuildDir: Path = Paths.get(sys.props("user.dir") + "/community-build/")

Expand All @@ -19,10 +21,11 @@ class CommunityBuildTest {
* This test reads the compiler version from community-build/dotty-bootstrapped.version
* and expects community-build/sbt-dotty-sbt to set the compiler plugin.
*
* @param project The project name, should be a git submodule in community-build/
* @param command The sbt command used to build the project
* @param project The project name, should be a git submodule in community-build/
* @param command The sbt command used to test the project
* @param updateCommand The sbt command used to update the project
*/
def test(project: String, command: String): Unit = {
def test(project: String, testCommand: String, updateCommand: String): Unit = {
def log(msg: String) = println(Console.GREEN + msg + Console.RESET)

log(s"Building $project with dotty-bootstrapped $compilerVersion...")
Expand Down Expand Up @@ -57,7 +60,7 @@ class CommunityBuildTest {
val arguments = Seq(
"-sbt-version", "1.2.7",
s"--addPluginSbtFile=$pluginFilePath",
s";clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! $command"
s";clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! $testCommand"
)

val exitCode = exec("sbt", arguments: _*)
Expand All @@ -80,69 +83,91 @@ class CommunityBuildTest {
}

@Test def algebra = test(
project = "algebra",
command = "coreJVM/compile"
project = "algebra",
testCommand = "coreJVM/compile",
updateCommand = "coreJVM/update"
)

@Test def scalacheck = test(
project = "scalacheck",
command = "jvm/test:compile"
project = "scalacheck",
testCommand = "jvm/test:compile",
updateCommand = "jvm/test:update"
)

@Test def scalatest = test(
project = "scalatest",
command = "scalatest/compile"
project = "scalatest",
testCommand = "scalatest/compile",
updateCommand = "scalatest/update"
)

@Test def scopt = test(
project = "scopt",
command = "scoptJVM/compile"
project = "scopt",
testCommand = "scoptJVM/compile",
updateCommand = "scoptJVM/update"
)

@Test def scalap = test(
project = "scalap",
command = "scalap/compile"
project = "scalap",
testCommand = "scalap/compile",
updateCommand = "scalap/update"
)

@Test def squants = test(
project = "squants",
command = "squantsJVM/compile"
project = "squants",
testCommand = "squantsJVM/compile",
updateCommand = "squantsJVM/update"
)

@Test def betterfiles = test(
project = "betterfiles",
command = "dotty-community-build/compile"
project = "betterfiles",
testCommand = "dotty-community-build/compile",
updateCommand = "dotty-community-build/update"
)

@Test def ScalaPB = test(
project = "ScalaPB",
command = "dotty-community-build/compile"
project = "ScalaPB",
testCommand = "dotty-community-build/compile",
updateCommand = "dotty-community-build/update"
)

@Test def minitest = test(
project = "minitest",
command = "dotty-community-build/compile"
project = "minitest",
testCommand = "dotty-community-build/compile",
updateCommand = "dotty-community-build/update"
)

@Test def fastparse = test(
project = "fastparse",
command = "fastparseJVM/compile"
project = "fastparse",
testCommand = "fastparseJVM/compile",
updateCommand = "fastparseJVM/update"
)

// TODO: revert to sourcecodeJVM/test
@Test def sourcecode = test(
project = "sourcecode",
command = "sourcecodeJVM/compile"
project = "sourcecode",
testCommand = "sourcecodeJVM/compile",
updateCommand = "sourcecodeJVM/update"
)

@Test def stdLib213 = test(
project = "stdLib213",
command = "library/compile"
project = "stdLib213",
testCommand = "library/compile",
updateCommand = "library/update"
)

// TODO @oderky? It got broken by #5458
// @Test def pdbp = test(
// project = "pdbp",
// command = "compile"
// project = "pdbp",
// testCommand = "compile",
// updateCommand = "update"
// )
}

class TestCategory
class UpdateCategory

@Category(Array(classOf[UpdateCategory]))
class CommunityBuildUpdate extends CommunityBuildTest {
override def test(project: String, testCommand: String, updateCommand: String): Unit =
super.test(project, updateCommand, null)
}
8 changes: 8 additions & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,8 @@ object Build {

val prepareCommunityBuild = taskKey[Unit]("Publish local the compiler and the sbt plugin. Also store the versions of the published local artefacts in two files, community-build/{dotty-bootstrapped.version,sbt-dotty-sbt}.")

val updateCommunityBuild = taskKey[Unit]("Updates the community build.")

lazy val `community-build` = project.in(file("community-build")).
settings(commonNonBootstrappedSettings).
settings(
Expand All @@ -920,6 +922,12 @@ object Build {
IO.write(baseDirectory.value / "sbt-dotty-sbt", pluginText)
IO.write(baseDirectory.value / "dotty-bootstrapped.version", dottyVersion)
},
updateCommunityBuild := testOnly.in(Test).toTask(
" dotty.communitybuild.CommunityBuildUpdate -- --include-categories=dotty.communitybuild.UpdateCategory").value,
testOptions in Test += Tests.Argument(
TestFrameworks.JUnit,
"--include-categories=dotty.communitybuild.TestCategory",
),
(Test / testOnly) := ((Test / testOnly) dependsOn prepareCommunityBuild).evaluated,
(Test / test ) := ((Test / test ) dependsOn prepareCommunityBuild).value
)
Expand Down