Publish Persistance API+Javadoc to local m2 repository (#10222)

This commit is contained in:
Jaroslav Tulach 2024-06-10 14:00:51 +02:00 committed by GitHub
parent 99a1d052a0
commit 4c84b57c49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 49 additions and 17 deletions

View File

@ -6,6 +6,7 @@ on:
pull_request:
branches: [develop]
paths:
- ".github/workflows/enso4igv.yml"
- "tools/enso4igv/**/*"
jobs:
@ -24,6 +25,14 @@ jobs:
java-version: ${{ matrix.java }}
cache: maven
- uses: graalvm/setup-graalvm@v1
with:
java-version: "21"
distribution: "graalvm-community"
- name: Publish to Maven Repository
run: sbt publishM2
- name: Find out pom & micro versions
working-directory: tools/enso4igv
run: |

View File

@ -47,6 +47,7 @@ val currentEdition = sys.env.getOrElse(
// Note [Stdlib Version]
val stdLibVersion = defaultDevEnsoVersion
val targetStdlibVersion = ensoVersion
val persistanceVersion = "0.2-SNAPSHOT"
// Inspired by https://www.scala-sbt.org/1.x/docs/Howto-Startup.html#How+to+take+an+action+on+startup
lazy val startupStateTransition: State => State = { s: State =>
@ -96,6 +97,7 @@ Global / onLoad := {
ThisBuild / organization := "org.enso"
ThisBuild / scalaVersion := scalacVersion
ThisBuild / publish / skip := true
/* Tag limiting the concurrent access to tools/simple-library-server in tests.
*/
@ -1312,11 +1314,15 @@ lazy val `ydoc-server` = project
lazy val `persistance` = (project in file("lib/java/persistance"))
.settings(
version := "0.1",
version := persistanceVersion,
Test / fork := true,
commands += WithDebugCommand.withDebug,
frgaalJavaCompilerSetting,
annotationProcSetting,
javadocSettings,
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
Compile / javacOptions := ((Compile / javacOptions).value),
inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= Seq(
@ -1330,9 +1336,13 @@ lazy val `persistance` = (project in file("lib/java/persistance"))
lazy val `persistance-dsl` = (project in file("lib/java/persistance-dsl"))
.settings(
version := "0.1",
version := persistanceVersion,
frgaalJavaCompilerSetting,
Compile / javacOptions := ((Compile / javacOptions).value ++
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
javadocSettings,
Compile / compile / javacOptions := ((Compile / compile / javacOptions).value ++
// Only run ServiceProvider processor and ignore those defined in META-INF, thus
// fixing incremental compilation setup
Seq(
@ -1677,9 +1687,9 @@ lazy val truffleDslSuppressWarnsSetting = Seq(
* `(Compile/sourceManaged)` directory, usually pointing to `target/classes/src_managed`.
*/
lazy val annotationProcSetting = Seq(
Compile / javacOptions ++= Seq(
Compile / compile / javacOptions ++= Seq(
"-s",
(Compile / sourceManaged).value.getAbsolutePath,
(Compile / compile / sourceManaged).value.getAbsolutePath,
"-Xlint:unchecked"
),
Compile / compile := (Compile / compile)
@ -1696,6 +1706,19 @@ lazy val annotationProcSetting = Seq(
)
)
lazy val javadocSettings = Seq(
Compile / doc / javacOptions --= Seq(
"-deprecation",
"-g",
"-Xlint:unchecked",
"-proc:full"
),
Compile / doc / javacOptions ++= Seq(
"--snippet-path",
(Test / javaSource).value.getAbsolutePath
)
)
/** A setting to replace javac with Frgaal compiler, allowing to use latest Java features in the code
* and still compile down to JDK 17
*/

View File

@ -39,9 +39,9 @@ public @interface Persistable {
int id();
/**
* Should the generated code use {@link Persistance.Output#writeInline(Class<T>, T)} or not. By
* default all {@code final} or <em>sealed</em> classes are inlined. Inlining is however not very
* helpful when a single object is shared between multiple other objects.
* Should the generated code use {@link Persistance.Output#writeInline} or not. By default all
* {@code final} or <em>sealed</em> classes are inlined. Inlining is however not very helpful when
* a single object is shared between multiple other objects.
*
* @return
*/

View File

@ -4,33 +4,33 @@
*
* <p>{@snippet file="org/enso/persist/PersistanceTest.java" region="write"}
*
* <p>Use sibling static {@link Persistance#read readO} method to read the byte buffer back into
* <p>Use sibling static {@link Persistance#read read} method to read the byte buffer back into
* their memory representation.
*
* <p>{@snippet file="org/enso/persist/PersistanceTest.java" region="read"}
*
* <h2>Laziness</h2>
*
* The major benefit of this framework is the ability to read only the part of the stored graph that
* The major benefit of this framework is the ability to read only a part of the stored graph that
* is actually needed. One may {@linkplain Persistance.Input#readReference obtain a reference} to an
* object and turn that {@link Persistance.Reference} into actual object <b>later</b>, when needed.
*
* <h2>Manual Persistance</h2>
*
* Unlike typical Java serialization (which tries to make things automatic), this framework requires
* one to implement the persistance manually. For each class that one wants to support, one has to
* implement subclass {@link Persistance} and implement its {@link Persistance#writeObject} and
* {@link Persistance#readObject} method.
* one to implement the persistance manually. For each class one wants to serde, one has to
* implement a subclass of {@link Persistance} and implement its {@link Persistance#writeObject} and
* {@link Persistance#readObject} methods.
*
* <p>{@snippet file="org/enso/persist/PersistanceTest.java" region="manual"}
*
* <h2>Semi-automatic Persistance</h2>
*
* Writing serialization and deserialization implementation manually is a boring, tedious and
* errorprone process. That's why there is a {@link Persistable} annotation and associated
* annotation processor that generates the necessary {@link Persistance} subclass based on the
* "richest" constructor in the class to be persisted. This approach seems to work well for Java
* records and Scala case classes.
* errorprone process. That's why there is a {@link Persistable @Persistable} annotation and
* associated annotation processor that generates the necessary {@link Persistance} subclass based
* on the "richest" constructor in the class to be persisted. This approach seems to work well for
* Java records and Scala case classes.
*
* <p>{@snippet file="org/enso/persist/PersistanceTest.java" region="annotation"}
*/