scala - 在 Delite 中编译我的第一个 DSL

标签 scala compiler-errors sbt dsl

我正在尝试按照使用 Delite+LMS 编译简单 DSL 的教程进行操作。我成功编译了 LMS 和 Delite。现在,密切关注本教程:http://stanford-ppl.github.io/Delite/myfirstdsl.html当我尝试构建我的分析 dsl 时遇到问题。编译器似乎找不到 delite-collection 类:

felix@felix-UX32VD:~/Documents/phd/delite/Delite$ sbt compile
Loading /home/felix/sbt/bin/sbt-launch-lib.bash
[info] Loading project definition from /home/felix/Documents/phd/delite/Delite/project
[info] Set current project to delite (in build file:/home/felix/Documents/phd/delite/Delite/)
[info] Compiling 5 Scala sources to /home/felix/Documents/phd/delite/Delite/dsls/profiling/target/scala-2.10/classes...
[error] /home/felix/Documents/phd/delite/Delite/dsls/profiling/src/example/profiling/Profile.scala:7: object DeliteCollection is not a member of package ppl.delite.framework.datastruct.scala
[error] import ppl.delite.framework.datastruct.scala.DeliteCollection
[error]        ^
[error] /home/felix/Documents/phd/delite/Delite/dsls/profiling/src/example/profiling/Profile.scala:69: not found: type ScalaGenProfileArrayOps
[error]   with ScalaGenDeliteOps with ScalaGenProfileOps with ScalaGenProfileArrayOps
[error]      

                                             ^

有人对我做错了什么有一些见解吗?

最佳答案

来自 SBT 手册:

Library dependencies can be added in two ways:

  • unmanaged dependencies are jars dropped into the lib directory

  • managed dependencies are configured in the build definition and downloaded automatically from repositories (through Apache Ivy, exactly like Maven)


在任何情况下,在框架项目中添加代码都是一个坏主意,因为您将不得不更改构建过程(例如,添加额外的模块)。此外,您可能必须重新编译框架的所有代码,这会非常慢。
根据框架制作代码的正确方法是:
  • 将库引用为某种存储库中可用的托管依赖项(最佳解决方案)。
  • 将 jar 复制到项目的 lib 文件夹中,并将其添加为非托管依赖项。

  • 由于显然 Delite 在任何 Ivy 存储库中都不可用,因此最好的方法是克隆 Git 存储库并在本地发布它。见 http://www.scala-sbt.org/release/docs/Detailed-Topics/Publishing.html

    Publishing Locally

    The publishLocal command will publish to the local Ivy repository. By default, this is in ${user.home}/.ivy2/local. Other projects on the same machine can then list the project as a dependency. For example, if the SBT project you are publishing has configuration parameters like:

    name := 'My Project'

    organization := 'org.me'

    version := '0.1-SNAPSHOT'

    Then another project can depend on it:

    libraryDependencies += "org.me" %% "my-project" % "0.1-SNAPSHOT"

    关于scala - 在 Delite 中编译我的第一个 DSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21157985/

    相关文章:

    scala - 支持使用 Scala 命名/默认参数的构造函数注入(inject)的 IoC 容器?

    c++ - 有人建议我这段代码中剩下的内容。运行时未显示任何错误,但输出带有垃圾值

    java - Bukkit插件编译问题

    java - 如果中间阶段发生故障,MapReduce 如何从错误中恢复

    scala - 如何合并SPARK数据框创建的文件夹中的所有零件文件并重命名为scala中的文件夹名称

    git - Play 2.2+项目中的build.sbt可以依赖于GitHub项目SBT吗?

    sbt - 如何告诉 sbteclipse 忽略 src/main/java?

    compilation - sbt 用不同的选项编译任务

    scala - 在元组中拆分字符串

    java - Java中的二进制搜索代码无法运行