This repository has been archived by the owner. It is now read-only.

SBT doc/publishLocal freezes in project using inline/meta macro annotation #55

Open
olafurpg opened this Issue Sep 23, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@olafurpg
Member

olafurpg commented Sep 23, 2016

To reproduce: run publishLocal from this commit: olafurpg/scalafmt@cdf3202

The issue was caught in CI: https://travis-ci.org/olafurpg/scalafmt/builds/162166059#L1893

Disabling scaladoc generation resolves the issue, I use these settings to enable paradise 3

lazy val metaMacroSettings: Seq[Def.Setting[_]] = Seq(
  libraryDependencies += "org.scalameta" %% "scalameta" % "1.1.0",
  sources in (Compile,doc) := Seq.empty, // disable scaladoc
  publishArtifact in (Compile, packageDoc) := false, // disable scaladoc
  addCompilerPlugin(
    "org.scalameta" % "paradise" % "3.0.0-M5" cross CrossVersion.full),
  scalacOptions += "-Xplugin-require:macroparadise"
)

olafurpg added a commit to scalameta/scalafmt that referenced this issue Sep 23, 2016

olafurpg referenced this issue in xeno-by/new-tutorial Nov 7, 2016

import from https://github.com/olafurpg/scala.meta-workshop
Changes from the original version:

* compileTimeOnly is removed. If we compile a macro annotation with paradise,
this annotation will be added automatically. If we don’t compile with paradise,
the compilation will fail.

* The example macro annotation is moved to the default package.
Neither IntelliJ, nor Dotty support macro annotations coming from named packages.

* The build is simplified and reorganized to explain its individual pieces.
Not sure why we needed `sources in (Compile, doc) := Nil`.

* Meta and paradise versions are now hardcoded without any explanation.
These magic string will be updated by our CI. I found that even with
the previously present explanations it is too hard for newcomers
to figure out correct versions.

* A brief explanation of new-style macros and environment setup is added.
@reid-spencer

This comment has been minimized.

Show comment
Hide comment
@reid-spencer

reid-spencer Nov 23, 2016

👍 Thanks for the work around. Of course, ideally we want scaladoc to handle scala.meta

reid-spencer commented Nov 23, 2016

👍 Thanks for the work around. Of course, ideally we want scaladoc to handle scala.meta

olafurpg added a commit to olafurpg/paradise that referenced this issue Mar 28, 2017

Remove range positions from expanded code.
This commit is a workaround for the fact that scala.meta macro
annotations don't compile with -Yrangepos enabled.
The option -Yrangepos causes scalac to validate that all start/end offsets
in tree positions follow a few invariants. These invariants enable
tools like Scala IDE to use binary search to quickly find trees.
However, the expanded trees by scala.meta macro annotations don't follow
these invariants. I haven't been able to investigate properly why this
is the case.

This commit removes range positions from scala.meta macro annotation
expanded code, enabling scala.meta macro annotations to not crash with
tools like like scoverage or scalahost were enabled. However, note,
those tools may need range positions to function properly.

Related issues:
- #181
- #55
- #52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.