Skip to content

Commit 1cdb6ea

Browse files
committed
Remove deprecated Cargo environment variables
Setting AR and CC via Cargo is not supported. AR is still documented but marked deprecated here: https://doc.rust-lang.org/nightly/cargo/reference/config.html#targettriplear https://doc.rust-lang.org/rustc/codegen-options/index.html#ar Setting CC via config is not documented at all now, and searching for cc in Cargo source code also comes up empty. It's also missing from the `rustc` codegen options link above. I also removed a comment reference to RUSTFLAGS which doesn't appear to be accurate (we don't set or modify RUSTFLAGS anywhere in this library)
1 parent 67fb933 commit 1cdb6ea

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,6 @@ open class CargoBuildTask : DefaultTask() {
167167
} else {
168168
cargoExtension.toolchainDirectory
169169
}
170-
// Be aware that RUSTFLAGS can have problems with embedded
171-
// spaces, but that shouldn't be a problem here.
172-
val cc = File(toolchainDirectory, "${toolchain.cc(apiLevel)}").path;
173-
val cxx = File(toolchainDirectory, "${toolchain.cxx(apiLevel)}").path;
174-
val ar = File(toolchainDirectory, "${toolchain.ar(apiLevel)}").path;
175-
176-
// For cargo: like "CARGO_TARGET_I686_LINUX_ANDROID_CC". This is really weakly
177-
// documented; see https://github.com/rust-lang/cargo/issues/5690 and follow
178-
// links from there.
179-
environment("CARGO_TARGET_${toolchain_target}_CC", cc)
180-
environment("CARGO_TARGET_${toolchain_target}_AR", ar)
181170

182171
val linker_wrapper =
183172
if (System.getProperty("os.name").startsWith("Windows")) {
@@ -187,6 +176,10 @@ open class CargoBuildTask : DefaultTask() {
187176
}
188177
environment("CARGO_TARGET_${toolchain_target}_LINKER", linker_wrapper.path)
189178

179+
val cc = File(toolchainDirectory, "${toolchain.cc(apiLevel)}").path;
180+
val cxx = File(toolchainDirectory, "${toolchain.cxx(apiLevel)}").path;
181+
val ar = File(toolchainDirectory, "${toolchain.ar(apiLevel)}").path;
182+
190183
// For build.rs in `cc` consumers: like "CC_i686-linux-android". See
191184
// https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables.
192185
environment("CC_${toolchain.target}", cc)

0 commit comments

Comments
 (0)