Skip to content

Add community build: Intent #7437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

provegard
Copy link

Intent is a test framework for Dotty: https://github.com/factor10/intent. @bishabosha suggested I should add it as a community build.

Two things:

  1. It is not clear to me whether the test command should run tests or just compile (or test-compile). The existing projects differ in this regard.

  2. I don't know if this PR works. When I run sbt community-build/test, I get:

[error] java.nio.file.InvalidPathException: Illegal char <:> at index 23: TypeOrBoundsOps$given_=:=_of_Type$.class
[error]         at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
[error]         at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
[error]         at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
[error]         at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
[error]         at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
[error]         at java.base/java.nio.file.Path.resolve(Path.java:515)
[error]         at dotty.tools.io.Path.$div(Path.scala:93)
[error]         at dotty.tools.io.PlainFile.lookupName(PlainFile.scala:78)
[error]         at dotty.tools.io.AbstractFile.fileOrSubdirectoryNamed(AbstractFile.scala:239)
[error]         at dotty.tools.io.AbstractFile.fileNamed(AbstractFile.scala:256)
[error]         at dotty.tools.backend.jvm.BytecodeWriters.getFile(BytecodeWriters.scala:31)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.getFile(GenBCode.scala:69)
[error]         at dotty.tools.backend.jvm.BCodeHelpers.getFileForClassfile(BCodeHelpers.scala:33)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.getFileForClassfile(GenBCode.scala:69)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.liftedTree1$1(GenBCode.scala:256)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.$anonfun$2(GenBCode.scala:261)
[error]         at scala.collection.immutable.List.map(List.scala:223)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:262)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:181)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:511)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:477)
[error]         at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:52)
[error]         at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
[error]         at scala.collection.immutable.List.map(List.scala:223)
[error]         at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
[error]         at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:56)
[error]         at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:159)
[error]         at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]         at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]         at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error]         at dotty.tools.dotc.Run.runPhases$5(Run.scala:169)
[error]         at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
[error]         at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[error]         at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
[error]         at dotty.tools.dotc.Run.compileSources(Run.scala:121)
[error]         at dotty.tools.dotc.Run.compile(Run.scala:104)
[error]         at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
[error]         at dotty.tools.dotc.Driver.process(Driver.scala:178)
[error]         at dotty.tools.dotc.Main.process(Main.scala)
[error]         at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
[error]         at xsbt.CompilerInterface.run(CompilerInterface.java:41)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error]         at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
[error]         at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
[error]         at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:133)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:73)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:116)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:307)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:307)
[error]         at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:106)
[error]         at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:87)
[error]         at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:116)
[error]         at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:63)
[error]         at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:89)
[error]         at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:134)
[error]         at sbt.internal.inc.Incremental$.compile(Incremental.scala:80)
[error]         at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:67)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:311)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:269)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:159)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:238)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:69)
[error]         at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1549)
[error]         at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1523)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:278)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:834)
[error] (dotty-library / Compile / compileIncremental) java.nio.file.InvalidPathException: Illegal char <:> at index 23: TypeOrBoundsOps$given_=:=_of_Type$.class

Any suggestions to get past the error?

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@bishabosha
Copy link
Member

bishabosha commented Oct 19, 2019

so this is because Its worth noting that the scala version of the community build used to compile your project is the same as the baseVersion in project/Build.scala in the dotty repo, which is currently a snapshot of the master branch build every time the community build is ran in the CI. So usually custom branches are made just for the community build, where any changes can be merged back into your master branch when the next release of dotty comes out.

@smarter
Copy link
Member

smarter commented Oct 19, 2019

[error] java.nio.file.InvalidPathException: Illegal char <:> at index 23: TypeOrBoundsOps$given_=:=_of_Type$.class

Looks like we're emitting invalid classfile names on windows., =:= should have been encoded. Sounds similar to #6903

@bishabosha
Copy link
Member

Sorry, I made an incorrect assumption about the error you posted, but the API of tasty reflect has changed since 0.19.0-RC1 so you would still need to make some changes to your code. E.g. I get the errors when compiling:

