summaryrefslogtreecommitdiff
path: root/integration/test/src/mill/integration/IntegrationTestSuite.scala
blob: d24261f37ba9bdfe28cae89af1c9522ad1a35f5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package mill.integration

import ammonite.ops._
import mill.util.ScriptTestSuite
import utest._

abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String, fork: Boolean)
  extends ScriptTestSuite(fork){
  val buildFilePath = pwd / 'integration / 'test / 'resources / workspaceSlug
  def scriptSourcePath = {
    // The unzipped git repo snapshots we get from github come with a
    // wrapper-folder inside the zip file, so copy the wrapper folder to the
    // destination instead of the folder containing the wrapper.

    val path = sys.props(repoKey)
    val Seq(wrapper) = ls(Path(path))
    wrapper
  }

  def buildFiles: Seq[Path] = {
    Seq(buildFilePath / "build.sc")
  }

  override def initWorkspace() = {
    super.initWorkspace()
    buildFiles.foreach { file =>
      cp.over(file, workspacePath / file.name)
    }
    assert(!ls.rec(workspacePath).exists(_.ext == "class"))
  }
}