From 754462238a1b85ce4c2147f29930058a0c916c9f Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 22 Dec 2020 15:14:29 +0800 Subject: [PATCH] feat(cli): check 'cdylib' in crate-type --- cli/src/build.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cli/src/build.ts b/cli/src/build.ts index 96f6553b..7f5ff343 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -106,6 +106,14 @@ export class BuildCommand extends Command { } else { throw new TypeError('No package.name field in Cargo.toml') } + + if (!tomlContent.lib?.['crate-type']?.includes?.('cdylib')) { + throw new TypeError( + `Missing ${chalk.green('create-type = ["cdylib"]')} in ${chalk.green( + '[lib]', + )}`, + ) + } } debug(`Dylib name: ${chalk.greenBright(dylibName)}`)