@@ -3351,8 +3351,8 @@ See [..]
3351
3351
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
3352
3352
[WARNING] ignoring binary `foo` as `src/main.rs` is not included in the published package
3353
3353
[WARNING] ignoring example `ExampleFoo` as `examples/ExampleFoo.rs` is not included in the published package
3354
- [WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
3355
3354
[WARNING] ignoring test `ExplicitPath` as `tests/ExplicitPath.rs` is not included in the published package
3355
+ [WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
3356
3356
[VERIFYING] foo v0.0.1 ([CWD])
3357
3357
[COMPILING] foo v0.0.1 ([CWD][..])
3358
3358
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
@@ -3384,8 +3384,8 @@ See [..]
3384
3384
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
3385
3385
[WARNING] ignoring binary `foo` as `src/main.rs` is not included in the published package
3386
3386
[WARNING] ignoring example `ExampleFoo` as `examples/ExampleFoo.rs` is not included in the published package
3387
- [WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
3388
3387
[WARNING] ignoring test `ExplicitPath` as `tests/ExplicitPath.rs` is not included in the published package
3388
+ [WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
3389
3389
[VERIFYING] foo v0.0.1 ([CWD])
3390
3390
[COMPILING] foo v0.0.1 ([CWD][..])
3391
3391
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
@@ -4928,3 +4928,126 @@ path = "src/lib.rs"
4928
4928
) ] ,
4929
4929
) ;
4930
4930
}
4931
+
4932
+ #[ cargo_test]
4933
+ fn deterministic_build_targets ( ) {
4934
+ let p = project ( )
4935
+ . file (
4936
+ "Cargo.toml" ,
4937
+ r#"
4938
+ [package]
4939
+ name = "foo"
4940
+ version = "0.0.1"
4941
+ edition = "2021"
4942
+ license = "MIT"
4943
+ description = "foo"
4944
+ documentation = "docs.rs/foo"
4945
+ authors = []
4946
+
4947
+ [[example]]
4948
+ name = "c"
4949
+
4950
+ [[example]]
4951
+ name = "b"
4952
+
4953
+ [[example]]
4954
+ name = "a"
4955
+ "# ,
4956
+ )
4957
+ . file ( "src/lib.rs" , "" )
4958
+ . file ( "examples/z.rs" , "fn main() {}" )
4959
+ . file ( "examples/y.rs" , "fn main() {}" )
4960
+ . file ( "examples/x.rs" , "fn main() {}" )
4961
+ . file ( "examples/c.rs" , "fn main() {}" )
4962
+ . file ( "examples/b.rs" , "fn main() {}" )
4963
+ . file ( "examples/a.rs" , "fn main() {}" )
4964
+ . build ( ) ;
4965
+
4966
+ p. cargo ( "package" )
4967
+ . with_stdout ( "" )
4968
+ . with_stderr (
4969
+ "\
4970
+ [PACKAGING] foo v0.0.1 ([CWD])
4971
+ [VERIFYING] foo v0.0.1 ([CWD])
4972
+ [COMPILING] foo v0.0.1 ([CWD][..])
4973
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
4974
+ [PACKAGED] 10 files, [..] ([..] compressed)
4975
+ " ,
4976
+ )
4977
+ . run ( ) ;
4978
+
4979
+ let f = File :: open ( & p. root ( ) . join ( "target/package/foo-0.0.1.crate" ) ) . unwrap ( ) ;
4980
+ validate_crate_contents (
4981
+ f,
4982
+ "foo-0.0.1.crate" ,
4983
+ & [
4984
+ "Cargo.lock" ,
4985
+ "Cargo.toml" ,
4986
+ "Cargo.toml.orig" ,
4987
+ "src/lib.rs" ,
4988
+ "examples/a.rs" ,
4989
+ "examples/b.rs" ,
4990
+ "examples/c.rs" ,
4991
+ "examples/x.rs" ,
4992
+ "examples/y.rs" ,
4993
+ "examples/z.rs" ,
4994
+ ] ,
4995
+ & [ (
4996
+ "Cargo.toml" ,
4997
+ r#"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
4998
+ #
4999
+ # When uploading crates to the registry Cargo will automatically
5000
+ # "normalize" Cargo.toml files for maximal compatibility
5001
+ # with all versions of Cargo and also rewrite `path` dependencies
5002
+ # to registry (e.g., crates.io) dependencies.
5003
+ #
5004
+ # If you are reading this file be aware that the original Cargo.toml
5005
+ # will likely look very different (and much more reasonable).
5006
+ # See Cargo.toml.orig for the original contents.
5007
+
5008
+ [package]
5009
+ edition = "2021"
5010
+ name = "foo"
5011
+ version = "0.0.1"
5012
+ authors = []
5013
+ build = false
5014
+ autobins = false
5015
+ autoexamples = false
5016
+ autotests = false
5017
+ autobenches = false
5018
+ description = "foo"
5019
+ documentation = "docs.rs/foo"
5020
+ readme = false
5021
+ license = "MIT"
5022
+
5023
+ [lib]
5024
+ name = "foo"
5025
+ path = "src/lib.rs"
5026
+
5027
+ [[example]]
5028
+ name = "a"
5029
+ path = "examples/a.rs"
5030
+
5031
+ [[example]]
5032
+ name = "b"
5033
+ path = "examples/b.rs"
5034
+
5035
+ [[example]]
5036
+ name = "c"
5037
+ path = "examples/c.rs"
5038
+
5039
+ [[example]]
5040
+ name = "x"
5041
+ path = "examples/x.rs"
5042
+
5043
+ [[example]]
5044
+ name = "y"
5045
+ path = "examples/y.rs"
5046
+
5047
+ [[example]]
5048
+ name = "z"
5049
+ path = "examples/z.rs"
5050
+ "# ,
5051
+ ) ] ,
5052
+ ) ;
5053
+ }
0 commit comments