Unverified Commit a79d4fc3 authored by Maia Teegarden's avatar Maia Teegarden Committed by GitHub

Extract next-swc Rust code into its own package (#31635)

Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent b69f3b79
......@@ -26,6 +26,6 @@ packages/create-next-app/templates/**
test/integration/eslint/**
test/development/basic/legacy-decorators/**/*
test-timings.json
packages/next/build/swc/crates/**
packages/next-swc/crates/**
bench/nested-deps/pages/**
bench/nested-deps/components/**
......@@ -118,6 +118,11 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
// in case of noisy environment slowing down initial repo build
await exec(buildCommand, false, { timeout: 5 * 60 * 1000 })
}
await fs.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next-swc/native')
)
// TODO: remove after next stable release (current v12.0.4)
await fs.copy(
path.join(__dirname, '../native'),
path.join(dir, 'packages/next/native')
......
......@@ -98,13 +98,24 @@ module.exports = (actionInfo) => {
pkgData.dependencies[pkg] = packedPkgPath
}
// make sure native binaries are included in local linking
if (pkg === 'next') {
if (pkg === '@next/swc') {
if (!pkgData.files) {
pkgData.files = []
}
pkgData.files.push('native')
console.log(
'using swc binaries: ',
await exec(`ls ${path.join(path.dirname(pkgDataPath), 'native')}`)
)
}
if (pkg === 'next') {
if (pkgDatas.get('@next/swc')) {
pkgData.dependencies['@next/swc'] =
pkgDatas.get('@next/swc').packedPkgPath
} else {
pkgData.files.push('native')
}
}
await fs.writeFile(
pkgDataPath,
JSON.stringify(pkgData, null, 2),
......
This diff is collapsed.
......@@ -53,8 +53,8 @@ jobs:
uses: actions/cache@v2
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
with:
path: packages/next/native/next-swc.linux-x64-gnu.node
key: dev-next-swc-nightly-2021-08-12-linux-x64-gnu-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next/build/swc/**') }}
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
key: dev-next-swc-nightly-2021-08-12-linux-x64-gnu-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }}
# We use restore-key to pick latest cache.
# We will not get exact match, but doc says
......@@ -63,7 +63,7 @@ jobs:
- name: Cache built files
uses: actions/cache@v2
with:
path: ./packages/next/build/swc/target
path: ./packages/next-target
key: next-swc-cargo-cache-ubuntu-18.04--${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
next-swc-cargo-cache-ubuntu-18.04
......@@ -77,13 +77,13 @@ jobs:
run: yarn build-native
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
working-directory: packages/next
working-directory: packages/next-swc
- name: Upload artifact
uses: actions/upload-artifact@v2.2.4
with:
name: next-swc-dev-binary
path: packages/next/native/next-swc.linux-x64-gnu.node
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
- name: Clear the cargo caches
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
......@@ -107,9 +107,9 @@ jobs:
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
with:
name: next-swc-dev-binary
path: packages/next/native
path: packages/next-swc/native
- run: cp -r packages/next/native .github/actions/next-stats-action/native
- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
- uses: ./.github/actions/next-stats-action
......
......@@ -10,7 +10,7 @@ packages/react-dev-overlay/lib/**
**/__tmp__/**
lerna.json
.github/actions/next-stats-action/.work
packages/next/build/swc/crates/**/*
packages/next-swc/crates/**/*
packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*
packages/next-codemod/**/*.js
......
**/.next/**
**/_next/**
**/dist/**
packages/next/build/swc/crates/**
packages/next-swc/crates/**
packages/next/compiled/**/*
packages/next/bundles/webpack/packages/*.runtime.js
lerna.json
......
......@@ -51,7 +51,7 @@ yarn build
yarn prepublish
```
By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install) and run `yarn --cwd packages/next build-native`.
By default the latest canary of the next-swc binaries will be installed and used. If you are actively working on Rust code or you need to test out the most recent Rust code that hasn't been published as a canary yet you can [install Rust](https://www.rust-lang.org/tools/install) and run `yarn --cwd packages/next-swc build-native`.
If you need to clean the project for any reason, use `yarn clean`.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment