Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Node.js addon binary size #1418

Merged
merged 1 commit into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/publish-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

Expand All @@ -25,6 +26,12 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 14

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true

- name: Install node dependencies
run: npm i
Expand Down Expand Up @@ -57,6 +64,7 @@ jobs:
run: |
choco install nodejs-lts --x86 -y --force
refreshenv

- name: Set 32bit NodeJS path
run: |
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH
Expand All @@ -65,15 +73,12 @@ jobs:
- name: NodeJS arch
run: node -e "console.log(process.arch)"

- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install i686 toolchain
run: rustup target add i686-pc-windows-msvc
target: i686-pc-windows-msvc

- name: Install node dependencies
run: npm i
Expand Down Expand Up @@ -117,6 +122,7 @@ jobs:
run: |
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder

- name: "Install dependencies"
run: npm i

Expand All @@ -142,15 +148,12 @@ jobs:
with:
node-version: 14

- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install aarch64 toolchain
run: rustup target add aarch64-apple-darwin
target: aarch64-apple-darwin

- name: Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -185,15 +188,12 @@ jobs:
with:
node-version: 14

- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install aarch64 toolchain
run: rustup target add aarch64-unknown-linux-gnu
target: aarch64-unknown-linux-gnu

- name: Cache
uses: actions/cache@v2
Expand All @@ -202,7 +202,6 @@ jobs:
target/
key: aarch64-linux-gnu-publish-integration


- name: Install cross compile toolchain
run: |
sudo apt-get update
Expand Down Expand Up @@ -234,15 +233,12 @@ jobs:
with:
node-version: 14

- name: Install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install aarch64 toolchain
run: rustup target add armv7-unknown-linux-gnueabihf
target: armv7-unknown-linux-gnueabihf

- name: Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -279,8 +275,12 @@ jobs:
with:
node-version: 14

- name: Install aarch64 toolchain
run: rustup target add aarch64-linux-android
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
target: aarch64-linux-android

- name: Install node dependencies
run: npm i
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["strip"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. I didn't know this. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nightly feature in Cargo: rust-lang/cargo#8246


[workspace]
members = ["ecmascript", "ecmascript/jsdoc", "native", "spack", "wasm"]

Expand Down Expand Up @@ -55,6 +57,7 @@ name = "usage"
[profile.release]
codegen-units = 1
lto = true
strip = 'symbols'
# debug = true
# opt-level = 'z'

Expand Down
2 changes: 1 addition & 1 deletion macros/string_enum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fn make_as_str(i: &DeriveInput) -> ItemImpl {
})),
_ => Box::new(
Quote::new(def_site::<Span>())
.quote_with(smart_quote!(Vars { qual_name }, { qual_name{..} }))
.quote_with(smart_quote!(Vars { qual_name }, { qual_name { .. } }))
.parse(),
),
};
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2020-11-24
nightly-2021-02-19