This is an automated email from the ASF dual-hosted git repository.
shanedell pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git
The following commit(s) were added to refs/heads/main by this push:
new ac30773 Create a new build script:
ac30773 is described below
commit ac30773eeed729efff10051f5c219313ce0314e3
Author: Shane Dell <[email protected]>
AuthorDate: Mon Jul 18 15:05:38 2022 -0400
Create a new build script:
- Copies all files that should be in VSIX to a directory (dist/package)
- Copies package LICENSE and NOTICE to (dist/package)
- Copies yarn.local to (dist/package)
- Runs yarn install inside of (dist/package)
- Runs yarn vscde package --out ../../ inside of (dist/package)
Closes #121
---
.github/workflows/CI.yml | 4 +-
README.md | 6 +--
build/package/.vscodeignore | 31 +++++++++++++
build/{bin.LICENSE => package/LICENSE} | 0
build/{bin.NOTICE => package/NOTICE} | 0
build/scripts/package.ts | 81 ++++++++++++++++++++++++++++++++++
build/scripts/process_build.ts | 56 -----------------------
package.json | 14 +++---
8 files changed, 123 insertions(+), 69 deletions(-)
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 3c9db64..c46a682 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -107,9 +107,9 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node}}
- - run: $SBT compile # used to initialize sbt, if not done sbt
universal:packageBin ran by yarn build times out -- windows only
+ - run: $SBT compile # used to initialize sbt, if not done sbt
universal:packageBin ran by yarn package times out -- windows only
if: runner.os == 'Windows'
- run: yarn install
- - run: yarn build
+ - run: yarn package
- run: yarn test
- run: $SBT test
diff --git a/README.md b/README.md
index 63a64e5..6e28850 100644
--- a/README.md
+++ b/README.md
@@ -39,14 +39,14 @@ This is a VS Code extension which enables the interactive
debugging of DFDL sche
Until the extension is available in the [VS Code Extension
Marketplace](https://marketplace.visualstudio.com/vscode), please download the
latest `.vsix` file from the [releases
page](https://github.com/apache/daffodil-vscode/releases).
-## Build VSIX and Debugger
+## Package VSIX and Debugger
:exclamation:**NOT necessary if using prebuilt VSIX**:exclamation:
:exclamation:**NOT necessary if running extension via VS Code without VSIX but
a `yarn install` will be required**:exclamation:
-Run full build
+Run full package
```bash
- yarn build
+ yarn package
```
* This command performs the following tasks:
diff --git a/build/package/.vscodeignore b/build/package/.vscodeignore
new file mode 100644
index 0000000..a0dfa9e
--- /dev/null
+++ b/build/package/.vscodeignore
@@ -0,0 +1,31 @@
+# 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.
+
+*
+*/**
+!dist/ext/extension.js
+!images/*
+!LICENSE
+!NOTICE
+!package.json
+!README.md
+!server/core/target/universal/daffodil-debugger-*.zip
+!language/*
+!language/syntaxes/*
+!src/launchWizard/launchWizard.js
+!src/styles/styles.css
+!src/omega_edit/omega_edit.js
+!src/omega_edit/interface.html
+!src/omega_edit/omega-edit-scala-server*.zip
diff --git a/build/bin.LICENSE b/build/package/LICENSE
similarity index 100%
rename from build/bin.LICENSE
rename to build/package/LICENSE
diff --git a/build/bin.NOTICE b/build/package/NOTICE
similarity index 100%
rename from build/bin.NOTICE
rename to build/package/NOTICE
diff --git a/build/scripts/package.ts b/build/scripts/package.ts
new file mode 100644
index 0000000..ab4df08
--- /dev/null
+++ b/build/scripts/package.ts
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+// @ts-nocheck <-- This is needed as this file is basically a JavaScript script
+// but with some TypeScript niceness baked in
+const fs = require('fs')
+const path = require('path')
+const glob = require('glob')
+const execSync = require('child_process').execSync
+const pkg_dir = 'dist/package'
+
+async function copyGlob(pattern, dir = '.') {
+ glob(pattern, { cwd: dir }, (error, files) => {
+ for (var i = 0; i < files.length; i++) {
+ let src = path.join(dir, files[i])
+ let dst = path.join(pkg_dir, files[i])
+ let dstDir = path.dirname(dst)
+
+ fs.mkdirSync(dstDir, { recursive: true })
+
+ if (fs.statSync(src).isFile()) {
+ fs.copyFileSync(src, dst)
+ }
+ }
+ })
+}
+
+// Setup package directory
+function setup() {
+ if (fs.existsSync(pkg_dir)) {
+ fs.rmdirSync(pkg_dir, { recursive: true })
+ }
+
+ fs.mkdirSync(pkg_dir)
+
+ let lines = fs
+ .readFileSync('build/package/.vscodeignore')
+ .toString()
+ .split('\n')
+
+ // Copy all files listed in the .vscodeignore
+ for (var i = 0; i < lines.length; i++) {
+ var line = lines[i]
+
+ if (!line.startsWith('!')) continue
+
+ let pattern = line.substring(1).trim()
+
+ copyGlob(pattern)
+ }
+
+ // Copy required package files into package directory
+ copyGlob('{.,}*', 'build/package') // include hidden files
+
+ fs.copyFileSync('yarn.lock', `${pkg_dir}/yarn.lock`)
+}
+
+// Create VSIX package
+function create() {
+ execSync('yarn install', { cwd: pkg_dir })
+ execSync('yarn vsce package --out ../../', { cwd: pkg_dir })
+}
+
+module.exports = {
+ setup: setup,
+ create: create,
+}
diff --git a/build/scripts/process_build.ts b/build/scripts/process_build.ts
deleted file mode 100644
index 01b8685..0000000
--- a/build/scripts/process_build.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-// @ts-nocheck <-- This is needed as this file is basically a JavaScript script
-// but with some TypeScript niceness baked in
-const fs = require('fs')
-const execSync = require('child_process').execSync
-
-function prebuild() {
- fs.renameSync('LICENSE', 'tmp.LICENSE')
- fs.renameSync('NOTICE', 'tmp.NOTICE')
- fs.copyFileSync('build/bin.NOTICE', 'NOTICE')
- fs.copyFileSync('build/bin.LICENSE', 'LICENSE')
-}
-
-function postbuild() {
- fs.rmSync('LICENSE')
- fs.rmSync('NOTICE')
- fs.renameSync('tmp.LICENSE', 'LICENSE')
- fs.renameSync('tmp.NOTICE', 'NOTICE')
-
- // This will make sure that if the root LICENSE and NOTICE are the same as
the build LICENSE
- // and NOTICE that they are reverted back to their original contents.
- if (
- fs.readFileSync('build/bin.LICENSE').toString() ===
- fs.readFileSync('LICENSE').toString()
- ) {
- execSync('git checkout LICENSE')
- }
-
- if (
- fs.readFileSync('build/bin.NOTICE').toString() ===
- fs.readFileSync('NOTICE').toString()
- ) {
- execSync('git checkout NOTICE')
- }
-}
-
-module.exports = {
- postbuild: postbuild,
- prebuild: prebuild,
-}
diff --git a/package.json b/package.json
index dc2171c..e5de620 100644
--- a/package.json
+++ b/package.json
@@ -25,21 +25,19 @@
},
"scripts": {
"omega-edit-download": "node -e
\"require('./build/scripts/omega_edit_download.ts').downloadServer()\"",
- "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 ./ && yarn omega-edit-download",
"lint": "yarn run prettier src -c",
"watch": "yarn omega-edit-download && webpack --watch --devtool
nosources-source-map --config ./build/extension.webpack.config.js",
"watch2": "tsc -watch -p ./",
- "package": "vsce package",
- "publish": "vsce publish",
- "package-ext": "webpack --mode production --config
./build/extension.webpack.config.js",
+ "webpack": "webpack --mode production --config
./build/extension.webpack.config.js",
+ "prepackage": "yarn sbt && yarn install && yarn compile && yarn
webpack",
+ "package": "yarn package-setup && yarn package-create",
+ "package-setup": "node -e
\"require('./build/scripts/package.ts').setup()\"",
+ "package-create": "node -e
\"require('./build/scripts/package.ts').create()\"",
"pretest": "yarn run compile",
"test": "node node_modules/mocha/bin/_mocha -u tdd --timeout 999999
--colors ./out/tests",
- "sbt": "sbt universal:packageBin",
- "prebuild": "node -e
\"require('./build/scripts/process_build.ts').prebuild()\"",
- "build": "yarn sbt && yarn install && yarn compile && yarn package",
- "postbuild": "node -e
\"require('./build/scripts/process_build.ts').postbuild()\""
+ "sbt": "sbt universal:packageBin"
},
"dependencies": {
"@grpc/grpc-js": "^1.5.4",