chipsalliance / rocket-chip

Rocket Chip Generator
Other
3.15k stars 1.11k forks source link

Missing ROCKETCHIP_ADDONS support for wake builds #2307

Open seldridge opened 4 years ago

seldridge commented 4 years ago

If you have ROCKETCHIP_ADDONS (SBT unmanaged source directories) I can't seem to build the project using wake. Specifically, if the Rocket Chip sources are modified to require files inside the unmanaged sources, wake will fail to build the project due to not found errors.

Type of issue: bug report

Impact: no functional change

Development Phase: request

Other information

None.

If the current behavior is a bug, please provide the steps to reproduce the problem:

There's a complete example on a fork: https://github.com/chipsalliance/rocket-chip/compare/master...seldridge:wake-ROCKETCHIP_ADDONS

Add a Rocket Chip addon which defines a method/class necessary to build Rocket Chip, e.g., create: foo/src/main/scala/foo/Bar.scala with contents:

package foo

class Bar

Patch Rocket in the following way:

diff --git a/src/main/scala/system/ExampleRocketSystem.scala b/src/main/scala/system/ExampleRocketSystem.scala
index fc6c8bac..6d58c86c 100644
--- a/src/main/scala/system/ExampleRocketSystem.scala
+++ b/src/main/scala/system/ExampleRocketSystem.scala
@@ -19,6 +19,7 @@ class ExampleRocketSystem(implicit p: Parameters) extends RocketSubsystem
     with CanHaveSlaveAXI4Port
     with HasPeripheryBootROM {
   override lazy val module = new ExampleRocketSystemModuleImp(this)
+  val bar = new foo.Bar
 }

 class ExampleRocketSystemModuleImp[+L <: ExampleRocketSystem](_outer: L) extends RocketSubsystemModuleImp(_outer)

Try to build the project:

cd $rocketChipDir
wit --repo-path $PWD/.. init workspace -a rocket-chip
cd workspace
env WAKE_PATH=$PATH wake --init .
env ROCKETCHIP_ADDONS=Foo WAKE_PATH=$PATH wake -dv 'compileScalaModule rocketchipScalaModule | getPathResult'

What is the current behavior?

This dies because it can't find foo.Bar:

[E] [E1] ../../rocket-chip/src/main/scala/system/ExampleRocketSystem.scala:22:17
[E]      not found: value foo
[E]      L22:   val bar = new foo.Bar

What is the expected behavior?

You should be able to use ROCKETCHIP_ADDONS in wake builds.

Please tell us about your environment:

What is the use case for changing the behavior?

This would enable parity between sbt and wake builds. Also, if running local Travis regressions on internal projects that require ROCKETCHIP_ADDONS, you wouldn't need to patch or disable wake checks.

richardxia commented 4 years ago

I am going to tag @jackkoenig on this, since he's the author of https://github.com/sifive/api-scala-sifive and he probably knows SBT better than I do.