File tree Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,10 @@ impl<'cfg> Compilation<'cfg> {
289
289
"CARGO_PKG_REPOSITORY" ,
290
290
metadata. repository . as_ref ( ) . unwrap_or ( & String :: new ( ) ) ,
291
291
)
292
+ . env (
293
+ "CARGO_PKG_LICENSE" ,
294
+ metadata. license . as_ref ( ) . unwrap_or ( & String :: new ( ) ) ,
295
+ )
292
296
. env ( "CARGO_PKG_AUTHORS" , & pkg. authors ( ) . join ( ":" ) )
293
297
. cwd ( pkg. root ( ) ) ;
294
298
Ok ( cmd)
Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ let version = env!("CARGO_PKG_VERSION");
184
184
* ` CARGO_PKG_DESCRIPTION ` — The description from the manifest of your package.
185
185
* ` CARGO_PKG_HOMEPAGE ` — The home page from the manifest of your package.
186
186
* ` CARGO_PKG_REPOSITORY ` — The repository from the manifest of your package.
187
+ * ` CARGO_PKG_LICENSE ` — The license from the manifest of your package.
187
188
* ` OUT_DIR ` — If the package has a build script, this is set to the folder where the build
188
189
script should place its output. See below for more information.
189
190
(Only set during compilation.)
Original file line number Diff line number Diff line change @@ -1230,6 +1230,7 @@ fn crate_env_vars() {
1230
1230
homepage = "https://example.com"
1231
1231
repository = "https://example.com/repo.git"
1232
1232
authors = ["wycats@example.com"]
1233
+ license = "MIT"
1233
1234
"# ,
1234
1235
)
1235
1236
. file (
@@ -1247,6 +1248,7 @@ fn crate_env_vars() {
1247
1248
static PKG_NAME: &'static str = env!("CARGO_PKG_NAME");
1248
1249
static HOMEPAGE: &'static str = env!("CARGO_PKG_HOMEPAGE");
1249
1250
static REPOSITORY: &'static str = env!("CARGO_PKG_REPOSITORY");
1251
+ static LICENSE: &'static str = env!("CARGO_PKG_LICENSE");
1250
1252
static DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION");
1251
1253
1252
1254
fn main() {
@@ -1258,6 +1260,7 @@ fn crate_env_vars() {
1258
1260
assert_eq!("foo", PKG_NAME);
1259
1261
assert_eq!("https://example.com", HOMEPAGE);
1260
1262
assert_eq!("https://example.com/repo.git", REPOSITORY);
1263
+ assert_eq!("MIT", LICENSE);
1261
1264
assert_eq!("This is foo", DESCRIPTION);
1262
1265
let s = format!("{}.{}.{}-{}", VERSION_MAJOR,
1263
1266
VERSION_MINOR, VERSION_PATCH, VERSION_PRE);
You can’t perform that action at this time.
0 commit comments