diff options
author | Erik Abair <abaire@google.com> | 2016-04-06 15:02:02 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2016-04-07 11:46:32 +0000 |
commit | 2e59ad744028349d8a0d188edf89e233ac3d9bbf (patch) | |
tree | 82417019edf1ec2c2a8d9a03463da1e7e90356cb /src | |
parent | e804017809ed3990bbb2f5e6b6cffdcf037349f6 (diff) |
Expose ObjcConfiguration to Skylark as fragment "objc" along with callable methods to return compiler options useful for reflection in aspects.
RELNOTES[NEW]: Objective-C compiler information is now available to Skylark.
--
MOS_MIGRATED_REVID=119160290
Diffstat (limited to 'src')
3 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentCollection.java b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentCollection.java index f1ff98f83b..b68c7b53f4 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentCollection.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/FragmentCollection.java @@ -30,7 +30,8 @@ import javax.annotation.Nullable; @Immutable @SkylarkModule(name = "fragments", doc = "Possible fields are " + "<a href=\"apple.html\">apple</a>, <a href=\"cpp.html\">cpp</a>, " - + "<a href=\"java.html\">java</a> and <a href=\"jvm.html\">jvm</a>. " + + "<a href=\"java.html\">java</a>, <a href=\"jvm.html\">jvm</a> and " + + "<a href=\"objc.html\">objc</a>. " + "Access a specific fragment by its field name ex:</p><code>ctx.fragments.apple</code></p>" + "Note that rules have to declare their required fragments in order to access them " + "(see <a href=\"../rules.html#fragments\">here</a>).") diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD b/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD index 2a39562aed..24d6dfb76b 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BUILD @@ -19,6 +19,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib:packages-internal", "//src/main/java/com/google/devtools/build/lib:proto-rules", "//src/main/java/com/google/devtools/build/lib:shell", + "//src/main/java/com/google/devtools/build/lib:skylarkinterface", "//src/main/java/com/google/devtools/build/lib:util", "//src/main/java/com/google/devtools/build/lib:vfs", "//src/main/java/com/google/devtools/build/lib/actions", diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java index 36f73aa8ae..ec85472ae8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java @@ -24,6 +24,8 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.rules.apple.DottedVersion; import com.google.devtools.build.lib.rules.objc.ReleaseBundlingSupport.SplitArchTransition.ConfigurationDistinguisher; +import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; +import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.vfs.Path; @@ -36,6 +38,7 @@ import javax.annotation.Nullable; /** * A compiler configuration containing flags required for Objective-C compilation. */ +@SkylarkModule(name = "objc", doc = "A configuration fragment for Objective-C") @Immutable public class ObjcConfiguration extends BuildConfiguration.Fragment { @VisibleForTesting @@ -141,6 +144,9 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment { /** * Returns the default set of clang options for the current compilation mode. */ + @SkylarkCallable(name = "copts_for_current_compilation_mode", structField = true, + doc = "Returns a list of default options to use for compiling Objective-C in the current " + + "mode.") public ImmutableList<String> getCoptsForCompilationMode() { switch (compilationMode) { case DBG: @@ -165,6 +171,10 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment { * Returns options passed to (Apple) clang when compiling Objective C. These options should be * applied after any default options but before options specified in the attributes of the rule. */ + @SkylarkCallable(name = "copts", structField = true, + doc = "Returns a list of options to use for compiling Objective-C." + + "These options are applied after any default options but before options specified in the " + + "attributes of the rule.") public ImmutableList<String> getCopts() { return copts; } |