commit
201eca63d3
9 changed files with 107 additions and 44 deletions
72
.github/workflows/android-armv7.yml
vendored
Normal file
72
.github/workflows/android-armv7.yml
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
name: Android-armv7
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
DEBUG: 'napi:*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-android-armv7:
|
||||||
|
name: Build - Android - armv7
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
cache: 'yarn'
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: List NDK Home
|
||||||
|
run: ls -R "${ANDROID_NDK_HOME}"
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
target: 'armv7-linux-androideabi'
|
||||||
|
|
||||||
|
- name: Generate Cargo.lock
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: generate-lockfile
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: stable-linux-android-armv7-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: stable-linux-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
|
||||||
|
- name: 'Build TypeScript'
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Cross build
|
||||||
|
run: |
|
||||||
|
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
||||||
|
yarn build:test:android:armv7
|
||||||
|
du -sh examples/napi/index.node
|
||||||
|
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip examples/napi/index.node
|
||||||
|
du -sh examples/napi/index.node
|
14
.github/workflows/android.yml
vendored
14
.github/workflows/android.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: macOS-Android
|
name: Android-aarch64
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -12,12 +12,12 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
build-android-aarch64:
|
build-android-aarch64:
|
||||||
name: Build - Android - aarch64
|
name: Build - Android - aarch64
|
||||||
runs-on: macos-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
@ -43,19 +43,19 @@ jobs:
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/registry
|
path: ~/.cargo/registry
|
||||||
key: stable-macos-android-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
key: stable-linux-android-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Cache cargo index
|
- name: Cache cargo index
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/git
|
path: ~/.cargo/git
|
||||||
key: stable-macos-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
key: stable-linux-android-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Cache NPM dependencies
|
- name: Cache NPM dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: npm-cache-macos-android-node@16-${{ hashFiles('yarn.lock') }}
|
key: npm-cache-linux-android-node@16-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
@ -65,5 +65,5 @@ jobs:
|
||||||
|
|
||||||
- name: Cross build native tests
|
- name: Cross build native tests
|
||||||
run: |
|
run: |
|
||||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
||||||
yarn build:test:android
|
yarn build:test:android
|
||||||
|
|
|
@ -68,6 +68,7 @@ _Main branch is now under napi@next developing. Checkout [v1 docs](https://napi.
|
||||||
| Linux aarch64 musl | ✓ | ✓ | ✓ | ✓ |
|
| Linux aarch64 musl | ✓ | ✓ | ✓ | ✓ |
|
||||||
| Linux arm gnueabihf | ✓ | ✓ | ✓ | ✓ |
|
| Linux arm gnueabihf | ✓ | ✓ | ✓ | ✓ |
|
||||||
| Linux aarch64 android | ✓ | ✓ | ✓ | ✓ |
|
| Linux aarch64 android | ✓ | ✓ | ✓ | ✓ |
|
||||||
|
| Linux armv7 android | ✓ | ✓ | ✓ | ✓ |
|
||||||
| FreeBSD x64 | ✓ | ✓ | ✓ | ✓ |
|
| FreeBSD x64 | ✓ | ✓ | ✓ | ✓ |
|
||||||
|
|
||||||
This library depends on Node-API and requires `Node@10.0.0` or later.
|
This library depends on Node-API and requires `Node@10.0.0` or later.
|
||||||
|
|
|
@ -87,9 +87,21 @@ jobs:
|
||||||
target: 'aarch64-linux-android'
|
target: 'aarch64-linux-android'
|
||||||
build: |
|
build: |
|
||||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
||||||
|
export CC="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
|
||||||
|
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
|
||||||
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
||||||
yarn build --target aarch64-linux-android
|
yarn build --target aarch64-linux-android
|
||||||
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip *.node
|
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip *.node
|
||||||
|
- host: ubuntu-latest
|
||||||
|
architecture: 'x64'
|
||||||
|
target: 'armv7-linux-androideabi'
|
||||||
|
build: |
|
||||||
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
||||||
|
export CC="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
|
||||||
|
export CXX="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
|
||||||
|
export PATH="\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:\${PATH}"
|
||||||
|
yarn build --target armv7-linux-androideabi
|
||||||
|
\${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip *.node
|
||||||
- host: ubuntu-latest
|
- host: ubuntu-latest
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
target: 'aarch64-unknown-linux-musl'
|
target: 'aarch64-unknown-linux-musl'
|
||||||
|
@ -172,6 +184,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: bindings-\${{ matrix.settings.target }}
|
name: bindings-\${{ matrix.settings.target }}
|
||||||
path: \${{ env.APP_NAME }}.*.node
|
path: \${{ env.APP_NAME }}.*.node
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build-freebsd:
|
build-freebsd:
|
||||||
runs-on: macos-10.15
|
runs-on: macos-10.15
|
||||||
|
@ -221,6 +234,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: bindings-freebsd
|
name: bindings-freebsd
|
||||||
path: \${{ env.APP_NAME }}.*.node
|
path: \${{ env.APP_NAME }}.*.node
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
test-macOS-windows-binding:
|
test-macOS-windows-binding:
|
||||||
name: Test bindings on \${{ matrix.settings.target }} - node@\${{ matrix.node }}
|
name: Test bindings on \${{ matrix.settings.target }} - node@\${{ matrix.node }}
|
||||||
|
|
|
@ -42,6 +42,7 @@ const SupportedPlatforms: string[] = [
|
||||||
'x86_64-unknown-linux-musl',
|
'x86_64-unknown-linux-musl',
|
||||||
'x86_64-unknown-freebsd',
|
'x86_64-unknown-freebsd',
|
||||||
'i686-pc-windows-msvc',
|
'i686-pc-windows-msvc',
|
||||||
|
'armv7-linux-androideabi',
|
||||||
]
|
]
|
||||||
|
|
||||||
export class NewProjectCommand extends Command {
|
export class NewProjectCommand extends Command {
|
||||||
|
|
|
@ -70,7 +70,10 @@ export const DefaultPlatforms: PlatformDetail[] = [
|
||||||
* - `sys` = The system name, for example `linux`, `windows`, `darwin`, etc. none is typically used for bare-metal without an OS.
|
* - `sys` = The system name, for example `linux`, `windows`, `darwin`, etc. none is typically used for bare-metal without an OS.
|
||||||
* - `abi` = The ABI, for example `gnu`, `android`, `eabi`, etc.
|
* - `abi` = The ABI, for example `gnu`, `android`, `eabi`, etc.
|
||||||
*/
|
*/
|
||||||
export function parseTriple(triple: string): PlatformDetail {
|
export function parseTriple(rawTriple: string): PlatformDetail {
|
||||||
|
const triple = rawTriple.endsWith('eabi')
|
||||||
|
? `${rawTriple.slice(0, -4)}-eabi`
|
||||||
|
: rawTriple
|
||||||
const triples = triple.split('-')
|
const triples = triple.split('-')
|
||||||
let cpu: string
|
let cpu: string
|
||||||
let sys: string
|
let sys: string
|
||||||
|
@ -91,7 +94,7 @@ export function parseTriple(triple: string): PlatformDetail {
|
||||||
platformArchABI: abi
|
platformArchABI: abi
|
||||||
? `${platformName}-${arch}-${abi}`
|
? `${platformName}-${arch}-${abi}`
|
||||||
: `${platformName}-${arch}`,
|
: `${platformName}-${arch}`,
|
||||||
raw: triple,
|
raw: rawTriple,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
package.json
23
package.json
|
@ -3,11 +3,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "A minimal library for building compiled Node add-ons in Rust.",
|
"description": "A minimal library for building compiled Node add-ons in Rust.",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"workspaces": [
|
"workspaces": ["cli", "triples", "memory-testing"],
|
||||||
"cli",
|
|
||||||
"triples",
|
|
||||||
"memory-testing"
|
|
||||||
],
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@github.com:Brooooooklyn/napi-rs.git"
|
"url": "git@github.com:Brooooooklyn/napi-rs.git"
|
||||||
|
@ -21,6 +17,7 @@
|
||||||
"build:test": "yarn --cwd ./examples/napi-compat-mode build && yarn --cwd ./examples/napi build",
|
"build:test": "yarn --cwd ./examples/napi-compat-mode build && yarn --cwd ./examples/napi build",
|
||||||
"build:test:aarch64": "yarn --cwd ./examples/napi-compat-mode build-aarch64 && yarn --cwd ./examples/napi build-aarch64",
|
"build:test:aarch64": "yarn --cwd ./examples/napi-compat-mode build-aarch64 && yarn --cwd ./examples/napi build-aarch64",
|
||||||
"build:test:android": "yarn --cwd ./examples/napi-compat-mode build --target aarch64-linux-android && yarn --cwd ./examples/napi build --target aarch64-linux-android",
|
"build:test:android": "yarn --cwd ./examples/napi-compat-mode build --target aarch64-linux-android && yarn --cwd ./examples/napi build --target aarch64-linux-android",
|
||||||
|
"build:test:android:armv7": "yarn --cwd ./examples/napi-compat-mode build --target armv7-linux-androideabi && yarn --cwd ./examples/napi build --target armv7-linux-androideabi",
|
||||||
"build:test:armv7": "yarn --cwd ./examples/napi-compat-mode build-armv7 && yarn --cwd ./examples/napi build-armv7",
|
"build:test:armv7": "yarn --cwd ./examples/napi-compat-mode build-armv7 && yarn --cwd ./examples/napi build-armv7",
|
||||||
"bundle": "rollup -c rollup.config.js",
|
"bundle": "rollup -c rollup.config.js",
|
||||||
"format": "run-p format:md format:json format:yaml format:source format:rs",
|
"format": "run-p format:md format:json format:yaml format:source format:rs",
|
||||||
|
@ -48,18 +45,10 @@
|
||||||
"arrowParens": "always"
|
"arrowParens": "always"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.js": [
|
"*.js": ["prettier --write"],
|
||||||
"prettier --write"
|
"*.@(yml|yaml)": ["prettier --parser yaml --write"],
|
||||||
],
|
"*.json": ["prettier --parser json --write"],
|
||||||
"*.@(yml|yaml)": [
|
"*.md": ["prettier --parser markdown --write"]
|
||||||
"prettier --parser yaml --write"
|
|
||||||
],
|
|
||||||
"*.json": [
|
|
||||||
"prettier --parser json --write"
|
|
||||||
],
|
|
||||||
"*.md": [
|
|
||||||
"prettier --parser markdown --write"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,6 @@ aarch64-unknown-linux-gnu
|
||||||
aarch64-unknown-linux-musl
|
aarch64-unknown-linux-musl
|
||||||
aarch64-unknown-none
|
aarch64-unknown-none
|
||||||
aarch64-unknown-none-softfloat
|
aarch64-unknown-none-softfloat
|
||||||
arm-linux-androideabi
|
|
||||||
arm-unknown-linux-gnueabi
|
arm-unknown-linux-gnueabi
|
||||||
arm-unknown-linux-gnueabihf
|
arm-unknown-linux-gnueabihf
|
||||||
arm-unknown-linux-musleabi
|
arm-unknown-linux-musleabi
|
||||||
|
@ -24,10 +23,6 @@ armv7-unknown-linux-musleabihf
|
||||||
armv7a-none-eabi
|
armv7a-none-eabi
|
||||||
armv7r-none-eabi
|
armv7r-none-eabi
|
||||||
armv7r-none-eabihf
|
armv7r-none-eabihf
|
||||||
asmjs-unknown-emscripten
|
|
||||||
i586-pc-windows-msvc
|
|
||||||
i586-unknown-linux-gnu
|
|
||||||
i586-unknown-linux-musl
|
|
||||||
i686-linux-android
|
i686-linux-android
|
||||||
i686-pc-windows-gnu
|
i686-pc-windows-gnu
|
||||||
i686-pc-windows-msvc
|
i686-pc-windows-msvc
|
||||||
|
@ -55,18 +50,6 @@ riscv64imac-unknown-none-elf
|
||||||
s390x-unknown-linux-gnu
|
s390x-unknown-linux-gnu
|
||||||
sparc64-unknown-linux-gnu
|
sparc64-unknown-linux-gnu
|
||||||
sparcv9-sun-solaris
|
sparcv9-sun-solaris
|
||||||
thumbv6m-none-eabi
|
|
||||||
thumbv7em-none-eabi
|
|
||||||
thumbv7em-none-eabihf
|
|
||||||
thumbv7m-none-eabi
|
|
||||||
thumbv7neon-linux-androideabi
|
|
||||||
thumbv7neon-unknown-linux-gnueabihf
|
|
||||||
thumbv8m.base-none-eabi
|
|
||||||
thumbv8m.main-none-eabi
|
|
||||||
thumbv8m.main-none-eabihf
|
|
||||||
wasm32-unknown-emscripten
|
|
||||||
wasm32-unknown-unknown
|
|
||||||
wasm32-wasi
|
|
||||||
x86_64-apple-darwin
|
x86_64-apple-darwin
|
||||||
x86_64-apple-ios
|
x86_64-apple-ios
|
||||||
x86_64-fortanix-unknown-sgx
|
x86_64-fortanix-unknown-sgx
|
||||||
|
|
Loading…
Add table
Reference in a new issue