aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc
diff options
context:
space:
mode:
authorGravatar cparsons <cparsons@google.com>2018-06-01 09:08:26 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-01 09:10:07 -0700
commitc2d79da3578470e46f0e198e45ab3ce1ea03dfab (patch)
tree311010cbdc24787c110539e723319c4f674d4532 /src/main/java/com/google/devtools/build/lib/rules/objc
parentcc8647532686b4a3075b500e73fad8cb02ddafe0 (diff)
Migrate remaining apple-related skylark types to skylarkbuildapi
RELNOTES: None. PiperOrigin-RevId: 198880301
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleDebugOutputsInfo.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleDylibBinaryInfo.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleExecutableBinaryInfo.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/AppleLoadableBundleBinaryInfo.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java63
6 files changed, 36 insertions, 136 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDebugOutputsInfo.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDebugOutputsInfo.java
index e2d70007fd..b8078da51b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDebugOutputsInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDebugOutputsInfo.java
@@ -19,9 +19,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.packages.NativeProvider;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleDebugOutputsApi;
import java.util.HashMap;
import java.util.Map;
@@ -40,12 +38,8 @@ import java.util.Map;
* <p>Example: { "arm64": { "bitcode_symbols": Artifact, "dsym_binary": Artifact } }
*/
@Immutable
-@SkylarkModule(
- name = "AppleDebugOutputs",
- category = SkylarkModuleCategory.PROVIDER,
- doc = "A provider that holds debug outputs of an apple_binary target."
-)
-public final class AppleDebugOutputsInfo extends NativeInfo {
+public final class AppleDebugOutputsInfo extends NativeInfo
+ implements AppleDebugOutputsApi<Artifact> {
/** Expected types of debug outputs. */
enum OutputType {
@@ -98,13 +92,7 @@ public final class AppleDebugOutputsInfo extends NativeInfo {
/**
* Returns the multi-architecture dylib binary that apple_binary created.
*/
- @SkylarkCallable(name = "outputs_map",
- structField = true,
- doc = "A dictionary of: { arch: { output_type: file, output_type: file, ... } }, "
- + "where 'arch' is any Apple architecture such as 'arm64' or 'armv7', 'output_type' is "
- + "a string descriptor such as 'bitcode_symbols' or 'dsym_binary', and the file is the "
- + "file matching that descriptor for that architecture."
- )
+ @Override
public ImmutableMap<String, ImmutableMap<String, Artifact>> getOutputsMap() {
return outputsMap;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDylibBinaryInfo.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDylibBinaryInfo.java
index aeed29b092..4905b5d312 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDylibBinaryInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleDylibBinaryInfo.java
@@ -18,9 +18,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.packages.NativeProvider;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleDylibBinaryApi;
/**
* Provider containing the executable binary output that was built using an apple_binary target with
@@ -34,13 +32,7 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
* </ul>
*/
@Immutable
-@SkylarkModule(
- name = "AppleDylibBinary",
- category = SkylarkModuleCategory.PROVIDER,
- doc = "A provider containing the executable binary output that was built using an apple_binary "
- + "target with the 'dylib' type."
-)
-public final class AppleDylibBinaryInfo extends NativeInfo {
+public final class AppleDylibBinaryInfo extends NativeInfo implements AppleDylibBinaryApi {
/** Skylark name for the AppleDylibBinaryInfo. */
public static final String SKYLARK_NAME = "AppleDylibBinary";
@@ -62,10 +54,7 @@ public final class AppleDylibBinaryInfo extends NativeInfo {
/**
* Returns the multi-architecture dylib binary that apple_binary created.
*/
- @SkylarkCallable(name = "binary",
- structField = true,
- doc = "The dylib file output by apple_binary."
- )
+ @Override
public Artifact getAppleDylibBinary() {
return dylibBinary;
}
@@ -74,12 +63,7 @@ public final class AppleDylibBinaryInfo extends NativeInfo {
* Returns the {@link ObjcProvider} which contains information about the transitive dependencies
* linked into the dylib.
*/
- @SkylarkCallable(name = "objc",
- structField = true,
- doc = "A provider which contains information about the transitive dependencies linked into "
- + "the dylib, (intended so that binaries depending on this dylib may avoid relinking "
- + "symbols included in the dylib."
- )
+ @Override
public ObjcProvider getDepsObjcProvider() {
return depsObjcProvider;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleExecutableBinaryInfo.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleExecutableBinaryInfo.java
index 374d9bedaf..bbe9625809 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleExecutableBinaryInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleExecutableBinaryInfo.java
@@ -18,9 +18,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.packages.NativeProvider;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleExecutableBinaryApi;
/**
* Provider containing the executable binary output that was built using an apple_binary target with
@@ -34,13 +32,8 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
* </ul>
*/
@Immutable
-@SkylarkModule(
- name = "AppleExecutableBinary",
- category = SkylarkModuleCategory.PROVIDER,
- doc = "A provider containing the executable binary output that was built using an "
- + "apple_binary target with the 'executable' type."
-)
-public final class AppleExecutableBinaryInfo extends NativeInfo {
+public final class AppleExecutableBinaryInfo extends NativeInfo
+ implements AppleExecutableBinaryApi {
/** Skylark name for the AppleExecutableBinaryInfo. */
public static final String SKYLARK_NAME = "AppleExecutableBinary";
@@ -67,10 +60,7 @@ public final class AppleExecutableBinaryInfo extends NativeInfo {
/**
* Returns the multi-architecture executable binary that apple_binary created.
*/
- @SkylarkCallable(name = "binary",
- structField = true,
- doc = "The executable binary file output by apple_binary."
- )
+ @Override
public Artifact getAppleExecutableBinary() {
return appleExecutableBinary;
}
@@ -79,11 +69,7 @@ public final class AppleExecutableBinaryInfo extends NativeInfo {
* Returns the {@link ObjcProvider} which contains information about the transitive dependencies
* linked into the dylib.
*/
- @SkylarkCallable(name = "objc",
- structField = true,
- doc = "A provider which contains information about the transitive dependencies linked into "
- + "the binary."
- )
+ @Override
public ObjcProvider getDepsObjcProvider() {
return depsObjcProvider;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleLoadableBundleBinaryInfo.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleLoadableBundleBinaryInfo.java
index ea2cb6602f..e788db3316 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleLoadableBundleBinaryInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleLoadableBundleBinaryInfo.java
@@ -18,9 +18,7 @@ import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.packages.NativeInfo;
import com.google.devtools.build.lib.packages.NativeProvider;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.AppleLoadableBundleBinaryApi;
/**
* Provider containing the executable binary output that was built using an apple_binary target with
@@ -33,13 +31,8 @@ import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
* </ul>
*/
@Immutable
-@SkylarkModule(
- name = "AppleLoadableBundleBinary",
- category = SkylarkModuleCategory.PROVIDER,
- doc = "A provider containing the executable binary output that was built using an "
- + "apple_binary target with the 'loadable_bundle' type."
-)
-public final class AppleLoadableBundleBinaryInfo extends NativeInfo {
+public final class AppleLoadableBundleBinaryInfo extends NativeInfo
+ implements AppleLoadableBundleBinaryApi {
/** Skylark name for the AppleLoadableBundleBinary. */
public static final String SKYLARK_NAME = "AppleLoadableBundleBinary";
@@ -66,10 +59,7 @@ public final class AppleLoadableBundleBinaryInfo extends NativeInfo {
/**
* Returns the multi-architecture binary that apple_binary created.
*/
- @SkylarkCallable(name = "binary",
- structField = true,
- doc = "The binary file output by apple_binary."
- )
+ @Override
public Artifact getAppleLoadableBundleBinary() {
return appleLoadableBundleBinary;
}
@@ -78,11 +68,7 @@ public final class AppleLoadableBundleBinaryInfo extends NativeInfo {
* Returns the {@link ObjcProvider} which contains information about the transitive dependencies
* linked into the dylib.
*/
- @SkylarkCallable(name = "objc",
- structField = true,
- doc = "A provider which contains information about the transitive dependencies linked into "
- + "the binary."
- )
+ @Override
public ObjcProvider getDepsObjcProvider() {
return depsObjcProvider;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java
index 477b3144a5..ab1364f9fb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcConfiguration.java
@@ -27,9 +27,7 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.J2ObjcConfigurationApi;
import java.util.Collections;
import javax.annotation.Nullable;
@@ -40,12 +38,7 @@ import javax.annotation.Nullable;
*/
@AutoCodec
@Immutable
-@SkylarkModule(
- name = "j2objc",
- category = SkylarkModuleCategory.CONFIGURATION_FRAGMENT,
- doc = "A configuration fragment for j2Objc."
-)
-public class J2ObjcConfiguration extends Fragment {
+public class J2ObjcConfiguration extends Fragment implements J2ObjcConfigurationApi {
/**
* Always-on flags for J2ObjC translation. These flags are always used when invoking the J2ObjC
* transpiler, and cannot be overridden by user-specified flags in {@link
@@ -131,11 +124,7 @@ public class J2ObjcConfiguration extends Fragment {
* #J2OBJC_ALWAYS_ON_TRANSLATION_FLAGS}. The set of disallowed flags can be found at
* {@link #J2OBJC_BLACKLISTED_TRANSLATION_FLAGS}.
*/
- @SkylarkCallable(
- name = "translation_flags",
- structField = true,
- doc = "The list of flags to be used when the j2objc compiler is invoked. "
- )
+ @Override
public ImmutableList<String> getTranslationFlags() {
return translationFlags;
}
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 70fb596d70..4f0e5e19cc 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
@@ -25,20 +25,14 @@ import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
import com.google.devtools.build.lib.rules.apple.DottedVersion;
import com.google.devtools.build.lib.rules.cpp.HeaderDiscovery;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
-import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
+import com.google.devtools.build.lib.skylarkbuildapi.apple.ObjcConfigurationApi;
import javax.annotation.Nullable;
/** A compiler configuration containing flags required for Objective-C compilation. */
@AutoCodec
-@SkylarkModule(
- name = "objc",
- category = SkylarkModuleCategory.CONFIGURATION_FRAGMENT,
- doc = "A configuration fragment for Objective-C."
-)
@Immutable
-public class ObjcConfiguration extends BuildConfiguration.Fragment {
+public class ObjcConfiguration extends BuildConfiguration.Fragment
+ implements ObjcConfigurationApi<PlatformType> {
@VisibleForTesting
static final ImmutableList<String> DBG_COPTS =
ImmutableList.of("-O0", "-DDEBUG=1", "-fstack-protector", "-fstack-protector-all", "-g");
@@ -175,23 +169,19 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
/**
* Returns the type of device (e.g. 'iPhone 6') to simulate when running on the simulator.
*/
- @SkylarkCallable(name = "ios_simulator_device", structField = true,
- doc = "The type of device (e.g. 'iPhone 6') to use when running on the simulator.")
+ @Override
public String getIosSimulatorDevice() {
// TODO(bazel-team): Deprecate in favor of getSimulatorDeviceForPlatformType(IOS).
return iosSimulatorDevice;
}
- @SkylarkCallable(name = "ios_simulator_version", structField = true,
- doc = "The SDK version of the iOS simulator to use when running on the simulator.")
+ @Override
public DottedVersion getIosSimulatorVersion() {
// TODO(bazel-team): Deprecate in favor of getSimulatorVersionForPlatformType(IOS).
return iosSimulatorVersion;
}
- @SkylarkCallable(
- name = "simulator_device_for_platform_type",
- doc = "The type of device (e.g., 'iPhone 6' to simulate when running on the simulator.")
+ @Override
public String getSimulatorDeviceForPlatformType(PlatformType platformType) {
switch (platformType) {
case IOS:
@@ -206,9 +196,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
}
}
- @SkylarkCallable(
- name = "simulator_version_for_platform_type",
- doc = "The SDK version of the simulator to use when running on the simulator.")
+ @Override
public DottedVersion getSimulatorVersionForPlatformType(PlatformType platformType) {
switch (platformType) {
case IOS:
@@ -226,10 +214,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
/**
* Returns whether dSYM generation is enabled.
*/
- @SkylarkCallable(
- name = "generate_dsym",
- doc = "Whether to generate debug symbol(.dSYM) artifacts.",
- structField = true)
+ @Override
public boolean generateDsym() {
return generateDsym;
}
@@ -237,19 +222,12 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
/**
* Returns whether linkmap generation is enabled.
*/
- @SkylarkCallable(
- name = "generate_linkmap",
- doc = "Whether to generate linkmap artifacts.",
- structField = true)
+ @Override
public boolean generateLinkmap() {
return generateLinkmap;
}
- @SkylarkCallable(
- name = "run_memleaks",
- structField = true,
- doc = "Returns a boolean indicating whether memleaks should be run during tests or not."
- )
+ @Override
public boolean runMemleaks() {
return runMemleaks;
}
@@ -264,9 +242,7 @@ 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.")
+ @Override
public ImmutableList<String> getCoptsForCompilationMode() {
switch (compilationMode) {
case DBG:
@@ -291,10 +267,7 @@ 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.")
+ @Override
public ImmutableList<String> getCopts() {
return copts;
}
@@ -318,10 +291,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
* Returns the flag-supplied certificate name to be used in signing or {@code null} if no such
* certificate was specified.
*/
- @Nullable
- @SkylarkCallable(name = "signing_certificate_name", structField = true, allowReturnNones = true,
- doc = "Returns the flag-supplied certificate name to be used in signing, or None if no such "
- + "certificate was specified.")
+ @Override
public String getSigningCertName() {
return this.signingCertName;
}
@@ -340,16 +310,13 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment {
* <p>Note that debug entitlements will be included only if the --device_debug_entitlements flag
* is set <b>and</b> the compilation mode is not {@code opt}.
*/
- @SkylarkCallable(name = "uses_device_debug_entitlements", structField = true,
- doc = "Returns whether device debug entitlements should be included when signing an "
- + "application.")
+ @Override
public boolean useDeviceDebugEntitlements() {
return deviceDebugEntitlements && compilationMode != CompilationMode.OPT;
}
/** Returns true if apple_binary targets should generate and link Objc protos. */
- @SkylarkCallable(name = "enable_apple_binary_native_protos", structField = true,
- doc = "Returns whether apple_binary should generate and link protos natively.")
+ @Override
public boolean enableAppleBinaryNativeProtos() {
return enableAppleBinaryNativeProtos;
}