From 4b1999792537270b46d0750ff8b4155b10b0320c Mon Sep 17 00:00:00 2001 From: Dave MacLachlan Date: Mon, 7 Mar 2016 19:52:34 +0000 Subject: Add support for resources to bundling rules. Will need to release before we can remove resources from objcbinary rules. -- MOS_MIGRATED_REVID=116571890 --- examples/objc/BUILD | 15 ++++----------- .../devtools/build/lib/rules/objc/ObjcBinaryRule.java | 6 +++--- .../devtools/build/lib/rules/objc/ObjcRuleClasses.java | 8 ++++++-- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/examples/objc/BUILD b/examples/objc/BUILD index 66a8fa0e00..d6c833dffe 100644 --- a/examples/objc/BUILD +++ b/examples/objc/BUILD @@ -15,8 +15,11 @@ ios_application( name = "PrenotCalculator", binary = ":PrenotCalculator_binary", + bundles = [":PrenotCalculatorResources"], + datamodels = glob(["PrenotCalculator/DataModel.xcdatamodeld/**"]), infoplist = "PrenotCalculator/PrenotCalculator-Info.plist", visibility = ["//visibility:public"], + xibs = ["PrenotCalculator/CalculatorViewController.xib"], ) objc_binary( @@ -35,13 +38,8 @@ objc_binary( ["**/*.h"], exclude = ["PrenotCalculator/Expression.h"], ), - bundles = [":PrenotCalculatorResources"], sdk_frameworks = ["CoreData"], - xibs = ["PrenotCalculator/CalculatorViewController.xib"], - deps = [ - ":CoreDataResources", - ":ExpressionPrebuilt", - ], + deps = [":ExpressionPrebuilt"], ) # A prebuilt library that contains multiple architectures. @@ -77,11 +75,6 @@ objc_bundle_library( resources = glob(["PrenotCalculator/Resources/**"]), ) -objc_library( - name = "CoreDataResources", - datamodels = glob(["PrenotCalculator/DataModel.xcdatamodeld/**"]), -) - filegroup( name = "srcs", srcs = glob([ diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java index 9549ad1b21..cc21048f40 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java @@ -73,9 +73,9 @@ public class ObjcBinaryRule implements RuleDefinition {

This rule produces one or more Objective-C libraries for bundling in an ios_application.

-

Any application-related attributes (infoplist, app_icon, ...) on this rule are deprecated and -you should define them on ios_application instead. They will be removed from -objc_binary soon.

+

Any application-related attributes (infoplist, app_icon, resources, xibs, datamodels...) on this +rule are deprecated and you should define them on ios_application instead. They will be +removed from objc_binary soon.

Until the migration to ios_application is complete, this rule requires at least one source file to be defined in either srcs or non_arc_srcs

. diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java index aa280a2c3d..9935b2a0cd 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java @@ -827,8 +827,12 @@ public class ObjcRuleClasses { return RuleDefinition.Metadata.builder() .name("$objc_bundling_rule") .type(RuleClassType.ABSTRACT) - .ancestors(OptionsRule.class, ResourceToolsRule.class, XcrunRule.class, - AppleToolchain.RequiresXcodeConfigRule.class) + .ancestors( + AppleToolchain.RequiresXcodeConfigRule.class, + OptionsRule.class, + ResourcesRule.class, + ResourceToolsRule.class, + XcrunRule.class) .build(); } } -- cgit v1.2.3