diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml new file mode 100644 index 0000000..9b27183 --- /dev/null +++ b/.github/actions/build-electron/action.yml @@ -0,0 +1,65 @@ +name: 'Electron build' +description: 'Electron build' +inputs: + electron: + description: 'Electron version' + required: true + os: + description: 'runs-on' + required: false + default: 'windows-2022' + +runs: + using: "composite" + steps: + + - name: Setup env + uses: ./.github/actions/setup-env + with: + electron: '${{ inputs.electron }}.0.0' + os: ${{ inputs.os }} + + - name: install node-gyp + shell: bash + run: npm i -g node-gyp + + - name: Create release folder + shell: cmd + run: | + mkdir "release\ia32\${{ inputs.electron }}.0.0" + mkdir "release\x64\${{ inputs.electron }}.0.0" + mkdir "release\arm64\${{ inputs.electron }}.0.0" + + - name: Cache node-gyp + uses: actions/cache@v4 + env: + cache-name: cache-node-gyp + with: + path: ~\AppData\Local\node-gyp\Cache + key: '${{ inputs.electron }}.0.0' + + - name: Build ia32 + uses: ./.github/actions/build + with: + electron: ${{ inputs.electron }} + arch: 'ia32' + + - name: Build x64 + uses: ./.github/actions/build + with: + electron: ${{ inputs.electron }} + arch: 'x64' + + - name: Build arm64 + uses: ./.github/actions/build + with: + electron: ${{ inputs.electron }} + arch: 'arm64' + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: success() + with: + name: electron-edge-js-${{ inputs.electron }}.0.0 + path: | + release diff --git a/.github/actions/create-test-report/action.yml b/.github/actions/create-test-report/action.yml index 4b780f9..c122f40 100644 --- a/.github/actions/create-test-report/action.yml +++ b/.github/actions/create-test-report/action.yml @@ -17,7 +17,7 @@ runs: steps: - name: "Merge test files" shell: bash - run: node tools/mergeTests.js + run: node tools/mergeTests.js ${{ inputs.electron }} - name: Read mochawesome.json uses: actions/github-script@v7 @@ -47,6 +47,7 @@ runs: path: | test/mochawesome-report/mochawesome.json test/mochawesome-report/mochawesome.html + test/mochawesome-report/assets/ - name: Create test report uses: phoenix-actions/test-reporting@v15 diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index bce2b7f..afd5225 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -9,86 +9,236 @@ env: DOTNET_NOLOGO: 1 jobs: - build: - runs-on: ${{ matrix.os }} + + build-29: + runs-on: windows-2022 + timeout-minutes: 20 strategy: - # fail-fast: false - matrix: - electron: [29, 30, 31, 32, 33] - # electron: [32, 33] - os: [windows-2022] + fail-fast: false + outputs: + electron: ${{ steps.electron-version.outputs.electron }} - name: build ${{ matrix.os }}-electron-${{ matrix.electron }} + name: build electron-29.0.0 steps: - name: Checkout code uses: actions/checkout@v4 - - - name: Setup env - uses: ./.github/actions/setup-env + + - name: Build Electron 29.0.0 + uses: ./.github/actions/build-electron with: - electron: '${{ matrix.electron }}.0.0' - os: ${{ matrix.os }} - - - name: install node-gyp - run: npm i -g node-gyp + electron: 29 + os: ${{ runner.os }} - - name: Create release folder + - name: Get latest Electron version for 29.0.0 + id: electron-version + shell: bash run: | - mkdir "release\ia32\${{ matrix.electron }}.0.0" - mkdir "release\x64\${{ matrix.electron }}.0.0" - mkdir "release\arm64\${{ matrix.electron }}.0.0" + node tools/getVersion.js 29 + echo "electron=$(cat electron.txt)" >> $GITHUB_OUTPUT - - name: Build ia32 - timeout-minutes: 30 - uses: ./.github/actions/build - with: - electron: ${{ matrix.electron }} - arch: 'ia32' + build-30: + runs-on: windows-2022 + timeout-minutes: 20 + strategy: + fail-fast: false + outputs: + electron: ${{ steps.electron-version.outputs.electron }} + + name: build electron-30.0.0 + steps: - - name: Build x64 - timeout-minutes: 30 - uses: ./.github/actions/build - with: - electron: ${{ matrix.electron }} - arch: 'x64' + - name: Checkout code + uses: actions/checkout@v4 - - name: Build arm64 - timeout-minutes: 30 - uses: ./.github/actions/build + - name: Build Electron 30.0.0 + uses: ./.github/actions/build-electron with: - electron: ${{ matrix.electron }} - arch: 'arm64' - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - if: success() + electron: 30 + os: ${{ runner.os }} + + - name: Get latest Electron version for 30.0.0 + id: electron-version + shell: bash + run: | + node tools/getVersion.js 30 + echo "electron=$(cat electron.txt)" >> $GITHUB_OUTPUT + + build-31: + runs-on: windows-2022 + timeout-minutes: 20 + strategy: + fail-fast: false + outputs: + electron: ${{ steps.electron-version.outputs.electron }} + + name: build electron-31.0.0 + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Electron 31.0.0 + uses: ./.github/actions/build-electron with: - name: electron-edge-js-${{ matrix.electron }}.0.0 - path: | - release + electron: 31 + os: ${{ runner.os }} - electron-versions: - runs-on: ubuntu-22.04 + - name: Get latest Electron version for 31.0.0 + id: electron-version + shell: bash + run: | + node tools/getVersion.js 31 + echo "electron=$(cat electron.txt)" >> $GITHUB_OUTPUT + + build-32: + runs-on: windows-2022 + timeout-minutes: 20 + strategy: + fail-fast: false outputs: - matrix: ${{ steps.electron-test-versions.outputs.matrix }} + electron: ${{ steps.electron-version.outputs.electron }} + + name: build electron-32.0.0 + steps: - needs: build - name: electron-versions + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Electron 32.0.0 + uses: ./.github/actions/build-electron + with: + electron: 32 + os: ${{ runner.os }} + + - name: Get latest Electron version for 32.0.0 + id: electron-version + shell: bash + run: | + node tools/getVersion.js 32 + echo "electron=$(cat electron.txt)" >> $GITHUB_OUTPUT + + build-33: + runs-on: windows-2022 + timeout-minutes: 20 + strategy: + fail-fast: false + outputs: + electron: ${{ steps.electron-version.outputs.electron }} + + name: build electron-33.0.0 steps: - - name: Electron versions + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Electron 33.0.0 + uses: ./.github/actions/build-electron + with: + electron: 33 + os: ${{ runner.os }} + + - name: Get latest Electron version for 33.0.0 + id: electron-version shell: bash - id: electron-test-versions - run: echo "matrix={'include':[{'electron':'29.4.6', 'os':'windows-2022'},{'electron':'30.5.1', 'os':'windows-2022'},{'electron':'31.7.5', 'os':'windows-2022'},{'electron':'32.2.5', 'os':'windows-2022'},{'electron':'33.2.0', 'os':'windows-2022'}]}" >> $GITHUB_OUTPUT + run: | + node tools/getVersion.js 33 + echo "electron=$(cat electron.txt)" >> $GITHUB_OUTPUT + + test-29: + strategy: + fail-fast: false + matrix: + os: [windows-2022] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + needs: build-29 + + name: test ${{ matrix.os }}-v${{needs.build-29.outputs.electron}} + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Test build + uses: ./.github/actions/test-build + with: + electron: ${{ needs.build-29.outputs.electron }} + os: ${{ matrix.os }} + + test-30: + strategy: + fail-fast: false + matrix: + os: [windows-2022] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + needs: build-30 + + name: test ${{ matrix.os }}-v${{needs.build-30.outputs.electron}} + steps: + + - name: Checkout code + uses: actions/checkout@v4 - test: + - name: Test build + uses: ./.github/actions/test-build + with: + electron: ${{ needs.build-30.outputs.electron }} + os: ${{ matrix.os }} + + test-31: + strategy: + fail-fast: false + matrix: + os: [windows-2022] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + needs: build-31 + + name: test ${{ matrix.os }}-v${{needs.build-31.outputs.electron}} + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Test build + uses: ./.github/actions/test-build + with: + electron: ${{ needs.build-31.outputs.electron }} + os: ${{ matrix.os }} + + test-32: + strategy: + fail-fast: false + matrix: + os: [windows-2022] + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + needs: build-32 + + name: test ${{ matrix.os }}-v${{needs.build-32.outputs.electron}} + steps: + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Test build + uses: ./.github/actions/test-build + with: + electron: ${{ needs.build-32.outputs.electron }} + os: ${{ matrix.os }} + + test-33: strategy: - matrix: ${{ fromJSON(needs.electron-versions.outputs.matrix) }} + fail-fast: false + matrix: + os: [windows-2022] runs-on: ${{ matrix.os }} - needs: electron-versions - # fail-fast: false + timeout-minutes: 10 + needs: build-33 - name: test ${{ matrix.os }}-v${{ matrix.electron }} + name: test ${{ matrix.os }}-v${{needs.build-33.outputs.electron}} steps: - name: Checkout code @@ -97,7 +247,6 @@ jobs: - name: Test build uses: ./.github/actions/test-build with: - electron: ${{ matrix.electron }} + electron: ${{ needs.build-33.outputs.electron }} os: ${{ matrix.os }} - \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73e1b77..64144b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,41 +31,31 @@ env: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: windows-2022 outputs: test-version: ${{ steps.electron-test-version.outputs.test-version }} strategy: - # fail-fast: false - matrix: - os: [windows-2022] + fail-fast: true - name: build ${{ matrix.os }}-electron-${{ inputs.build-version }} + name: build electron-${{ inputs.build-version }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Resolve Electron version from major - id: electron-test-version - shell: bash - run: | - if [[ ${{ inputs.build-version }} == '29' ]]; then - echo "test-version=29.4.6" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '30' ]]; then - echo "test-version=30.5.1" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '31' ]]; then - echo "test-version=31.7.5" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '32' ]]; then - echo "test-version=32.2.5" >> $GITHUB_OUTPUT - elif [[ ${{ inputs.build-version }} == '33' ]]; then - echo "test-version=33.2.0" >> $GITHUB_OUTPUT - fi - - name: Setup env uses: ./.github/actions/setup-env with: electron: '${{ inputs.build-version }}.0.0' - os: ${{ matrix.os }} + os: ${{ runner.os }} + + - name: Get latest Electron version for ${{ inputs.build-version }}.0.0 + id: electron-test-version + shell: bash + run: | + node tools/getVersion.js ${{ inputs.build-version }} + echo "test-version=$(cat electron.txt)" >> $GITHUB_OUTPUT + - name: install node-gyp run: npm i -g node-gyp @@ -76,6 +66,14 @@ jobs: mkdir "release\x64\${{ inputs.build-version }}.0.0" mkdir "release\arm64\${{ inputs.build-version }}.0.0" + - name: Cache node-gyp + uses: actions/cache@v4 + env: + cache-name: cache-node-gyp + with: + path: ~\AppData\Local\node-gyp\Cache + key: '${{ inputs.build-version }}.0.0' + - name: Build ia32 timeout-minutes: 30 uses: ./.github/actions/build diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88726a5..ffa3b4a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -84,8 +84,7 @@ jobs: os: [macos-13, macos-14, ubuntu-22.04, windows-2022] # os: [ macos-14, ubuntu-22.04] # electron: [32.1.2] - electron: [29.4.6, 30.5.1, 31.7.5, 32.2.5, 33.2.0] - # electron: [31.6.0, 32.1.0] + electron: [29.4.6, 30.5.1, 31.7.5, 32.2.6, 33.2.1] name: test-${{ matrix.os }}-v${{ matrix.electron }} steps: diff --git a/.npmignore b/.npmignore index 2bcafbb..631bbc8 100644 --- a/.npmignore +++ b/.npmignore @@ -107,4 +107,5 @@ mochawesome.json *.sln xunit*.* getVersion*.js -*.vcxproj \ No newline at end of file +*.vcxproj +getVersion*.js \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 69d4be8..21aad1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "devDependencies": { "electron": "^33.2.0", "follow-redirects": "^1.15.9", + "isomorphic-git": "^1.27.2", "mocha": "10.8.2", "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0", @@ -178,6 +179,13 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/async-lock": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.4.1.tgz", + "integrity": "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==", + "dev": true, + "license": "MIT" + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -332,6 +340,13 @@ "fsevents": "~2.3.2" } }, + "node_modules/clean-git-ref": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/clean-git-ref/-/clean-git-ref-2.0.1.tgz", + "integrity": "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -380,6 +395,19 @@ "dev": true, "license": "MIT" }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/dateformat": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", @@ -512,6 +540,13 @@ "node": ">=0.3.1" } }, + "node_modules/diff3": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/diff3/-/diff3-0.0.3.tgz", + "integrity": "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g==", + "dev": true, + "license": "MIT" + }, "node_modules/edge-cs": { "name": "@agracio/edge-cs", "version": "1.3.7", @@ -1016,6 +1051,16 @@ "node": ">=10.19.0" } }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1104,6 +1149,33 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isomorphic-git": { + "version": "1.27.2", + "resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.27.2.tgz", + "integrity": "sha512-nCiz+ieOkWb5kDJSSckDTiMjTcgkxqH2xuiQmw1Y6O/spwx4d6TKYSfGCd4f71HGvUYcRSUGqJEI+3uN6UQlOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-lock": "^1.4.1", + "clean-git-ref": "^2.0.1", + "crc-32": "^1.2.0", + "diff3": "0.0.3", + "ignore": "^5.1.4", + "minimisted": "^2.0.0", + "pako": "^1.0.10", + "path-browserify": "^1.0.1", + "pify": "^4.0.1", + "readable-stream": "^3.4.0", + "sha.js": "^2.4.9", + "simple-get": "^4.0.1" + }, + "bin": { + "isogit": "cli.cjs" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1275,6 +1347,26 @@ "node": ">=10" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimisted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minimisted/-/minimisted-2.0.1.tgz", + "integrity": "sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + } + }, "node_modules/mocha": { "version": "10.8.2", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", @@ -1776,6 +1868,20 @@ "node": ">=6" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true, + "license": "MIT" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1813,6 +1919,16 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -1870,6 +1986,21 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -2002,6 +2133,67 @@ "dev": true, "license": "ISC" }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", @@ -2009,6 +2201,16 @@ "dev": true, "optional": true }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -2129,6 +2331,13 @@ "node": ">= 4.0.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -2388,6 +2597,12 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "async-lock": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.4.1.tgz", + "integrity": "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==", + "dev": true + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2499,6 +2714,12 @@ "readdirp": "~3.6.0" } }, + "clean-git-ref": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/clean-git-ref/-/clean-git-ref-2.0.1.tgz", + "integrity": "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw==", + "dev": true + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -2540,6 +2761,12 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true + }, "dateformat": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", @@ -2629,6 +2856,12 @@ "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true }, + "diff3": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/diff3/-/diff3-0.0.3.tgz", + "integrity": "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g==", + "dev": true + }, "edge-cs": { "version": "npm:@agracio/edge-cs@1.3.7", "resolved": "https://registry.npmjs.org/@agracio/edge-cs/-/edge-cs-1.3.7.tgz", @@ -2982,6 +3215,12 @@ "resolve-alpn": "^1.0.0" } }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -3046,6 +3285,26 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "isomorphic-git": { + "version": "1.27.2", + "resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.27.2.tgz", + "integrity": "sha512-nCiz+ieOkWb5kDJSSckDTiMjTcgkxqH2xuiQmw1Y6O/spwx4d6TKYSfGCd4f71HGvUYcRSUGqJEI+3uN6UQlOw==", + "dev": true, + "requires": { + "async-lock": "^1.4.1", + "clean-git-ref": "^2.0.1", + "crc-32": "^1.2.0", + "diff3": "0.0.3", + "ignore": "^5.1.4", + "minimisted": "^2.0.0", + "pako": "^1.0.10", + "path-browserify": "^1.0.1", + "pify": "^4.0.1", + "readable-stream": "^3.4.0", + "sha.js": "^2.4.9", + "simple-get": "^4.0.1" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3184,6 +3443,21 @@ "brace-expansion": "^2.0.1" } }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "minimisted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minimisted/-/minimisted-2.0.1.tgz", + "integrity": "sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "mocha": { "version": "10.8.2", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", @@ -3555,6 +3829,18 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3579,6 +3865,12 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -3627,6 +3919,17 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -3722,6 +4025,33 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true + }, + "simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", @@ -3729,6 +4059,15 @@ "dev": true, "optional": true }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -3816,6 +4155,12 @@ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index b17434e..7ce9daa 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "devDependencies": { "electron": "^33.2.0", "follow-redirects": "^1.15.9", + "isomorphic-git": "^1.27.2", "mocha": "10.8.2", "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0", diff --git a/src/double/Edge.js/Edge.js.csproj b/src/double/Edge.js/Edge.js.csproj index ad283bd..748b21f 100644 --- a/src/double/Edge.js/Edge.js.csproj +++ b/src/double/Edge.js/Edge.js.csproj @@ -62,6 +62,6 @@ - + diff --git a/src/double/Edge.js/dotnetcore/coreclrembedding.cs b/src/double/Edge.js/dotnetcore/coreclrembedding.cs index b7cc41f..c3ac81c 100644 --- a/src/double/Edge.js/dotnetcore/coreclrembedding.cs +++ b/src/double/Edge.js/dotnetcore/coreclrembedding.cs @@ -249,8 +249,6 @@ private void AddDependencies(DependencyContext dependencyContext, bool standalon AddCompileDependencies(dependencyContext, standalone); - var runtimePath = Path.GetDirectoryName(RuntimeEnvironment.RuntimePath); - foreach (RuntimeLibrary runtimeLibrary in dependencyContext.RuntimeLibraries) { DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing runtime dependency {1} {0}", runtimeLibrary.Name, runtimeLibrary.Type); @@ -259,12 +257,15 @@ private void AddDependencies(DependencyContext dependencyContext, bool standalon { DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added runtime assembly {1} from {0}", CompileAssemblies[runtimeLibrary.Name], runtimeLibrary.Name); _libraries[runtimeLibrary.Name] = CompileAssemblies[runtimeLibrary.Name]; + AddNativeAssemblies(dependencyContext, runtimeLibrary); + AddSupplementaryRuntime(runtimeLibrary); + continue; + } if (_libraries.ContainsKey(runtimeLibrary.Name) && CompileAssemblies.ContainsKey(runtimeLibrary.Name)) { - AddNativeAssemblies(dependencyContext, runtimeLibrary); - AddSupplementaryRuntime(runtimeLibrary); + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Already present in the runtime assemblies list, skipping"); continue; } @@ -278,25 +279,8 @@ private void AddDependencies(DependencyContext dependencyContext, bool standalon if (assets.Any()) { string assetPath = assets[0]; - - string assemblyPath; - if(runtimeLibrary.Type == "project") - assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, assetPath); - else if (standalone) - assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(assetPath)); - else - { - assemblyPath = Path.Combine(_packagesPath, runtimeLibrary.Name.ToLower(), runtimeLibrary.Version, assetPath.Replace('/', Path.DirectorySeparatorChar).ToLower()); - if(!File.Exists(assemblyPath)) - assemblyPath = Path.Combine(_packagesPath, runtimeLibrary.Name.ToLower(), runtimeLibrary.Version, assetPath.Replace('/', Path.DirectorySeparatorChar)); - - } - string libraryNameFromPath = Path.GetFileNameWithoutExtension(assemblyPath); - - if (!File.Exists(assemblyPath) && !string.IsNullOrEmpty(runtimePath)) - { - assemblyPath = Path.Combine(runtimePath, Path.GetFileName(assemblyPath)); - } + + var assemblyPath = ResolveAssemblyPath(assetPath, runtimeLibrary.Version, runtimeLibrary.Type, standalone); if (!_libraries.ContainsKey(runtimeLibrary.Name)) { @@ -305,12 +289,7 @@ private void AddDependencies(DependencyContext dependencyContext, bool standalon _libraries[runtimeLibrary.Name] = assemblyPath; DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added runtime assembly {1} from {0}", assemblyPath, runtimeLibrary.Name); CompileAssemblies.TryAdd(runtimeLibrary.Name, assemblyPath); - if (!string.Equals(runtimeLibrary.Name, libraryNameFromPath, StringComparison.CurrentCultureIgnoreCase)) - { - _libraries.TryAdd(libraryNameFromPath, assemblyPath); - CompileAssemblies.TryAdd(libraryNameFromPath, assemblyPath); - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added supplementary runtime assembly {1} from {0}", assemblyPath, libraryNameFromPath); - } + AddSupplementaryRuntime(runtimeLibrary); } else { @@ -332,6 +311,52 @@ private void AddDependencies(DependencyContext dependencyContext, bool standalon AddNativeAssemblies(dependencyContext, runtimeLibrary); } } + + private string ResolveAssemblyPath(string libraryName, string libraryVersion, string libraryType, bool standalone) + { + var runtimePath = Path.GetDirectoryName(RuntimeEnvironment.RuntimePath); + var assemblyPath = libraryName.Replace('/', Path.DirectorySeparatorChar); + var normalizedPath = libraryName.Replace('/', Path.DirectorySeparatorChar); + + if (libraryType == "project") + { + assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)); + } + if (standalone) + { + if (File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)))) + { + assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)); + } + else if (File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, "refs", Path.GetFileName(normalizedPath)))) + { + assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, "refs", Path.GetFileName(normalizedPath)); + } + else if(!string.IsNullOrEmpty(runtimePath)) + { + assemblyPath = Path.Combine(runtimePath, Path.GetFileName(normalizedPath)); + } + } + else + { + assemblyPath = Path.Combine(_packagesPath, libraryName.ToLower(), libraryVersion, normalizedPath.ToLower()); + if(!File.Exists(assemblyPath)) + { + assemblyPath = Path.Combine(_packagesPath, libraryName.ToLower(), libraryVersion, normalizedPath); + } + if(!File.Exists(assemblyPath) && File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)))) + { + assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)); + } + } + + if (!File.Exists(assemblyPath) && !string.IsNullOrEmpty(runtimePath)) + { + assemblyPath = Path.Combine(runtimePath, Path.GetFileName(assemblyPath)); + } + + return assemblyPath; + } private void AddSupplementaryRuntime(RuntimeLibrary runtimeLibrary) { @@ -360,6 +385,10 @@ private void AddNativeAssemblies(DependencyContext dependencyContext, RuntimeLib { nativeAssemblyPath = Path.Combine(runtimePath, nativeAssembly.Replace('/', Path.DirectorySeparatorChar)); } + if (!File.Exists(nativeAssemblyPath) && !string.IsNullOrEmpty(runtimePath)) + { + nativeAssemblyPath = Path.Combine(runtimePath, Path.GetFileName(nativeAssembly.Replace('/', Path.DirectorySeparatorChar))); + } if (File.Exists(nativeAssemblyPath)) { @@ -379,7 +408,7 @@ private void AddDependencyFromRuntime(RuntimeLibrary runtimeLibrary) if (CompileAssemblies.ContainsKey(runtimeLibrary.Name) && _libraries.ContainsKey(runtimeLibrary.Name)) return; var runtimePath = Path.GetDirectoryName(RuntimeEnvironment.RuntimePath); - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing dependency {1} {0} using runtime path {2}", runtimeLibrary.Name, runtimeLibrary.Type, runtimePath); + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing runtime dependency {1} {0} using runtime path {2}", runtimeLibrary.Name, runtimeLibrary.Type, runtimePath); if (string.IsNullOrEmpty(runtimePath)) { DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - runtime path could not be resolved, skipping"); @@ -387,20 +416,7 @@ private void AddDependencyFromRuntime(RuntimeLibrary runtimeLibrary) } var asset = runtimeLibrary.Name; - if (!asset.EndsWith(".dll") && !asset.EndsWith(".sni")) - { - asset += ".dll"; - } - - if (asset == "runtime.native.System.dll") - { - asset = "System.dll"; - } - - if (asset == "NETStandard.Library.dll") - { - asset = "netstandard.dll"; - } + asset = ReplaceAssetName(asset); var assemblyPath = Path.Combine(runtimePath, Path.GetFileName(asset)); if (File.Exists(assemblyPath)) @@ -408,39 +424,23 @@ private void AddDependencyFromRuntime(RuntimeLibrary runtimeLibrary) CompileAssemblies.TryAdd(runtimeLibrary.Name, assemblyPath); _libraries.TryAdd(runtimeLibrary.Name, assemblyPath); - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added dependency {1} from {0}", assemblyPath, runtimeLibrary.Name); - - var libraryNameFromPath = Path.GetFileNameWithoutExtension(assemblyPath); - if (!string.Equals(runtimeLibrary.Name, libraryNameFromPath, StringComparison.CurrentCultureIgnoreCase)) - { - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added supplementary assembly {1} from {0}", assemblyPath, libraryNameFromPath); - CompileAssemblies.TryAdd(libraryNameFromPath, assemblyPath); - _libraries.TryAdd(libraryNameFromPath, assemblyPath); - } + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added runtime dependency {1} from {0}", assemblyPath, runtimeLibrary.Name); + AddSupplementaryRuntime(runtimeLibrary); } else { - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Could not add dependency {0}", assemblyPath); + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Could not runtime add dependency {0}", assemblyPath); } - } private void AddDependencyFromAppDirectory(RuntimeLibrary runtimeLibrary) { if (CompileAssemblies.ContainsKey(runtimeLibrary.Name) && _libraries.ContainsKey(runtimeLibrary.Name)) return; - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing dependency {1} {0} using .nuget packages and ApplicationDirectory path.", runtimeLibrary.Name, runtimeLibrary.Type); + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing runtime dependency {1} {0} using .nuget packages and ApplicationDirectory path.", runtimeLibrary.Name, runtimeLibrary.Type); var asset = runtimeLibrary.Name; - if (!asset.EndsWith(".dll") && !asset.EndsWith(".sni")) - { - asset += ".dll"; - } - - if (asset == "runtime.native.System.dll") - { - asset = "System.dll"; - } + asset = ReplaceAssetName(asset); var assemblyPath = Path.Combine(_packagesPath, runtimeLibrary.Name.ToLower(), runtimeLibrary.Version, Path.GetFileName(asset)); @@ -453,75 +453,51 @@ private void AddDependencyFromAppDirectory(RuntimeLibrary runtimeLibrary) CompileAssemblies.TryAdd(runtimeLibrary.Name, assemblyPath); _libraries.TryAdd(runtimeLibrary.Name, assemblyPath); - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added dependency {1} from {0}", assemblyPath, runtimeLibrary.Name); - - var libraryNameFromPath = Path.GetFileNameWithoutExtension(assemblyPath); - if (!string.Equals(runtimeLibrary.Name, libraryNameFromPath, StringComparison.CurrentCultureIgnoreCase)) - { - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added supplementary assembly {1} from {0}", assemblyPath, libraryNameFromPath); - CompileAssemblies.TryAdd(libraryNameFromPath, assemblyPath); - _libraries.TryAdd(libraryNameFromPath, assemblyPath); - } + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added runtime dependency {1} from {0}", assemblyPath, runtimeLibrary.Name); + AddSupplementaryRuntime(runtimeLibrary); } else { - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Could not add dependency {0}", assemblyPath); + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Could not runtime add dependency {0}", assemblyPath); + } + } + + private string ReplaceAssetName(string asset) + { + if (!asset.EndsWith(".dll") && !asset.EndsWith(".sni")) + { + asset += ".dll"; + } + + if (asset == "runtime.native.System.dll") + { + asset = "System.dll"; } + + if (asset == "NETStandard.Library.dll") + { + asset = "netstandard.dll"; + } + return asset; } private void AddCompileDependencies(DependencyContext dependencyContext, bool standalone) { - var runtimePath = Path.GetDirectoryName(RuntimeEnvironment.RuntimePath); foreach (CompilationLibrary compileLibrary in dependencyContext.CompileLibraries) { if (compileLibrary.Assemblies.Count == 0 || CompileAssemblies.ContainsKey(compileLibrary.Name)) { continue; } - - var assemblyPath = compileLibrary.Assemblies[0].Replace('/', Path.DirectorySeparatorChar); - var normalizedPath = compileLibrary.Assemblies[0].Replace('/', Path.DirectorySeparatorChar); - - DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing compile assembly {1} {0} {2}", compileLibrary.Name, compileLibrary.Type, compileLibrary.Assemblies[0]); - - if (standalone) - { - if (File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)))) - { - assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)); - } - else if (File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, "refs", Path.GetFileName(normalizedPath)))) - { - assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, "refs", Path.GetFileName(normalizedPath)); - } - else if(!string.IsNullOrEmpty(runtimePath) && File.Exists(Path.Combine(runtimePath, Path.GetFileName(normalizedPath)))) - { - assemblyPath = Path.Combine(runtimePath, Path.GetFileName(normalizedPath)); - } - } - else - { - assemblyPath = Path.Combine(_packagesPath, compileLibrary.Name.ToLower(), compileLibrary.Version, normalizedPath.ToLower()); - if(!File.Exists(assemblyPath)) - { - assemblyPath = Path.Combine(_packagesPath, compileLibrary.Name.ToLower(), compileLibrary.Version, normalizedPath); - } - if(!File.Exists(assemblyPath) && File.Exists(Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)))) - { - assemblyPath = Path.Combine(RuntimeEnvironment.ApplicationDirectory, Path.GetFileName(normalizedPath)); - } - } - if (!File.Exists(assemblyPath) && !string.IsNullOrEmpty(runtimePath)) - { - assemblyPath = Path.Combine(runtimePath, Path.GetFileName(assemblyPath)); - } + DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Processing compile assembly {1} {0} {2}", compileLibrary.Name, compileLibrary.Type, compileLibrary.Assemblies[0]); + var assemblyPath = ResolveAssemblyPath(compileLibrary.Assemblies[0], compileLibrary.Version, compileLibrary.Type, standalone); if (!CompileAssemblies.ContainsKey(compileLibrary.Name)) { - var libraryNameFromPath = Path.GetFileNameWithoutExtension(assemblyPath); if (File.Exists(assemblyPath)) { + var libraryNameFromPath = Path.GetFileNameWithoutExtension(assemblyPath); CompileAssemblies[compileLibrary.Name] = assemblyPath; DebugMessage("EdgeAssemblyResolver::AddDependencies (CLR) - Added compile assembly {1} from {0}", assemblyPath, compileLibrary.Name); if (!string.Equals(compileLibrary.Name, libraryNameFromPath, StringComparison.CurrentCultureIgnoreCase)) diff --git a/test/test.csproj b/test/test.csproj index 0e9d214..fabe35f 100644 --- a/test/test.csproj +++ b/test/test.csproj @@ -37,7 +37,7 @@ - + diff --git a/tools/getVersion.js b/tools/getVersion.js new file mode 100644 index 0000000..148c331 --- /dev/null +++ b/tools/getVersion.js @@ -0,0 +1,29 @@ +const fs = require("fs"); +const http = require('isomorphic-git/http/web'); +const git = require("isomorphic-git"); + + +git.getRemoteInfo({ + http, + //corsProxy: "https://cors.isomorphic-git.org", + url: "https://github.com/electron/electron" +}).then(info =>{ + let result = Object.keys(info.refs.tags); + result = result + .filter(function (str) { return !str.includes('^'); }) + .filter(function (str) { return !str.includes('-'); }) + .filter(function (str) { return str.startsWith(`v${process.argv[2]}.`); }) + .sort() + .reverse(); + + if(result.length !== 0){ + let version = result[0].replace('v', '') + fs.writeFileSync('electron.txt', version); + console.log(version); + } + else{ + throw `Unable to resolve latest version for Electron ${process.argv[2]}` + } +}); + + diff --git a/tools/getVersions.js b/tools/getVersions.js new file mode 100644 index 0000000..c537113 --- /dev/null +++ b/tools/getVersions.js @@ -0,0 +1,43 @@ +const fs = require("fs"); +const http = require('isomorphic-git/http/web'); +const git = require("isomorphic-git"); +const { get } = require("https"); + +const majors = [29, 30, 31, 32, 33]; + +git.getRemoteInfo({ + http, + //corsProxy: "https://cors.isomorphic-git.org", + url: "https://github.com/electron/electron" +}).then(info =>{ + let result = Object.keys(info.refs.tags); + let versions = []; + majors.forEach((major) => { + versions.push(getVersion(result, major)); + }); + let res = `{'include':${JSON.stringify(versions)}}` + fs.writeFileSync('electron.txt', res); + console.log(res); +}); + +function getVersion(result, major){ + result = result + .filter(function (str) { return !str.includes('^'); }) + .filter(function (str) { return !str.includes('-'); }) + .filter(function (str) { return str.startsWith(`v${major}.`); }) + .sort() + .reverse(); + + if(result.length !== 0){ + return {'electron':`${result[0].replace('v', '')}`} + //fs.writeFileSync('electron.txt', version); + //console.log(version); + } + else{ + throw `Unable to resolve latest version for Electron ${major}` + } + +} + + + diff --git a/tools/mergeTests.js b/tools/mergeTests.js index b7e3891..e5bf2fe 100644 --- a/tools/mergeTests.js +++ b/tools/mergeTests.js @@ -11,7 +11,9 @@ const options = { const margeOptions = { reportFilename: 'mochawesome.html', - reportDir: './test/mochawesome-report' + reportDir: './test/mochawesome-report', + overwrite: true, + reportTitle: `electron-edge-js Electron ${process.argv[2]}` } merge.merge(options).then(report => {