From 7f1b6186ce53a8ebb1df0655745dde5aa9686184 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Fri, 6 Dec 2024 19:03:08 -0800 Subject: [PATCH] Rename JavaModule#bomDeps to bomIvyDeps (#4081) --- .../library-deps/bom-1-external-bom/build.mill | 8 ++++---- scalalib/src/mill/scalalib/JavaModule.scala | 10 +++++----- scalalib/src/mill/scalalib/PublishModule.scala | 2 +- scalalib/test/src/mill/scalalib/BomTests.scala | 18 +++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/example/fundamentals/library-deps/bom-1-external-bom/build.mill b/example/fundamentals/library-deps/bom-1-external-bom/build.mill index 4b076da2999..345a6159c1f 100644 --- a/example/fundamentals/library-deps/bom-1-external-bom/build.mill +++ b/example/fundamentals/library-deps/bom-1-external-bom/build.mill @@ -1,11 +1,11 @@ -// Pass an external BOM to a `JavaModule` / `ScalaModule` / `KotlinModule` with `bomDeps`, like +// Pass an external BOM to a `JavaModule` / `ScalaModule` / `KotlinModule` with `bomIvyDeps`, like //// SNIPPET:BUILD1 package build import mill._, javalib._ object foo extends JavaModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.cloud:libraries-bom:26.50.0" ) def ivyDeps = Agg( @@ -20,6 +20,6 @@ object foo extends JavaModule { // But the BOM specifies another version for that dependency, `4.28.3`, so // protobuf-java `4.28.3` ends up being pulled here. // -// Several BOMs can be passed to `bomDeps`. If several specify a version for a dependency, -// the version from the first one in the `bomDeps` list is used. If several specify exclusions +// Several BOMs can be passed to `bomIvyDeps`. If several specify a version for a dependency, +// the version from the first one in the `bomIvyDeps` list is used. If several specify exclusions // for a dependency, all exclusions are added to that dependency. diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index 26fcfcddff1..9c0f144e941 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -163,11 +163,11 @@ trait JavaModule * Any BOM dependencies you want to add to this Module, in the format * ivy"org:name:version" */ - def bomDeps: T[Agg[Dep]] = Task { Agg.empty[Dep] } + def bomIvyDeps: T[Agg[Dep]] = Task { Agg.empty[Dep] } def allBomDeps: Task[Agg[BomDependency]] = Task.Anon { val modVerOrMalformed = - bomDeps().map(bindDependency()).map { bomDep => + bomIvyDeps().map(bindDependency()).map { bomDep => val fromModVer = coursier.core.Dependency(bomDep.dep.module, bomDep.dep.version) if (fromModVer == bomDep.dep) Right(bomDep.dep.asBomDependency) @@ -210,7 +210,7 @@ trait JavaModule def depManagement: T[Agg[Dep]] = Task { Agg.empty[Dep] } private def addBoms( - bomDeps: Seq[coursier.core.BomDependency], + bomIvyDeps: Seq[coursier.core.BomDependency], depMgmt: Seq[(DependencyManagement.Key, DependencyManagement.Values)], overrideVersions: Boolean ): coursier.core.Dependency => coursier.core.Dependency = { @@ -229,8 +229,8 @@ trait JavaModule dep // add BOM coordinates - coursier will handle the rest .addBomDependencies( - if (overrideVersions) bomDeps.map(_.withForceOverrideVersions(overrideVersions)) - else bomDeps + if (overrideVersions) bomIvyDeps.map(_.withForceOverrideVersions(overrideVersions)) + else bomIvyDeps ) // add dependency management ourselves: // - overrides meant to apply to transitive dependencies diff --git a/scalalib/src/mill/scalalib/PublishModule.scala b/scalalib/src/mill/scalalib/PublishModule.scala index de0d707cb2d..31bb11023f8 100644 --- a/scalalib/src/mill/scalalib/PublishModule.scala +++ b/scalalib/src/mill/scalalib/PublishModule.scala @@ -104,7 +104,7 @@ trait PublishModule extends JavaModule { outer => * BOM dependency to specify in the POM */ def publishXmlBomDeps: Task[Agg[Dependency]] = Task.Anon { - bomDeps().map(resolvePublishDependency.apply().apply(_)) + bomIvyDeps().map(resolvePublishDependency.apply().apply(_)) } /** diff --git a/scalalib/test/src/mill/scalalib/BomTests.scala b/scalalib/test/src/mill/scalalib/BomTests.scala index b7fe411d1c4..32f1a3beff2 100644 --- a/scalalib/test/src/mill/scalalib/BomTests.scala +++ b/scalalib/test/src/mill/scalalib/BomTests.scala @@ -24,7 +24,7 @@ object BomTests extends TestSuite { object modules extends TestBaseModule { object bom extends Module { object placeholder extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.cloud:libraries-bom:26.50.0" ) def ivyDeps = Agg( @@ -51,7 +51,7 @@ object BomTests extends TestSuite { } object versionOverride extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.cloud:libraries-bom:26.50.0" ) def ivyDeps = Agg( @@ -79,7 +79,7 @@ object BomTests extends TestSuite { object invalid extends TestBaseModule { object exclude extends JavaModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.cloud:libraries-bom:26.50.0".exclude(("foo", "thing")) ) } @@ -172,7 +172,7 @@ object BomTests extends TestSuite { object precedence extends Module { object higher extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.protobuf:protobuf-bom:4.28.1" ) def depManagement = Agg( @@ -185,7 +185,7 @@ object BomTests extends TestSuite { } object higherTransitive extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.protobuf:protobuf-bom:4.28.1" ) def depManagement = Agg( @@ -198,7 +198,7 @@ object BomTests extends TestSuite { } object lower extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.protobuf:protobuf-bom:4.28.1" ) def depManagement = Agg( @@ -211,7 +211,7 @@ object BomTests extends TestSuite { } object lowerTransitive extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.protobuf:protobuf-bom:4.28.1" ) def depManagement = Agg( @@ -224,7 +224,7 @@ object BomTests extends TestSuite { } object addExclude extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.protobuf:protobuf-bom:4.28.3" ) def depManagement = Agg( @@ -278,7 +278,7 @@ object BomTests extends TestSuite { ) object dependee extends JavaModule with TestPublishModule { - def bomDeps = Agg( + def bomIvyDeps = Agg( ivy"com.google.cloud:libraries-bom:26.50.0" ) def moduleDeps = Seq(bomOnModuleDependency)