Skip to content

Commit

Permalink
Frgaal integration in sbt (#3421)
Browse files Browse the repository at this point in the history
* Initial integration with Frgaal in sbt

Half-working since it chokes on generated classes from annotation
processor.

* Replace AutoService with ServiceProvider

For reasons unknown AutoService would fail to initialize and fail to
generate required builtin method classes.
Hidden error message is not particularly revealing on the reason for
that:
```
[error] error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider com.google.auto.service.processor.AutoServiceProcessor could not be instantiated
```

The sample records is only to demonstrate that we can now use newer Java
features.

* Cleanup + fix benchmark compilation

Bench requires jmh classes which are not available because we obviously
had to limit `java.base` modules to get Frgaal to work nicely.
For now, we default to good ol' javac for Benchmarks.
Limiting Frgaal to runtime for now, if it plays nicely, we can expand it
to other projects.

* Update CHANGELOG

* Remove dummy record class

* Update licenses

* New line

* PR review

* Update legal review

Co-authored-by: Radosław Waśko <[email protected]>
  • Loading branch information
hubertp and radeusgd authored May 4, 2022
1 parent ffe6700 commit 79c82da
Show file tree
Hide file tree
Showing 30 changed files with 2,601 additions and 133 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
- [Fixed execution of defaulted arguments of Atom Constructors][3358]
- [Converting Enso Date to java.time.LocalDate and back][3374]
- [Functions with all-defaulted arguments now execute automatically][3414]
- [Frgaal compiler integration to allow for latest Java constructs][3421]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand All @@ -200,6 +201,7 @@
[3412]: https://github.com/enso-org/enso/pull/3412
[3414]: https://github.com/enso-org/enso/pull/3414
[3417]: https://github.com/enso-org/enso/pull/3417
[3421]: https://github.com/enso-org/enso/pull/3421

# Enso 2.0.0-alpha.18 (2021-10-12)

Expand Down
18 changes: 11 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import org.enso.build.BenchTasks._
import org.enso.build.WithDebugCommand
import sbt.Keys.{libraryDependencies, scalacOptions}
import sbt.addCompilerPlugin
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import src.main.scala.licenses.{
DistributionDescription,
SBTDistributionComponent
}
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
import src.main.scala.licenses.{DistributionDescription, SBTDistributionComponent}

import java.io.File
import java.nio.file.Paths

// ============================================================================
// === Global Configuration ===================================================
Expand Down Expand Up @@ -952,7 +950,7 @@ lazy val searcher = project
lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl"))
.settings(
version := "0.1",
libraryDependencies += "com.google.auto.service" % "auto-service" % "1.0.1" exclude ("com.google.code.findbugs", "jsr305")
libraryDependencies += "org.netbeans.api" % "org-openide-util-lookup" % "RELEASE130"
)

// ============================================================================
Expand Down Expand Up @@ -1128,6 +1126,8 @@ lazy val runtime = (project in file("engine/runtime"))
cleanInstruments := FixInstrumentsGeneration.cleanInstruments.value,
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
inConfig(Benchmark)(Defaults.compilersSetting), // Compile benchmarks with javac, due to jmh issues
Compile/compile/compilers := FrgaalJavaCompiler.compilers((Compile / dependencyClasspath).value, compilers.value, javaVersion),
Test / parallelExecution := false,
Test / logBuffered := false,
scalacOptions += "-Ymacro-annotations",
Expand All @@ -1147,7 +1147,11 @@ lazy val runtime = (project in file("engine/runtime"))
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalVersion % Benchmark,
"org.typelevel" %% "cats-core" % catsVersion,
"eu.timepit" %% "refined" % refinedVersion
"eu.timepit" %% "refined" % refinedVersion,
// This dependency is needed only so that developers don't download Frgaal manually.
// Sadly it cannot be placed under plugins either because meta dependencies are not easily
// accessible from the non-meta build definition.
FrgaalJavaCompiler.frgaal
),
// Note [Unmanaged Classpath]
Compile / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
Expand Down
20 changes: 5 additions & 15 deletions distribution/engine/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ The license information can be found along with the copyright notices.
Copyright notices related to this dependency can be found in the directory `com.github.julien-truffaut.monocle-macro_2.13-2.1.0`.


'auto-common', licensed under the Apache 2.0, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `com.google.auto.auto-common-1.2`.


'auto-service', licensed under the Apache 2.0, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `com.google.auto.service.auto-service-1.0.1`.


'auto-service-annotations', licensed under the Apache 2.0, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `com.google.auto.service.auto-service-annotations-1.0.1`.


'error_prone_annotations', licensed under the Apache 2.0, is distributed with the engine.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `com.google.errorprone.error_prone_annotations-2.7.1`.
Expand Down Expand Up @@ -356,6 +341,11 @@ The license file can be found at `licenses/BSD-3-Clause`.
Copyright notices related to this dependency can be found in the directory `org.jline.jline-3.21.0`.


'org-openide-util-lookup', licensed under the The Apache Software License, Version 2.0, is distributed with the engine.
The license information can be found along with the copyright notices.
Copyright notices related to this dependency can be found in the directory `org.netbeans.api.org-openide-util-lookup-RELEASE130`.


'reactive-streams', licensed under the CC0, is distributed with the engine.
The license file can be found at `licenses/CC0`.
Copyright notices related to this dependency can be found in the directory `org.reactivestreams.reactive-streams-1.0.3`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 79c82da

Please sign in to comment.