Skip to content
Permalink
Browse files
Monorepo extension and backend. (#76)
Monorepo of Typescript extension with Scala backend

* Prototype monorepo of Typescript extension with Scala backend.
* move scala source under server/core
* server build as submodules
* add daffodil to the artifact name
* Supply current version in src/version.ts via prebuild script.
* Download debugger backend that matches extension version.
* change repo from debug to vscode
* Fix location of dapodil bin folder
* ensure version matches the tag being pushed

Co-authored-by: John Wass <wassj@ctc.com>
Co-authored-by: Shane Dell <shanedell100@gmail.com>
  • Loading branch information
3 people committed Aug 20, 2021
1 parent f9aed6f commit 0e5676267f3f57e557e0598845c80a4a1761b05e
Showing 19 changed files with 1,761 additions and 68 deletions.
@@ -12,10 +12,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Export tag to env
- name: Export git tag and package.json version
run: |
GIT_TAG=$(echo ${GITHUB_REF#refs/*/} | cut -d 'v' -f 2)
LIB_VERSION=$(echo $(node -p "JSON.stringify(require('./package.json').version)") | sed 's|"||g')
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
echo "LIB_VERSION=$LIB_VERSION" >> $GITHUB_ENV
- name: Check if git tag matches package version
run: if [[ ${{env.GIT_TAG}} != ${{env.LIB_VERSION}} ]]; then exit 1; else exit 0; fi
shell: bash

- name: Create backend package
run: |
sbt universal:packageBin
- name: Setup node
uses: actions/setup-node@v1
@@ -24,7 +34,10 @@ jobs:

- name: Install dependencies
run: yarn install


- name: Yarn Compile
run: yarn compile

- name: Create vsix
run: |
yarn run package -o daffodil-debug-${{env.GIT_TAG}}.vsix
@@ -36,3 +49,4 @@ jobs:
prerelease: false
files: |
${{github.workspace}}/daffodil-debug-${{env.GIT_TAG}}.vsix
${{github.workspace}}/server/core/target/universal/daffodil-debugger-*.zip
@@ -22,5 +22,7 @@ jobs:
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: sbt compile
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
@@ -9,3 +9,9 @@ daffodil-debug.txt
daffodil-debugger*
*.debug
datafile-hex
.idea


target
.bsp
src/version.ts
@@ -0,0 +1,3 @@
version = "2.3.2"
maxColumn = 120
rewrite.rules = [SortImports, RedundantBraces]
@@ -7,5 +7,8 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"files.watcherExclude": {
"**/target": true
}
}
@@ -11,4 +11,9 @@ node_modules
tsconfig.json
out
sampleWebWorkerWorkspace
sampleWorkspace
sampleWorkspace

# sbt directories
target
server
project
@@ -0,0 +1,41 @@
lazy val daffodilVer = "3.1.0"

lazy val commonSettings = {
Seq(
organization := "org.apache.daffodil",
scalaVersion := "2.12.13",
scalacOptions ++= Seq("-Ypartial-unification"),
git.useGitDescribe := true,
libraryDependencies ++= Seq(
"org.apache.daffodil" %% "daffodil-sapi" % daffodilVer,
"org.apache.daffodil" %% "daffodil-runtime1" % daffodilVer,
)
)
}

lazy val commonPlugins = Seq(BuildInfoPlugin, GitVersioning, JavaAppPackaging, UniversalPlugin)

lazy val `daffodil-debugger` = project
.in(file("."))
.settings(commonSettings)
.settings(publish / skip := true)
.dependsOn(core)
.aggregate(core)

lazy val core = project
.in(file("server/core"))
.settings(commonSettings)
.settings(
name := "daffodil-debugger",
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.microsoft.java" % "com.microsoft.java.debug.core" % "0.31.1",
"co.fs2" %% "fs2-io" % "3.0.4",
"com.monovore" %% "decline-effect" % "2.1.0",
"org.typelevel" %% "log4cats-slf4j" % "2.1.0",
),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, "daffodilVersion" -> daffodilVer),
buildInfoPackage := "org.apache.daffodil.debugger.dap",
packageName := s"${name.value}-$daffodilVer",
)
.enablePlugins(commonPlugins: _*)
@@ -1,4 +1,5 @@
#!/bin/bash
yarn install
yarn compile
yarn vscode:prepublish
yarn package
@@ -25,6 +25,7 @@
},
"scripts": {
"vscode:prepublish": "yarn run package-ext",
"precompile": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
"compile": "tsc -p ./",
"lint": "eslint src --ext ts",
"watch": "webpack --watch --devtool nosources-source-map --info-verbosity verbose --config ./build/extension.webpack.config.js",
@@ -207,11 +208,6 @@
"type": "boolean",
"description": "Enable connection to running DAP Server",
"default": false
},
"dapodilVersion": {
"type": "string",
"description": "Version of the dapoil debugger to run/use",
"default": ""
}
}
}
@@ -224,7 +220,6 @@
"program": "${command:AskForProgramName}",
"stopOnEntry": true,
"data": "${command:AskForDataName}",
"dapodilVersion": "v0.0.9-1",
"infosetOutput": {
"type": "file",
"path": "${workspaceFolder}/infoset.xml"
@@ -243,7 +238,6 @@
"program": "^\"\\${command:AskForProgramName}\"",
"stopOnEntry": true,
"data": "^\"\\${command:AskForDataName}\"",
"dapodilVersion": "v0.0.9-1",
"infosetOutput": {
"type": "file",
"path": "${workspaceFolder}/infoset.xml"
@@ -0,0 +1 @@
sbt.version = 1.5.1
@@ -0,0 +1,4 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17")
@@ -16,8 +16,7 @@
},
"stopOnEntry": true,
"trace": false,
"debugServer": 4711,
"dapodilVersion": "v0.0.12"
"debugServer": 4711
}
]
}
@@ -0,0 +1,26 @@
package org.apache.daffodil.debugger.dap

import java.net.URI
import cats.effect.IO
import cats.syntax.all._
import org.apache.daffodil.sapi._

trait Compiler {
def compile(schema: URI): IO[DataProcessor]
}

object Compiler {
def apply(): Compiler =
new Compiler {
def compile(schema: URI): IO[DataProcessor] =
IO.blocking(
Daffodil
.compiler()
.compileSource(schema)
).ensureOr(pf => CompilationFailed(pf.getDiagnostics))(!_.isError)
.map(_.onPath("/"))
}

case class CompilationFailed(seq: Seq[Diagnostic])
extends Exception(seq.map(_.toString).mkString(", "))
}

0 comments on commit 0e56762

Please sign in to comment.