Comments (5)
I may have found a workaround:
lazy val sbtProject = (project in file("sbt"))
.dependsOn(core)
.enablePlugins(SbtPlugin)
.settings(commonProjectSettings)
.settings(
skip := {
CrossVersion.partialVersion((core / scalaVersion).value) match {
case Some((2, n)) if n == 13 => true
case _ => false
}
},
crossScalaVersions := Nil,
)
from sbt-github-actions.
Well that didn't work.
Latest iteration is:
import explicitdeps.ExplicitDepsPlugin
import explicitdeps.ExplicitDepsPlugin.autoImport._
import sbt.Keys._
import sbt._
import sbt.plugins.SbtPlugin
// This is all the crazy hacks to get cross compiling working with an sub-project that is an sbt plugin.
object SbtSubProjectPluginPlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
override def requires: Plugins = ExplicitDepsPlugin && SbtPlugin
private val sspppIsScala213 = settingKey[Boolean]("Checks if the current Scala version is 2.13")
override def projectSettings: Seq[Def.Setting[_]] =
List(
crossScalaVersions := Nil,
libraryDependencies := libraryDependenciesSetting.value,
projectDependencies := projectDependenciesTask.value,
sspppIsScala213 := {
if (isScala213(scalaVersion.value))
throw new IllegalStateException("sbt project must not use Scala 2.13. Did you force the version with '+'?")
isScala213Setting.value
},
// We can't skip this as it has to run at least once or sbt complains.
update / skip := false,
// Skip everything else otherwise it will just fail.
skip := sspppIsScala213.value,
undeclaredCompileDependenciesFilter -= moduleFilter()
)
private def isScala213Setting = Def.setting {
val versions =
scalaVersion.all(ScopeFilter(inDependencies(ThisProject, transitive = true, includeRoot = false))).value
versions.exists(isScala213)
}
private def isScala213(version: String) =
CrossVersion.partialVersion(version) match {
case Some((2, n)) if n == 13 => true
case _ => false
}
private def projectDependenciesTask = Def.task {
// Remove all project dependencies for Scala 2.13 as they will not resolve when cross building.
if (sspppIsScala213.value) {
Seq.empty
} else {
projectDependencies.value
}
}
private def libraryDependenciesSetting = Def.setting {
// Remove all library dependencies for Scala 2.13 as they will not resolve when cross building.
if (sspppIsScala213.value) {
Seq.empty
} else {
libraryDependencies.value
}
}
}
from sbt-github-actions.
@steinybot just out of curiosity, what would happen if you set crossScalaVersions
in ThisBuild
to the whole set of versions, but with specific overrides in each project?
from sbt-github-actions.
That doesn't seem to make a difference. For the record the problem I have actually has nothing to do with sbt-github-actions instead it is sbt/sbt#5586.
from sbt-github-actions.
Yeah this is a serious limitation of sbt right now. There are a lot of crazy hacks to get around it but none of them work well. It's also something that you somewhat-forcibly hit whenever you have Scala Native in your build.
from sbt-github-actions.
Related Issues (20)
- Prepare sbt-github-actions for release under sbt org HOT 13
- "Integration with sbt-ci-release" generates cross build HOT 3
- Remove sbt's strict JDK 1.8 check or publish using JDK 1.8?
- Add scalafmt code formatter HOT 2
- Pull request can trigger two workflow runs HOT 4
- Put sbt-github-actions into the `sbt` package HOT 1
- Use `SizeParser` to correctly parse and validate `windows.PageFileFix` fields
- Provide an interface to job level settings
- Please make a release! HOT 5
- Supporing JDK 20 with GraalVM >22 HOT 2
- Use Scala major versions rather than patch for generated actions HOT 1
- clean.yml doesn't respect githubWorkflowOSes HOT 11
- exposing base directory for monorepo support HOT 11
- Transfer copyright ownership from Daniel Spiewak to Scala Center? HOT 2
- Support Corretto JVM HOT 1
- upload-artifact/v4 not supported on GHES HOT 2
- Support `working-directory` in steps
- Problems with sbt-projectmatrix - upload artifact should be more granular
- Feature request: Add support for automatically labelling PRs by Github Actions
- macos-latest no longer has `sbt` installed by default HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt-github-actions.