Skip to content

Commit

Permalink
Bazel: add ar_files/as_files to cc_toolchain targets
Browse files Browse the repository at this point in the history
These are mostly tests.  This is a step toward making the
ar_files/as_files attributes mandatory.

RELNOTES: None.
PiperOrigin-RevId: 189052327
  • Loading branch information
Googler authored and Copybara-Service committed Mar 14, 2018
1 parent ccb0a22 commit c0aca06
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
cc_toolchain(
name = "%toolchainName%",
all_files = ":%toolchainName%-all_files",
ar_files = ":%toolchainName%-all_files",
as_files = ":%toolchainName%-all_files",
compiler_files = ":%toolchainName%-all_files",
cpu = "%cpu%",
dwp_files = ":%toolchainName%-all_files",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ public void testCcToolchainLicenseOverride() throws Exception {
" name = 'c',",
" output_licenses = ['notice'],",
" cpu = 'cherry',",
" ar_files = 'ar-cherry',",
" as_files = 'as-cherry',",
" compiler_files = 'compile-cherry',",
" dwp_files = 'dwp-cherry',",
" coverage_files = 'gcov-cherry',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,38 +95,38 @@ public void setup(MockToolsConfig config) throws IOException {
"cc_toolchain(name = 'cc-compiler-k8', all_files = ':empty', compiler_files = ':empty',",
" cpu = 'k8', compiler = 'compiler', libc = 'local', dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
"cc_toolchain(name = 'cc-compiler-ppc', all_files = ':empty', compiler_files = ':empty',",
" cpu = 'ppc', compiler = 'compiler', libc = 'local', dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
"cc_toolchain(name = 'cc-compiler-piii', all_files = ':all-files-piii',",
" compiler_files = ':compiler-files-piii',",
" cpu = 'piii', compiler = 'compiler', libc = 'local', dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
"cc_toolchain(name = 'cc-compiler-darwin', all_files = ':empty', ",
" compiler_files = ':empty',",
" cpu = 'darwin', compiler = 'compiler', libc = 'macosx', dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
"cc_toolchain(name = 'cc-compiler-ios_x86_64', all_files = ':empty', ",
" compiler_files = ':empty',",
" cpu = 'ios_x86_64', compiler = 'compiler', libc = 'local', dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
Expand All @@ -135,7 +135,7 @@ public void setup(MockToolsConfig config) throws IOException {
" cpu = 'armeabi-v7a', compiler = 'compiler', libc = 'armeabi-v7a', ",
" dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
Expand All @@ -144,7 +144,7 @@ public void setup(MockToolsConfig config) throws IOException {
" cpu = 'x64_windows', compiler = 'windows_msys64', libc = 'local', ",
" dwp_files = ':empty',",
" dynamic_runtime_libs = [':empty'], ",
" linker_files = ':empty',",
" ar_files = ':empty', as_files = ':empty', linker_files = ':empty',",
" module_map = 'crosstool.cppmap', supports_header_parsing = 1,",
" objcopy_files = ':empty', static_runtime_libs = [':empty'], strip_files = ':empty',",
")",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
final class Crosstool {
private static final ImmutableList<String> CROSSTOOL_BINARIES =
ImmutableList.of("compile", "dwp", "link", "objcopy");
ImmutableList.of("ar", "as", "compile", "dwp", "link", "objcopy");

private final MockToolsConfig config;

Expand Down Expand Up @@ -141,6 +141,8 @@ public void write() throws IOException {
" cpu = '" + arch + "',",
" compiler = 'gcc-4.4.0',",
" libc = 'glibc-2.3.6-grte',",
" ar_files = 'ar-" + arch + "',",
" as_files = 'as-" + arch + "',",
" compiler_files = 'compile-" + arch + "',",
" dwp_files = 'dwp-" + arch + "',",
" linker_files = 'link-" + arch + "',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public static void createCrosstoolPackage(
"apple_cc_toolchain(",
" name = 'cc-compiler-" + arch + "',",
" all_files = ':empty',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" cpu = 'ios',",
" dwp_files = ':empty',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public void testFilesToBuildWithoutDSO() throws Exception {
" name = 'cc-compiler-k8',",
" output_licenses = ['unencumbered'],",
" cpu = 'k8',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" coverage_files = ':empty',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public void testIncompleteCcToolchain() throws Exception {
"cc_toolchain(",
" name = 'incomplete_cc-compiler-piii',",
" cpu = 'piii',",
" ar_files = 'ar-piii',",
" as_files = 'as-piii',",
" compiler_files = 'compile-piii',",
" dwp_files = 'dwp-piii',",
" linker_files = 'link-piii',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void testFilesToBuild() throws Exception {
" default_grte_top: '//cc:grtetop'",
" tool_path { name: 'cpu-compiler', path: 'k8/compiler' }",
" tool_path { name: 'ar', path: 'k8/ar' }",
" tool_path { name: 'as', path: 'k8/as' }",
" tool_path { name: 'cpp', path: 'k8/cpp' }",
" tool_path { name: 'gcc', path: 'k8/gcc' }",
" tool_path { name: 'gcov', path: 'k8/gcov' }",
Expand All @@ -97,6 +98,7 @@ public void testFilesToBuild() throws Exception {
" default_grte_top: '//cc:grtetop'",
" tool_path { name: 'darwin-compiler', path: 'darwin/compiler' }",
" tool_path { name: 'ar', path: 'darwin/ar' }",
" tool_path { name: 'as', path: 'darwin/as' }",
" tool_path { name: 'cpp', path: 'darwin/cpp' }",
" tool_path { name: 'gcc', path: 'darwin/gcc' }",
" tool_path { name: 'gcov', path: 'darwin/gcov' }",
Expand All @@ -119,6 +121,7 @@ public void testFilesToBuild() throws Exception {
" default_grte_top: '//cc:grtetop'",
" tool_path { name: 'windows-compiler', path: 'windows/compiler' }",
" tool_path { name: 'ar', path: 'windows/ar' }",
" tool_path { name: 'as', path: 'windows/as' }",
" tool_path { name: 'cpp', path: 'windows/cpp' }",
" tool_path { name: 'gcc', path: 'windows/gcc' }",
" tool_path { name: 'gcov', path: 'windows/gcov' }",
Expand All @@ -139,6 +142,7 @@ public void testFilesToBuild() throws Exception {
" target_system_name: 'local'",
" toolchain_identifier: 'local_linux'",
" tool_path { name: 'ar' path: '/usr/bin/ar' }",
" tool_path { name: 'as' path: '/usr/bin/as' }",
" tool_path { name: 'compat-ld' path: '/usr/bin/ld' }",
" tool_path { name: 'cpp' path: '/usr/bin/cpp' }",
" tool_path { name: 'dwp' path: '/usr/bin/dwp' }",
Expand All @@ -155,6 +159,8 @@ public void testFilesToBuild() throws Exception {
" name = 'k8-toolchain',",
" module_map = 'map',",
" cpu = 'cpu',",
" ar_files = 'ar',",
" as_files = 'as',",
" compiler_files = 'compile',",
" dwp_files = 'dwp',",
" coverage_files = 'gcov',",
Expand All @@ -172,6 +178,8 @@ public void testFilesToBuild() throws Exception {
" name = 'darwin-toolchain',",
" module_map = 'map',",
" cpu = 'cpu',",
" ar_files = 'ar',",
" as_files = 'as',",
" compiler_files = 'compile',",
" dwp_files = 'dwp',",
" coverage_files = 'gcov',",
Expand All @@ -188,6 +196,8 @@ public void testFilesToBuild() throws Exception {
" name = 'windows-toolchain',",
" module_map = 'map',",
" cpu = 'cpu',",
" ar_files = 'ar',",
" as_files = 'as',",
" compiler_files = 'compile',",
" dwp_files = 'dwp',",
" coverage_files = 'gcov',",
Expand All @@ -204,6 +214,8 @@ public void testFilesToBuild() throws Exception {
" name = 'local_linux',",
" module_map = 'map',",
" cpu = 'cpu',",
" ar_files = 'ar',",
" as_files = 'as',",
" compiler_files = 'compile',",
" dwp_files = 'dwp',",
" coverage_files = 'gcov',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public void testFilesToBuild() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand All @@ -82,6 +84,8 @@ public void testInterfaceSharedObjects() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -152,6 +156,8 @@ public void testFission() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -281,6 +287,8 @@ public void testPic() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -331,6 +339,8 @@ public void testBadDynamicRuntimeLib() throws Exception {
"cc_toolchain(",
" name = 'a',",
" module_map = 'map',",
" ar_files = 'ar-a',",
" as_files = 'as-a',",
" cpu = 'cherry',",
" compiler_files = 'compile-a',",
" dwp_files = 'dwp-a',",
Expand Down Expand Up @@ -365,6 +375,8 @@ public void testTurnOffDynamicLinkWhenLipoBinary() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -405,6 +417,8 @@ public void testDynamicMode() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -469,6 +483,8 @@ private void writeDummyCcToolchain() throws IOException {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -604,6 +620,8 @@ public void assertInvalidIncludeDirectoryMessage(String entry, String messageReg
" name = 'b',",
" cpu = 'k8',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -651,6 +669,8 @@ public void testModuleMapAttribute() throws Exception {
" name = 'c',",
" module_map = 'map',",
" cpu = 'cherry',",
" ar_files = 'ar-cherry',",
" as_files = 'as-cherry',",
" compiler_files = 'compile-cherry',",
" dwp_files = 'dwp-cherry',",
" coverage_files = 'gcov-cherry',",
Expand All @@ -668,6 +688,8 @@ public void testModuleMapAttributeOptional() throws Exception {
"cc_toolchain(",
" name = 'c',",
" cpu = 'cherry',",
" ar_files = 'ar-cherry',",
" as_files = 'as-cherry',",
" compiler_files = 'compile-cherry',",
" dwp_files = 'dwp-cherry',",
" linker_files = 'link-cherry',",
Expand All @@ -686,6 +708,8 @@ public void testFailWithMultipleModuleMaps() throws Exception {
" name = 'c',",
" module_map = ':multiple-maps',",
" cpu = 'cherry',",
" ar_files = 'ar-cherry',",
" as_files = 'as-cherry',",
" compiler_files = 'compile-cherry',",
" dwp_files = 'dwp-cherry',",
" coverage_files = 'gcov-cherry',",
Expand Down Expand Up @@ -718,6 +742,8 @@ public void testFdoOptimizeInvalidUseGeneratedArtifact() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -748,6 +774,8 @@ public void testFdoOptimizeUnexpectedExtension() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -776,6 +804,8 @@ public void testFdoOptimizeNotInputFile() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':banana',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand All @@ -802,6 +832,8 @@ public void testInlineCtoolchain_withoutToolchainResolution() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':empty',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down Expand Up @@ -847,6 +879,8 @@ public void testInlineCtoolchain_withToolchainResolution() throws Exception {
" name = 'b',",
" cpu = 'banana',",
" all_files = ':empty',",
" ar_files = ':empty',",
" as_files = ':empty',",
" compiler_files = ':empty',",
" dwp_files = ':empty',",
" linker_files = ':empty',",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ filegroup(
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
all_files = ":linaro_linux_all_files",
ar_files = "//tools/arm_compiler/linaro_linux_gcc:ar",
as_files = "//tools/arm_compiler/linaro_linux_gcc:as",
compiler_files = ":linaro_linux_compiler_files",
cpu = "armeabi-v7a",
dwp_files = ":empty",
Expand All @@ -85,6 +87,8 @@ cc_toolchain(
cc_toolchain(
name = "cc-compiler-k8",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
cpu = "local",
dwp_files = ":empty",
Expand Down

0 comments on commit c0aca06

Please sign in to comment.