You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "olabusayoT (via GitHub)" <gi...@apache.org> on 2025/08/08 17:17:08 UTC
[I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
olabusayoT opened a new issue, #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352
Specifically, the debugger dependency. There has been a change to paths/references, so japi/sapi was removed in favor of api in addition to other changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on issue #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352#issuecomment-3357831598
Hmm, good question...
Note that Daffodil 4.0.0 requires Java 17+.
Maybe one option is to remove the `.aggregate(debugger.projectRefs: _*)` line so it only builds the debugger jars when you explicitly run those tasks, e.g.
```
sbt debugger2_12/package
```
That might be nice if you're developing/testing and only care about a specific version--that way you don't have to worry about other versions. As long as CI ensures builds all three jars that might be fine. And we'd have to make sure the release process builds all three and bundles them in with the vsix. So the build config becomes maybe a bit more complex. I don't personally love this since it feels like it adds complexity to build script and CI/release.
Maybe another option is something like this:
```scala
val debugger = {
val java8projects = (projectMatrix in file("debugger"))
.settings()
.jvmPlatform(scalaVersion = "2.12.20,...)
.jvmPlatform(scalaVersion = "2.13.16,...)
if (isJava17orNewer) {
java8Projects.jvmPlatform(scalaVersion = "3.3.6", ...)
} else {
java8Projects
}
}
```
I'm not sure if that actually works, but the idea is to detect if java is 17+ and if so we add on the Scala 3 platform. As long as we build releases with 17+, it should build all the right jars. And if you locally develop on Java 8 or 11 then you just won't be able to test with Daffodil 4.0.0.
Another option is to just say that if you want to develop the debugger, you now need to be on Java 17+. That's what we've done with the Daffodil project. Note that this is only for development. The 2.x jars would still be built with Java 8 compatibility so users could use them with old versions of Java. And if users want to debug with Daffodil 4.0.0, they just have to be on Java 17+.
Note that regardless of the option, official releases will need to be built on java 17 to build all three jars, so we'll need to set `scalacOptions` for the 2.x platforms to build the jars/classes with Java 8 compatibility and the 3.x jar with java 17 compatibility. I forget the options, but I think Daffodil had them before we dropped Java 8 support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on issue #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352#issuecomment-3356869305
> Maybe it would be helpful to know, what is the path Daffodil is taking to support Daffodil 3 alongside 4?
We don't have any plans to officially support running Daffodil 3.x and 4.x side by side. We leave it up to users to solve the problems related to different jars and API changes if that's something they need. It's not an easy problem to solve and many solutions will want to handle it differently.
For example, with the [NiFi Daffodil Processors](https://github.com/OwlCyberDefense/nifi-daffodil) each .nar release depends on and bundles a single specific version of Daffodil. And NiFi handles classpath separation so that different .nars/versions of the Daffodil processors can all be added to the same NiFi flow.
The latest version of the daffodil-sbt plugin also has support for support building precompiled parsers and testing schemas across many different versions of Daffodil. Those are daffodil version specific though, so I don't think you need anything quite as complicated. It uses reflection and SBT magic which I think you can avoid.
> Is there a good way you guys suggest we support two different versions of our debugger,
I think I would recommend just build separate debugger jars for each version of Scala, so more like option 2, and then have something that downloads Daffodil versions and sets up the classpath with the correct debugger jar. And that would potentially mean three jars--one for Scala 2.12 (Daffodil 3.10.0 and older), one for Scala 2.13 (Daffodil 3.11.0), and one for Scala 3 (Daffodil 4.0.0 and newer).
The easiest way to handle this might be with the [sbt-projectmatrix](https://github.com/sbt/sbt-projectmatrix) plugin. I haven't used this much, but it was used this as inspiration for the daffodil-sbt changes, so I think the idea is pretty solid. This plugin makes it easy to build separate jars with separate versions of Scala. And you can have different dependencies/source directories/settings/etc. for different versions. With some basic testing, this seems to do what I would expect:
```scala
lazy val root = (project in file("."))
.aggregate(debugger.projectRefs: _*)
// the "projectMatrix" leads three separate projects, one for each of the jvmPlatforms
lazy val debugger = (projectMatrix in file("debugger"))
.settings(
name := "debugger",
libraryDependencies ++ Seq(
/* common dependencies */
),
/* other common settings */
)
.jvmPlatform(
scalaVersions = Seq("2.12.20"),
settings = Seq(
libraryDependencies += "org.apache.daffodil" %% "daffodil-japi" % "3.10.0" % "provided",
)
)
.jvmPlatform(
scalaVersions = Seq("2.13.16"),
settings = Seq(
libraryDependencies += "org.apache.daffodil" %% "daffodil-japi" % "3.11.0" % "provided",
)
)
.jvmPlatform(
scalaVersions = Seq("3.3.6"),
settings = Seq(
libraryDependencies += "org.apache.daffodil" %% "daffodil-core" % "4.0.0" % "provided",
)
)
```
This also allows you to have common code in `src/main/scala` and scala-version specific code in other directories. I *think* the debugger API is the same in 3.10.0- and 3.11.0 so that logic can all go in `src/main/scala-2` (which is shared for 2.12 and 2.13 builds). And then the Daffodil 4.0.0+ logic would go in `src/main/scala-3`. Note that I say 3.10.0/3.11.0/4.0.0 logic, but I imagine those directories will just contain small shim classes that support the different package names and minor API differences. I imagine the vast majority of code can be shared as long as your common code builds on all scala versions--that's a bit of work, but I imagine it's not too bad.
When you run sbt package, it builds three separate jars for each of the scala versions:
* debugger/target/jvm-2.13/debugger_2.13-0.1.0-SNAPSHOT.jar
* debugger/target/jvm-2.12/debugger_2.12-0.1.0-SNAPSHOT.jar
* debugger/target/jvm-3/debugger_3-0.1.0-SNAPSHOT.jar
These three jars (and their dependencies) would be packaged in the vsix file, and then the extension would download the appropriate version of Daffodil and set up the classpath to use the right debugger jars and Daffodil jars. I imagine the vsix file might also want to bundle with the latest version of Daffodil prepackaged so it doesn't need the internet to work.
I'm sure things are more complex than that, especially with all the plugins and custom stuff the debugger has, but at it's core I think that's the idea I would go for.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "shanedell (via GitHub)" <gi...@apache.org>.
shanedell closed issue #1352: Update code for Daffodil 4.0.0 API Changes
URL: https://github.com/apache/daffodil-vscode/issues/1352
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "michael-hoke (via GitHub)" <gi...@apache.org>.
michael-hoke commented on issue #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352#issuecomment-3229438871
Look into updating jansi (and possibly other dependencies as well) alongside this. Daffodil 4.0.0 drops support for Java 8 and 11, with a minimum version of 17, so we won't need to keep older dependencies for 8/11 support.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "shanedell (via GitHub)" <gi...@apache.org>.
shanedell commented on issue #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352#issuecomment-3357695016
@stevedlawrence this makes alot of sense. I do have one question, how would be go about making it so that the final `.jvmPlatform` does not get ran if the Java version is say less than Java 11 or something? Or do we not worry about that and it will just fail if the user uses that version?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Update code for Daffodil 4.0.0 API Changes [daffodil-vscode]
Posted by "shanedell (via GitHub)" <gi...@apache.org>.
shanedell commented on issue #1352:
URL: https://github.com/apache/daffodil-vscode/issues/1352#issuecomment-3353789175
@stevedlawrence @mbeckerle Is there a good way you guys suggest we support two different versions of our debugger, one using Daffodil 3 and one using 4? I thought of mostly two ways:
1. Separate out the debugger code into a separate repository, such as `daffodil-vscode-debugger`.
- With this we push up the current debugger code and create release of it that will use Daffodil 3.11.4 and Scala 2.13. So maybe the release would just be uploading the bin zip made from `sbt Universal/packageBin` with a name something like `daffodil-vscode-debugger-<scala-version>-<daffodil-version>.zip`. Once that is released we can update the code to use Daffodil 4.0.0 and Scala 3, then which we create another release, following same naming scheme.
- For the extension we could do something like, when debugging the extension allow downloading the debugger directly from the internet to allow for easier testing of the debugger version. But when we create a release of the VSIX we have it either bundle just one versions of the debugger or both. In either case we may want to allow the extension to be able to run both version of the debugger, possibly adding a launch config setting that allows the user to define which debugger version they want to use.
2. Create a separate folder in our repository and rename the current `debugger` folder.
- So say we would have folders `debugger3` and `debugger4`
- `debugger3` holds the Daffodil 3 and Scala 2.13 code
- `debugger4` holds the Daffodil 4 and Scala 3 code.
- Then similar to the previous situation make the extension able to either bundle with one or both of the debuggers and possibly also allow the extension to let the user chose which version of the debugger they want to run their specific debug instance with.
I think number 1 would make the debugging of the extension easier as then we wouldn't be compiling all the Scala debugger code alongside all the typescript extension code.
What do you guys think would be best? Maybe it would be helpful to what is the path Daffodil is taking to support Daffodil 3 alongside 4?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org