[info] Set current project to intent (in build file:/Users/jamie/Workspace/dotty/community-build/community-projects/intent/)
[info] Forcing Scala version to 0.20.0-bin-SNAPSHOT on all projects.
[info] Reapplying settings...
[info] Set current project to intent (in build file:/Users/jamie/Workspace/dotty/community-build/community-projects/intent/)
[info] Updating macros...
[info] Done updating.
[info] Updating ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/jamie/Workspace/dotty/community-build/community-projects/intent/macros/target/scala-0.20/classes ...
[error] -- [E008] Member Not Found Error: /Users/jamie/Workspace/dotty/community-build/community-projects/intent/macros/src/main/scala/intent/macros/source.scala:54:28 
[error] 54 |    val file = rootPosition.sourceFile
[error]    |               ^^^^^^^^^^^^^^^^^^^^^^^
[error]    |               value sourceFile is not a member of qctx.tasty.Position
[error] -- [E008] Member Not Found Error: /Users/jamie/Workspace/dotty/community-build/community-projects/intent/macros/src/main/scala/intent/macros/source.scala:56:35 
[error] 56 |    val lineNo: Int = rootPosition.startLine
[error]    |                      ^^^^^^^^^^^^^^^^^^^^^^
[error]    |                  value startLine is not a member of qctx.tasty.Position
[error] -- [E008] Member Not Found Error: /Users/jamie/Workspace/dotty/community-build/community-projects/intent/macros/src/main/scala/intent/macros/source.scala:57:34 
[error] 57 |    val colNo: Int = rootPosition.startColumn
[error]    |                     ^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |                value startColumn is not a member of qctx.tasty.Position
[error] three errors found
[error] (macros / Compile / compileIncremental) Compilation failed
[error] Total time: 3 s, completed 19-Oct-2019 19:06:19
[error] Test dotty.communitybuild.CommunityBuildTest.intent failed: java.lang.AssertionError: 
[error] 
[error] sbt exited with an error code. To reproduce without JUnit, use:
[error] 
[error]     sbt community-build/prepareCommunityBuild
[error]     cd community-build/community-projects/intent
[error]     sbt -sbt-version 1.2.7 --addPluginSbtFile=/Users/jamie/Workspace/dotty/community-build/sbt-dotty-sbt ";clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++0.20.0-bin-SNAPSHOT! test"
[error] 
[error] For a faster feedback loop, one can try to extract a direct call to dotc
[error] using the sbt export command. For instance, for scalacheck, use
[error]     sbt export jvm/test:compileIncremental
[error] 
[error] , took 36.458 sec
[error]     at dotty.communitybuild.CommunityBuildTest.test(CommunityBuildTest.scala:84)
[error]     at dotty.communitybuild.CommunityBuildTest.intent(CommunityBuildTest.scala:209)
[error]     ...

@provegard
Copy link
Author

@bishabosha are there replacements for those members already in 0.19.0? Otherwise I won't be able to make the changes just yet.

@provegard
Copy link
Author

Or do you mean the recommendation is to make a community-build branch in Intent that builds against latest Dotty?

@bishabosha
Copy link
Member

So you should be able to make a forwards compatible change by replacing import qctx.tasty._ with import qctx.tasty.{_, given}. But it’s likely things may continue to break in the future, so a separate branch would be best. Typically what happens is that a fork will get made in dotty-staging If it’s too disruptive for the original maintainer.

@smarter
Copy link
Member

smarter commented Oct 19, 2019

We should always use a branch in our own fork, that way if we break something, we can fix it without waiting for it to be fixed upstream, which would force us to temporarily disable the broken project in our CI.

@provegard
Copy link
Author

Ok, makes sense. However, the InvalidPathException makes it hard for me right now to create a branch that works.

@bishabosha
Copy link
Member

Im closing this because I made a fork in dotty-staging that has a separate PR

@bishabosha bishabosha closed this Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants