From 91d870e65de28e92b03b518b41afdf659ce832ac Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Fri, 22 May 2015 13:44:06 +0000 Subject: Expose more CppConfiguration functions to Skylark. -- MOS_MIGRATED_REVID=94274156 --- .../build/lib/rules/cpp/CppConfiguration.java | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/google/devtools/build') diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java index e0860644f8..10ba9c8f37 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java @@ -1143,6 +1143,10 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * different sysroots, or the sysroot is the same as the default sysroot, then * this method returns null. */ + @SkylarkCallable(name = "sysroot", structField = true, + doc = "Returns the sysroot to be used. If the toolchain compiler does not support " + + "different sysroots, or the sysroot is the same as the default sysroot, then " + + "this method returns None.") public PathFragment getSysroot() { return sysroot; } @@ -1160,8 +1164,13 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * Returns the default options to use for compiling C, C++, and assembler. * This is just the options that should be used for all three languages. * There may be additional C-specific or C++-specific options that should be used, - * in addition to the ones returned by this method; + * in addition to the ones returned by this method. */ + @SkylarkCallable(name = "compiler_options", + doc = "Returns the default options to use for compiling C, C++, and assembler. " + + "This is just the options that should be used for all three languages. " + + "There may be additional C-specific or C++-specific options that should be used, " + + "in addition to the ones returned by this method") public List getCompilerOptions(Collection features) { return compilerFlags.evaluate(features); } @@ -1171,6 +1180,10 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * C. These should be go on the command line after the common options * returned by {@link #getCompilerOptions}. */ + @SkylarkCallable(name = "c_options", structField = true, + doc = "Returns the list of additional C-specific options to use for compiling C. " + + "These should be go on the command line after the common options returned by " + + "compiler_options") public List getCOptions() { return cOptions; } @@ -1180,6 +1193,10 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * C++. These should be go on the command line after the common options * returned by {@link #getCompilerOptions}. */ + @SkylarkCallable(name = "cxx_options", + doc = "Returns the list of additional C++-specific options to use for compiling C++. " + + "These should be go on the command line after the common options returned by " + + "compiler_options") public List getCxxOptions(Collection features) { return cxxFlags.evaluate(features); } @@ -1188,6 +1205,9 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * Returns the default list of options which cannot be filtered by BUILD * rules. These should be appended to the command line after filtering. */ + @SkylarkCallable(name = "unfiltered_compiler_options", + doc = "Returns the default list of options which cannot be filtered by BUILD " + + "rules. These should be appended to the command line after filtering.") public List getUnfilteredCompilerOptions(Collection features) { return unfilteredCompilerFlags.evaluate(features); } @@ -1199,6 +1219,9 @@ public class CppConfiguration extends BuildConfiguration.Fragment { * @see Link */ // TODO(bazel-team): Clean up the linker options computation! + @SkylarkCallable(name = "link_options", structField = true, + doc = "Returns the set of command-line linker options, including any flags " + + "inferred from the command-line options.") public List getLinkOptions() { return linkOptions; } @@ -1647,6 +1670,8 @@ public class CppConfiguration extends BuildConfiguration.Fragment { /** * Returns the GNU System Name */ + @SkylarkCallable(name = "target_gnu_system_name", structField = true, + doc = "The GNU System Name.") public String getTargetGnuSystemName() { return targetSystemName; } -- cgit v1.2.3