Skip to content

Commit

Permalink
Remove use of external plugins for bootstrap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Jan 21, 2023
1 parent a3a74a8 commit 72e8751
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions ci/mill-bootstrap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
diff --git a/build.sc b/build.sc
index be462bb7c..50eb14412 100644
--- a/build.sc
+++ b/build.sc
@@ -2,22 +2,10 @@
import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
-import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.10:0.3.0`
-import $ivy.`com.github.lolgab::mill-mima_mill0.10:0.0.13`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.25`

// imports
-import com.github.lolgab.mill.mima
-import com.github.lolgab.mill.mima.{
- CheckDirection,
- DirectMissingMethodProblem,
- IncompatibleMethTypeProblem,
- IncompatibleSignatureProblem,
- ProblemFilter,
- ReversedMissingMethodProblem
-}
import coursier.maven.MavenRepository
-import de.tobiasroeser.mill.vcs.version.VcsVersion
import mill._
import mill.define.{Command, Source, Sources, Target, Task}
import mill.eval.Evaluator
@@ -180,12 +168,8 @@ object Deps {
val requests = ivy"com.lihaoyi::requests:0.8.0"
}

-def millVersion: T[String] = T { VcsVersion.vcsState().format() }
-def millLastTag: T[String] = T {
- VcsVersion.vcsState().lastTag.getOrElse(
- sys.error("No (last) git tag found. Your git history seems incomplete!")
- )
-}
+def millVersion: T[String] = T { "0.0.0.test" }
+def millLastTag: T[String] = T { "0.0.0.test" }
def millBinPlatform: T[String] = T {
val tag = millLastTag()
if (tag.contains("-M")) tag
@@ -244,20 +228,7 @@ trait MillCoursierModule extends CoursierModule {
)
}

-trait MillMimaConfig extends mima.Mima {
- override def mimaPreviousVersions: T[Seq[String]] = Settings.mimaBaseVersions
- override def mimaPreviousArtifacts =
- if (Settings.mimaBaseVersions.isEmpty) T { Agg[Dep]() }
- else super.mimaPreviousArtifacts
- override def mimaExcludeAnnotations: T[Seq[String]] = Seq(
- "mill.api.internal",
- "mill.api.experimental"
- )
- override def mimaCheckDirection: Target[CheckDirection] = T { CheckDirection.Backward }
- override def mimaBinaryIssueFilters: Target[Seq[ProblemFilter]] = T {
- issueFilterByModule.getOrElse(this, Seq())
- }
- lazy val issueFilterByModule: Map[MillMimaConfig, Seq[ProblemFilter]] = Map()
+trait MillMimaConfig extends Module {
}

/** A Module compiled with applied Mill-specific compiler plugins: mill-moduledefs. */
@@ -1549,53 +1520,7 @@ def launcher = T {
}

def uploadToGithub(authKey: String) = T.command {
- val vcsState = VcsVersion.vcsState()
- val label = vcsState.format()
- if (label != millVersion()) sys.error("Modified mill version detected, aborting upload")
- val releaseTag = vcsState.lastTag.getOrElse(sys.error(
- "Incomplete git history. No tag found.\nIf on CI, make sure your git checkout job includes enough history."
- ))
-
- if (releaseTag == label) {
- // TODO: check if the tag already exists (e.g. because we created it manually) and do not fail
- scalaj.http.Http(
- s"https://api.github.com/repos/${Settings.githubOrg}/${Settings.githubRepo}/releases"
- )
- .postData(
- ujson.write(
- ujson.Obj(
- "tag_name" -> releaseTag,
- "name" -> releaseTag
- )
- )
- )
- .header("Authorization", "token " + authKey)
- .asString
- }
-
- val exampleZips = Seq("example-1", "example-2", "example-3")
- .map { example =>
- os.copy(T.workspace / "example" / example, T.dest / example)
- os.copy(launcher().path, T.dest / example / "mill")
- os.proc("zip", "-r", T.dest / s"$example.zip", example).call(cwd = T.dest)
- (T.dest / s"$example.zip", label + "-" + example + ".zip")
- }
-
- val zips = exampleZips ++ Seq(
- (assembly().path, label + "-assembly"),
- (launcher().path, label)
- )
-
- for ((zip, name) <- zips) {
- upload.apply(
- zip,
- releaseTag,
- name,
- authKey,
- Settings.githubOrg,
- Settings.githubRepo
- )
- }
+ // never upload a bootstrapped version
}

def validate(ev: Evaluator): Command[Unit] = T.command {

0 comments on commit 72e8751

Please sign in to comment.