Skip to content

Commit

Permalink
Remove scala-backend submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierBlanvillain committed Feb 7, 2019
1 parent c3e7b71 commit ee6682e
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 151 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "scala-backend"]
path = scala-backend
url = https://github.com/lampepfl/scala.git
branch = sharing-backend
[submodule "scala2-library"]
path = scala2-library
url = https://github.com/lampepfl/scala.git
Expand Down
8 changes: 1 addition & 7 deletions .vscode-template/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
"**/target/": true,
"community-build/community-projects": true,
"scala2-library/{doc,docs,lib,META-INF,scripts,spec,test,tools}/": true, // only allow scala-backend/src
"scala2-library/src/[abcefimprs]*": true, // only allow scala-backend/src/library
"scala-backend/{doc,docs,lib,META-INF,scripts,spec,test,tools}/": true, // only allow scala-backend/src
"scala-backend/src/[abefilmprs]*": true, // only allow scala-backend/src/compiler
"scala-backend/src/scala/reflect/": true,
"scala-backend/src/scala/tools/{ant,cmd,reflect,util}*": true,
"scala-backend/src/scala/tools/nsc/*.scala": true,
"scala-backend/src/scala/tools/nsc/[aijrstu]*": true // only allow scala-backend/src/scala/tools/nsc/backend
"scala2-library/src/[abcefimprs]*": true
}
}
2 changes: 0 additions & 2 deletions compiler/src/scala/tools/nsc/io/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package scala.tools.nsc
* Our backend is based on the Scala 2.11 GenBCode backend and modified so that
* it compiles both with dotty and scalac, since the backend uses
* scala.tools.nsc.io.*, we need to also provide it.
*
* See http://dotty.epfl.ch/docs/contributing/backend.html for more information.
*/
package object io {
type AbstractFile = dotty.tools.io.AbstractFile
Expand Down
25 changes: 5 additions & 20 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import scala.concurrent.duration._
import vulpix._
import dotty.tools.io.JFile


class CompilationTests extends ParallelTesting {
import ParallelTesting._
import TestConfiguration._
Expand Down Expand Up @@ -239,25 +238,11 @@ class CompilationTests extends ParallelTesting {
val compilerDir = Paths.get("compiler/src")
val compilerSources = sources(Files.walk(compilerDir))

val backendDir = Paths.get("scala-backend/src/compiler/scala/tools/nsc/backend")
val backendJvmDir = Paths.get("scala-backend/src/compiler/scala/tools/nsc/backend/jvm")
val scalaJSIRDir = Paths.get("compiler/target/scala-2.12/src_managed/main/scalajs-ir-src/org/scalajs/ir")
val scalaJSIRSources = sources(Files.list(scalaJSIRDir))

// NOTE: Keep these exclusions synchronized with the ones in the sbt build (Build.scala)
val backendExcluded =
List("JavaPlatform.scala", "Platform.scala", "ScalaPrimitives.scala")
val backendJvmExcluded =
List("BCodeICodeCommon.scala", "GenASM.scala", "GenBCode.scala", "ScalacBackendInterface.scala", "BackendStats.scala", "BCodeAsmEncode.scala")

val backendSources =
sources(Files.list(backendDir), excludedFiles = backendExcluded)
val backendJvmSources =
sources(Files.list(backendJvmDir), excludedFiles = backendJvmExcluded)
val scalaJSIRSources =
sources(Files.list(scalaJSIRDir))

val dotty1 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources ++ scalaJSIRSources, opt)(dotty1Group)
val dotty2 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources ++ scalaJSIRSources, opt)(dotty2Group)
val dotty1 = compileList("dotty", compilerSources ++ scalaJSIRSources, opt)(dotty1Group)
val dotty2 = compileList("dotty", compilerSources ++ scalaJSIRSources, opt)(dotty2Group)

val tests = {
lib.keepOutput :: dotty1.keepOutput :: {
Expand All @@ -273,8 +258,8 @@ class CompilationTests extends ParallelTesting {
compileShallowFilesInDir("compiler/src/dotty/tools/dotc/transform", opt) +
compileShallowFilesInDir("compiler/src/dotty/tools/dotc/typer", opt) +
compileShallowFilesInDir("compiler/src/dotty/tools/dotc/util", opt) +
compileList("shallow-backend", backendSources, opt) +
compileList("shallow-backend-jvm", backendJvmSources, opt) +
compileShallowFilesInDir("compiler/src/scala/tools/nsc/backend", opt) +
compileShallowFilesInDir("compiler/src/scala/tools/nsc/backend/jvm", opt) +
compileList("shallow-scalajs-ir", scalaJSIRSources, opt)
}.keepOutput :: Nil
}.map(_.checkCompile())
Expand Down
73 changes: 0 additions & 73 deletions docs/docs/contributing/backend.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ sidebar:
url: docs/contributing/intellij-idea.html
- title: Testing
url: docs/contributing/testing.html
- title: Working with the Backend
url: docs/contributing/backend.html
- title: Internals
subsection:
- title: Backend
Expand Down
42 changes: 0 additions & 42 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -464,48 +464,6 @@ object Build {

// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
lazy val commonDottyCompilerSettings = Seq(

// The scala-backend folder is a git submodule that contains a fork of the Scala 2.11
// compiler developed at https://github.com/lampepfl/scala/tree/sharing-backend.
// We do not compile the whole submodule, only the part of the Scala 2.11 GenBCode backend
// that we reuse for dotty.
// See http://dotty.epfl.ch/docs/contributing/backend.html for more information.
//
// NOTE: We link (or copy if symbolic links are not supported) these sources in
// the current project using `sourceGenerators` instead of simply
// referencing them using `unmanagedSourceDirectories` because the latter
// breaks some IDEs.
sourceGenerators in Compile += Def.task {
val outputDir = (sourceManaged in Compile).value

val submoduleCompilerDir = baseDirectory.value / ".." / "scala-backend" / "src" / "compiler"
val backendDir = submoduleCompilerDir / "scala" / "tools" / "nsc" / "backend"
val allScalaFiles = GlobFilter("*.scala")

// NOTE: Keep these exclusions synchronized with the ones in the tests (CompilationTests.scala)
val files = ((backendDir *
(allScalaFiles - "JavaPlatform.scala" - "Platform.scala" - "ScalaPrimitives.scala")) +++
(backendDir / "jvm") *
(allScalaFiles - "BCodeICodeCommon.scala" - "GenASM.scala" - "GenBCode.scala" - "ScalacBackendInterface.scala" - "BackendStats.scala")
).get

val pairs = files.pair(sbt.Path.rebase(submoduleCompilerDir, outputDir))

try {
pairs.foreach { case (src, dst) =>
sbt.IO.createDirectory(dst.getParentFile)
if (!dst.exists)
Files.createSymbolicLink(/*link = */ dst.toPath, /*existing = */src.toPath)
}
} catch {
case _: UnsupportedOperationException | _: FileSystemException =>
// If the OS doesn't support symbolic links, copy the directory instead.
sbt.IO.copy(pairs, CopyOptions(overwrite = true, preserveLastModified = true, preserveExecutable = true))
}

pairs.map(_._2)
}.taskValue,

// set system in/out for repl
connectInput in run := true,
outputStrategy := Some(StdoutOutput),
Expand Down
1 change: 0 additions & 1 deletion scala-backend
Submodule scala-backend deleted from 1447a7

0 comments on commit ee6682e

Please sign in to comment.