Skip to content

Commit

Permalink
Move diplomacy to standalone library absorbing aop
Browse files Browse the repository at this point in the history
Splits out the aop and diplomacy modules into a standalone
library. Adds the new library as a dependency and updates the
in-tree diplomacy and aop modules to reference the new library with
deprecation warnings.
  • Loading branch information
lordspacehog committed Feb 28, 2024
1 parent 9d06cc5 commit 27f23ee
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 3,013 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
[submodule "dependencies/chisel"]
path = dependencies/chisel
url = https://github.com/chipsalliance/chisel.git
[submodule "dependencies/diplomacy"]
path = dependencies/diplomacy
url = https://github.com/chipsalliance/diplomacy.git
branch = lordspacehog/standalone_diplomacy
35 changes: 34 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import mill.scalalib.publish._
import coursier.maven.MavenRepository
import $file.dependencies.hardfloat.common
import $file.dependencies.cde.common
import $file.dependencies.diplomacy.common
import $file.dependencies.chisel.build
import $file.common

Expand All @@ -18,6 +19,7 @@ object v {
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0"
val json4sJackson = ivy"org.json4s::json4s-jackson:4.0.5"
val scalaReflect = ivy"org.scala-lang:scala-reflect:${scala}"
val sourcecode = ivy"com.lihaoyi::sourcecode:0.3.1"
val sonatypesSnapshots = Seq(
MavenRepository("https://s01.oss.sonatype.org/content/repositories/snapshots")
)
Expand Down Expand Up @@ -79,6 +81,34 @@ trait CDE
override def millSourcePath = os.pwd / "dependencies" / "cde" / "cde"
}

object diplomacy extends mill.define.Cross[Diplomacy](v.chiselCrossVersions.keys.toSeq)

trait Diplomacy
extends millbuild.dependencies.diplomacy.common.DiplomacyModule
with RocketChipPublishModule
with Cross.Module[String] {

override def scalaVersion: T[String] = T(v.scala)

override def millSourcePath = os.pwd / "dependencies" / "diplomacy" / "diplomacy"

// dont use chisel from source
def chiselModule = None
def chiselPluginJar = None

// use chisel from ivy
def chiselIvy = Some(v.chiselCrossVersions(crossValue)._1)
def chiselPluginIvy = Some(v.chiselCrossVersions(crossValue)._2)

// use CDE from source untill published to sonatype
def cdeModule = Some(cde)

// no cde ivy currently published
def cdeIvy = None

def sourcecodeIvy = v.sourcecode
}

object rocketchip extends Cross[RocketChip](v.chiselCrossVersions.keys.toSeq)

trait RocketChip
Expand All @@ -104,6 +134,10 @@ trait RocketChip

def cdeModule = cde

def diplomacyModule = diplomacy(crossValue)

def diplomacyIvy = None

def mainargsIvy = v.mainargs

def json4sJacksonIvy = v.json4sJackson
Expand All @@ -127,7 +161,6 @@ trait RocketChipPublishModule
override def publishVersion: T[String] = T("1.6-SNAPSHOT")
}


// Tests
trait Emulator extends Cross.Module2[String, String] {
val top: String = crossValue
Expand Down
10 changes: 7 additions & 3 deletions common.sc
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ trait RocketChipModule
// should be cde/common.sc#CDEModule
def cdeModule: ScalaModule

def diplomacyModule: ScalaModule

def diplomacyIvy: Option[Dep]

def mainargsIvy: Dep

def json4sJacksonIvy: Dep

override def moduleDeps = super.moduleDeps ++ Seq(macrosModule, hardfloatModule, cdeModule)
override def moduleDeps = super.moduleDeps ++ Seq(macrosModule, hardfloatModule, cdeModule, diplomacyModule)

override def ivyDeps = T(
super.ivyDeps() ++ Agg(
mainargsIvy,
json4sJacksonIvy
)
json4sJacksonIvy,
) ++ diplomacyIvy
)
}
1 change: 1 addition & 0 deletions dependencies/diplomacy
Submodule diplomacy added at b4f93b
121 changes: 0 additions & 121 deletions src/main/scala/aop/Select.scala

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/scala/aop/package.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package freechips.rocketchip

object aop {
@deprecated("aop has moved to the standalone diplomacy library.", "rocketchip 2.0.0")
val Select = _root_.org.chipsalliance.diplomacy.aop.Select
}
Loading

0 comments on commit 27f23ee

Please sign in to comment.