Skip to content

Commit

Permalink
Expose AppleConfiguration to skylark as fragment "apple", along with …
Browse files Browse the repository at this point in the history
…a callable method apple_host_system_env to return environment variables needed for various commands on apple hosts.

--
MOS_MIGRATED_REVID=114550659
  • Loading branch information
c-parsons authored and damienmg committed Feb 15, 2016
1 parent 500175f commit accfc2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,23 +461,21 @@ public Label getLabel() {
}

@SkylarkCallable(name = "fragments", structField = true,
doc =
"Allows access to configuration fragments in target configuration. "
+ "Possible fields are <code>cpp</code>, "
+ "<code>java</code> and <code>jvm</code>. "
+ "However, rules have to declare their required fragments in order to access them "
+ "(see <a href=\"../rules.html#fragments\">here</a>).")
doc = "Allows access to configuration fragments in target configuration. "
+ "Possible fields are <code>apple</code>, <code>cpp</code>, "
+ "<code>java</code> and <code>jvm</code>. "
+ "However, rules have to declare their required fragments in order to access them "
+ "(see <a href=\"../rules.html#fragments\">here</a>).")
public FragmentCollection getFragments() {
return fragments;
}

@SkylarkCallable(name = "host_fragments", structField = true,
doc =
"Allows access to configuration fragments in host configuration. "
+ "Possible fields are <code>cpp</code>, "
+ "<code>java</code> and <code>jvm</code>. "
+ "However, rules have to declare their required fragments in order to access them "
+ "(see <a href=\"../rules.html#fragments\">here</a>).")
doc = "Allows access to configuration fragments in host configuration. "
+ "Possible fields are <code>apple</code>, <code>cpp</code>, "
+ "<code>java</code> and <code>jvm</code>. "
+ "However, rules have to declare their required fragments in order to access them "
+ "(see <a href=\"../rules.html#fragments\">here</a>).")
public FragmentCollection getHostFragments() {
return hostFragments;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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.AppleCommandLineOptions.AppleBitcodeMode;
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 java.util.Map;
Expand All @@ -36,6 +38,7 @@
/**
* A configuration containing flags required for Apple platforms and tools.
*/
@SkylarkModule(name = "apple", doc = "A configuration fragment for Apple platforms")
@Immutable
public class AppleConfiguration extends BuildConfiguration.Fragment {
public static final String XCODE_VERSION_ENV_NAME = "XCODE_VERSION_OVERRIDE";
Expand Down Expand Up @@ -107,6 +110,13 @@ public Map<String, String> getEnvironmentForIosAction() {
* apple host system. These environment variables are needed by the apple toolchain. Keys are
* variable names and values are their corresponding values.
*/
@SkylarkCallable(
name = "apple_host_system_env",
doc =
"Returns a map of environment variables that should be propagated for actions that "
+ "build on an apple host system. These environment variables are needed by the apple "
+ "toolchain. Keys are variable names and values are their corresponding values."
)
public Map<String, String> getAppleHostSystemEnv() {
Optional<DottedVersion> xcodeVersion = getXcodeVersion();
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:packages-internal",
"//src/main/java/com/google/devtools/build/lib:preconditions",
"//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:syntax",
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
Expand Down

0 comments on commit accfc2c

Please sign in to comment.