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

[WIP] Support for rust #7260

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bbd7b53
add rust plugin
Feb 19, 2019
43d243d
add rust plugin in pants.ini
Feb 19, 2019
696ff04
remove toolchain in pants.ini
Feb 19, 2019
d8a95b6
add hashlib Python 3 compatibility
Feb 20, 2019
4e90acf
replace the call dict() with the dict literal
Feb 20, 2019
b2abae5
add workspace class
Feb 21, 2019
c5334f3
add util tests
Feb 21, 2019
8d8fd5c
replace concatenating strings with format
Feb 21, 2019
7ca6598
change type of make_dirs and make_sym_links
Feb 21, 2019
04270c8
add support for rustc-env
Feb 22, 2019
80f67f7
replace izip with zip
Feb 22, 2019
63ddb59
get member names and paths from manifest
Feb 25, 2019
8897639
remove supports_passthru_args
Feb 25, 2019
7360625
fix bug in member paths
Feb 25, 2019
5d4a565
set messages to debug level
Feb 25, 2019
9a76500
replace `requested_goals ` with `is_required_data`
Feb 25, 2019
1fe4c0a
add classes for binary and library targets
Feb 26, 2019
0324050
change the way the toolchain is defined
Feb 27, 2019
8435281
code clean up
Feb 28, 2019
0bf7db2
enable cargo binary and library targets
Feb 28, 2019
88aa474
Declare rust plugin dep for local pex in order to pull in toml dep.
stuhood Feb 28, 2019
cd02886
Fix Python 3 compatibility
Mar 1, 2019
df17c8d
set toolchain explicit
Mar 2, 2019
4455022
set toolchain for rustc
Mar 5, 2019
9742f84
improve the installation of the rust toolchain
Mar 5, 2019
bd3f95c
add support for cargo:warning
Mar 5, 2019
987f5fb
fix parsing tests
Mar 5, 2019
3edea2e
update rustup fingerprint
Mar 7, 2019
ebf3ce1
add simple support for rerun-if-(env-)changed
Mar 7, 2019
da3e78f
replace array with set
Mar 7, 2019
e7b5e37
fix value of read_file parameter
Mar 7, 2019
70fac18
write std_err of a build script into a file
Mar 7, 2019
4a43cec
refactor cargo_task
Mar 11, 2019
8b3ab28
add support for the remaining cargo lib kinds
Mar 13, 2019
d65c523
add tests
Mar 14, 2019
d63d329
add fingerprint strategy and tests
Apr 1, 2019
64c7deb
add ignore-rerun option and code cleanup
Apr 4, 2019
ac17c0d
format code
Apr 4, 2019
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
2 changes: 2 additions & 0 deletions 3rdparty/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ six>=1.9.0,<2
subprocess32==3.2.7 ; python_version<'3'
wheel==0.31.1
www-authenticate==0.9.2
toml==0.10.0

8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/binary/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_binary(
name='binary',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/binary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "binary"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
3 changes: 3 additions & 0 deletions contrib/rust/examples/src/rust/binary/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
11 changes: 11 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/bin_c/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_binary(
name='bin_c',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
dependencies=[
"contrib/rust/examples/src/rust/dependencies/lib_d:lib_d"
]
)
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/bin_c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bin_c"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
3 changes: 3 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/bin_c/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
12 changes: 12 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/lib_d/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='lib_d',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
dependencies=[
"contrib/rust/examples/src/rust/dependencies/workspace_a:workspace_a",
"contrib/rust/examples/src/rust/dependencies/workspace_b:workspace_b"
]
)
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/lib_d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "lib_d"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
sha2 = "0.8"
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/lib_d/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/workspace_a/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_workspace(
name='workspace_a',
include=['*.rs', 'Cargo.toml']
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = [
"bin_a",
"lib_a",
"lib_b"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bin_a"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "lib_a"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
sha2 = "0.8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "lib_b"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/dependencies/workspace_b/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_workspace(
name='workspace_b',
include=['*.rs', 'Cargo.toml']
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]
members = [
"bin_b",
"lib_c"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bin_b"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "lib_c"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
sha2 = "0.8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/cdylib/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='cdylib',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/cdylib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "cdylib"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/cdylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/dylib/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='dylib',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
11 changes: 11 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/dylib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "dylib"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[lib]
crate-type = ["dylib"]

[dependencies]
sha2 = "0.8"
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/dylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/proc-macro/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='proc-macro',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "proc-macro"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[lib]
proc-macro = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/rlib/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='rlib',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/rlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "rlib"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[lib]
crate-type = ["rlib"]
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/rlib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/staticlib/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='staticlib',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')]),
)
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/staticlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "staticlib"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[lib]
crate-type = ["staticlib"]
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/lib_kinds/staticlib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/library/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).


cargo_library(
name='library',
sources=rglobs('*.rs', 'Cargo.toml', exclude=[rglobs('**/target/*.rs')])
)
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/library/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "library"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/library/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/workspace/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

cargo_workspace(
name='workspace',
include=['*.rs', 'Cargo.toml']
)
6 changes: 6 additions & 0 deletions contrib/rust/examples/src/rust/workspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
members = [
"bin_1",
"bin_2",
"lib_1"
]
7 changes: 7 additions & 0 deletions contrib/rust/examples/src/rust/workspace/bin_1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bin_1"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
3 changes: 3 additions & 0 deletions contrib/rust/examples/src/rust/workspace/bin_1/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/workspace/bin_2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "bin_2"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
bin_1 = { path = "../bin_1" }
3 changes: 3 additions & 0 deletions contrib/rust/examples/src/rust/workspace/bin_2/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
8 changes: 8 additions & 0 deletions contrib/rust/examples/src/rust/workspace/lib_1/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "lib_1"
version = "0.1.0"
authors = ["Pants Build <[email protected]>"]
edition = "2018"

[dependencies]
bin_2 = { path = "../bin_2" }
Loading