-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Rustpkg should infer crates to build #5680
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Sub-bug of #5677
Rustpkg currently always looks for a
pkg.rsfile, compiles and links it against librustpkg and runs it. This behaviour should only exist as an escape hatch for custom build logic. Most of the time, rustpkg should be able to infer what to build. The inference rules should be:foo/lib.rsimplies compilinglib.rsinto a library with basenamefoofoo/main.rsimplies compilingmain.rsinto a binary calledfoofoo/test.rsimplies compilingtest.rsinto a test binary calledfoo-testfoo/bench.rsimplies compilingtest.rsinto a benchmark binary calledfoo-benchpkg.rsin the package root disables inference and does the "custom build logic" routine.pkg.rsscript.A sketch of the logic for inferring these things is here:
https://github.com/graydon/rust/blob/rustpkg/src/librustpkg/rustpkg.rc#L1143
It doesn't make any difference if these files are in the root of a package or in subdirs: the stem
foofor a crate is taken from immediately-containing directory name in all cases.Test and benchmark binaries should not leave their build dirs; they should be run in-place by the install process. Mains should be installed to
binand libraries tolibin the corresponding install dirs.