Skip to content

Commit

Permalink
Tweak BOM tests (#4152)
Browse files Browse the repository at this point in the history
This adds comments in some BOM test definitions, and adjusts the base
module of some test modules.

Pull request: #4152
  • Loading branch information
alexarchambault authored Jan 8, 2025
1 parent c9e0b69 commit c4190e7
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions scalalib/test/src/mill/scalalib/BomTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ object BomTests extends TestSuite {
object modules extends TestBaseModule {
object bom extends Module {
object placeholder extends JavaModule with TestPublishModule {
// Empty version in ivyDeps should be filled with BOM
def bomIvyDeps = Agg(
ivy"com.google.cloud:libraries-bom:26.50.0"
)
Expand All @@ -32,25 +33,30 @@ object BomTests extends TestSuite {
)

object dependee extends JavaModule with TestPublishModule {
// BOM details should be passed to dependees
def moduleDeps = Seq(
placeholder
)
}

object subDependee extends JavaModule with TestPublishModule {
// BOM details should be passed to dependees
def moduleDeps = Seq(
dependee
)
}

object check extends JavaModule {
// Empty version with no BOM - should fail
def ivyDeps = Agg(
ivy"com.google.protobuf:protobuf-java"
)
}
}

object versionOverride extends JavaModule with TestPublishModule {
// protobuf-java is a dependency of scalapbc
// The BOM overrides its version
def bomIvyDeps = Agg(
ivy"com.google.cloud:libraries-bom:26.50.0"
)
Expand All @@ -59,26 +65,30 @@ object BomTests extends TestSuite {
)

object dependee extends JavaModule with TestPublishModule {
// BOM stuff should be passed transitively to dependee modules
def moduleDeps = Seq(
versionOverride
)
}

object subDependee extends JavaModule with TestPublishModule {
// BOM stuff should be passed transitively to dependee modules
def moduleDeps = Seq(
dependee
)
}

object check extends JavaModule {
// No BOM - checking that the protobuf version is different than the one with the BOM
def ivyDeps = Agg(
ivy"com.thesamet.scalapb:scalapbc_2.13:0.9.8"
)
}
}

object invalid extends TestBaseModule {
object invalid extends Module {
object exclude extends JavaModule {
// excludes aren't accepted alongside BOM coordinates
def bomIvyDeps = Agg(
ivy"com.google.cloud:libraries-bom:26.50.0".exclude(("foo", "thing"))
)
Expand All @@ -87,6 +97,8 @@ object BomTests extends TestSuite {
}

object depMgmt extends JavaModule with TestPublishModule {
// scalapbc depends on protobuf-java
// depManagement should override protobuf-java version
def ivyDeps = Agg(
ivy"com.thesamet.scalapb:scalapbc_2.13:0.9.8"
)
Expand All @@ -95,10 +107,13 @@ object BomTests extends TestSuite {
)

object transitive extends JavaModule with TestPublishModule {
// depManagement stuff should be passed transitively to dependees
def moduleDeps = Seq(depMgmt)
}

object extraExclude extends JavaModule with TestPublishModule {
// Adding an exclude to an ivyDep from depManagement, while
// the version in ivyDep is preserved
def ivyDeps = Agg(
ivy"com.lihaoyi:cask_2.13:0.9.4"
)
Expand All @@ -111,11 +126,14 @@ object BomTests extends TestSuite {
)

object transitive extends JavaModule with TestPublishModule {
// depManagement stuff should be passed transitively to dependees
def moduleDeps = Seq(extraExclude)
}
}

object exclude extends JavaModule with TestPublishModule {
// Adding an exclude to and overriding the version of a transitive dependency
// from depManagement
def ivyDeps = Agg(
ivy"com.lihaoyi:cask_2.13:0.9.4"
)
Expand All @@ -125,6 +143,7 @@ object BomTests extends TestSuite {
)

object transitive extends JavaModule with TestPublishModule {
// depManagement stuff should be passed transitively to dependees
def moduleDeps = Seq(exclude)
}
}
Expand All @@ -143,7 +162,7 @@ object BomTests extends TestSuite {
}
}

object invalid extends TestBaseModule {
object invalid extends Module {
object transitive extends JavaModule {
def depManagement = {
val dep = ivy"org.java-websocket:Java-WebSocket:1.5.3"
Expand Down

0 comments on commit c4190e7

Please sign in to comment.