stevedlawrence commented on code in PR #1452:
URL: https://github.com/apache/daffodil-vscode/pull/1452#discussion_r2416959828
##########
debugger/src/templates/bash-template:
##########
@@ -263,10 +269,13 @@ run() {
java_opts="${JAVA_OPTS}"
fi
+ # add daffodil jars to classpath
+ daffodil_version="${daffodil_version:-3.11.0}"
+ daffodil_jars=$(echo
~/.cache/daffodil-debugger/apache-daffodil-${daffodil_version}-bin/lib/*.jar |
sed "s/ /:/g")
+ new_classpath="$app_classpath:$daffodil_jars"
Review Comment:
I think you can avoid the sed stuff by just using a wildcard, which
classpath supports, e.g.:
```bash
daffodil_lib_dir=$(echo
~/.cache/daffodil-debugger/apache-daffodil-${daffodil_version}-bin/lib/)
daffodil_jars="$daffodil_lib_dir/"'*'
new_classpath="$app_classpath:$daffodil_jars"
```
Note that the asterisk is in single quotes so it won't be expanded. The
daffodil bash/bat files do something similar to set up its classpath.
##########
build.sbt:
##########
@@ -221,3 +183,134 @@ lazy val xjcSettings =
cachedFun(Set(daffodilLibJar)).toSeq
}
)
+
+lazy val `daffodil-debugger` = project
+ .in(file("."))
+ .settings(commonSettings, ratSettings)
+ .settings(publish / skip := true)
+ .aggregate(debuggers.projectRefs: _*)
+
+/** Since using projectMatrix, there will be a debugger, debugger2_12 and
debugger3 target. The debugger target is for
+ * Daffodil 3.11.0 and Scala 2.13. The debugger2_12 target is for Daffodil
3.10.0 and Scala 2.12. The debugger3 target
+ * is for Daffodil 4.0.0 and Scala 3. (only availabe when using JDK 17+)
Review Comment:
Maybe reword to say "The debugger2_12 target is for Daffodil 3.10.0 **and
older** and Scala 2.12" and "The debugger3 target is for Daffodil 4.0.0 and
newer and Scala 3". Just to make it clear these targets should for a range of
Daffodil versions?
##########
src/daffodilDebugger/daffodilJars.ts:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as path from 'path'
+import * as fs from 'fs'
+import * as unzip from 'unzip-stream'
+import * as os from 'os'
+import { pipeline } from 'stream/promises'
+
+import { outputChannel } from '../adapter/activateDaffodilDebug'
+
+async function downloadAndExtractDaffodilCLIJars(
+ url: string,
+ targetDir: string
+): Promise<void> {
+ outputChannel.appendLine(
+ `[INFO] Daffodil CLI JARs don't exist. Downloading and extracting...`
+ )
+
+ const res = await fetch(url)
+ if (!res.ok || !res.body) {
+ throw new Error(
+ `Failed to download ${url}: ${res.status} ${res.statusText}`
+ )
+ }
+
+ // Pipe the response body stream into unzip-stream and wait for completion
+ await pipeline(res.body as any, unzip.Extract({ path: targetDir }))
+}
Review Comment:
Might be nice if there wasa progress bar showing download and letting user
cancel. I imagine VS Code has somethign like that already built-in. Could be
especially useful to make it clear that we're actually downloading something
and what were downloading. I imagine some users might be concerned if they run
an extension and notice a fairly large unexpected spike in network traffic.
Doesn't necessarily have to be part of this PR, could be a future update,
but that feels important.
##########
package.json:
##########
@@ -806,6 +822,8 @@
}
},
"dfdlDebugger": {
+ "version": "2.13",
Review Comment:
Should this be 3.11.0?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]