Reputation: 11
This may or may not be a duplicate of How to use chisel module as package. Again, for scala/sbt/maven experts this may be obvious, for old school ASIC designers it's not:
I have project PROJ with standard directory structure PROJ/src/main/scala/myproj.scala. How do I use some chisel code from some external library LIB? Eg. from /usr/libs/LIB/src/main/scala/{stuff}.scala?
Upvotes: 1
Views: 77
Reputation: 44957
(Not a full answer, more a warning than an answer)
"Search path" sounds a bit concerning, so I'd just want to make sure that you don't expect something like a C/C++ build that's searching for some files on some file systems.
Before proceeding, it might be helpful to ponder on the thought that the entire scala / java / kotlin / maven / sbt / gradle / ... ecosystem is "internet-centric", not "file-system-centric". It essentially assumes that all packages are available under a globally unique identifier in some online repository (even when they are not, local installation will make them look as if they came from a public repository, see below). Local file systems are used only as temporary local caches (and it is assumed that you as a human will not look into those caches without a good reason). In general, it tries really hard not to depend on the machine on which it's built: everything it needs is specified in the build.sbt
, presence or absence of any files in /usr/lib
is irrelevant.
If you want to use a package, you have to declare it as a dependency in your build config (SBT documentation definitely does tell how to do this; Maven Central even provides a helpful little textfield from which you can copy the correctly formatted pieces of the config).
If your package does not come from any public repository, you'll first have to install it locally (SBT documentation must also tell how to "install a package locally", it's a short SBT
command that will copy the package into the local cache in your file system, so that other projects that depend on it can pretend as if it came from some repository).
If you have just the src/foo/bar/baz/stuff.scala
-files, but no build.sbt
-file, you'll probably first want to convert it into a proper sbt
-project, then build it, then install it locally (you need a JAR
, adding .scala
files to the CLASSPATH
won't buy you anything, they must be compiled first; Doing anything to the CLASSPATH
manually is essentially hopeless anyway, the only way to do it is to let SBT
take care of everything).
Upvotes: 2