Skip to content

Commit

Permalink
Move actoolzip, momczip and swiftstdlibtoolzip to tools/xcode and con…
Browse files Browse the repository at this point in the history
…vert them to scripts instead of java apps.

RELNOTES: actoolzip, momczip and swiftstdlibtoolzip have all been made into bash scripts and have been renamed to actoolwrapper, momcwrapper and swiftstdlibtoolwrapper respectively. The old versions will be deleted in a later change.

--
MOS_MIGRATED_REVID=104225062
  • Loading branch information
Dave MacLachlan authored and fweikert committed Sep 30, 2015
1 parent 1726aff commit 0bb2f02
Show file tree
Hide file tree
Showing 29 changed files with 277 additions and 349 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
/tools/jdk/GenClass_deploy.jar
/tools/jdk/SingleJar_deploy.jar
/tools/objc/*.jar
/tools/objc/ibtoolwrapper
/tools/objc/actoolwrapper.sh
/tools/objc/ibtoolwrapper.sh
/tools/objc/momctoolwrapper.sh
/tools/objc/realpath
/tools/objc/StdRedirect.dylib
/tools/objc/swiftstdlibtoolwrapper.sh
9 changes: 3 additions & 6 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,10 @@ if [ $DO_TOOLS_COMPILATION ]; then
bazel_bootstrap //src/java_tools/buildjar/java/com/google/devtools/build/buildjar/genclass:GenClass_deploy.jar \
tools/jdk/GenClass_deploy.jar
if [[ $PLATFORM == "darwin" ]]; then
bazel_bootstrap //src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip:actoolzip_deploy.jar \
tools/objc/precomp_actoolzip_deploy.jar
bazel_bootstrap //src/tools/xcode/actoolwrapper:actoolwrapper tools/objc/actoolwrapper.sh 0755
bazel_bootstrap //src/tools/xcode/ibtoolwrapper:ibtoolwrapper tools/objc/ibtoolwrapper.sh 0755
bazel_bootstrap //src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip:swiftstdlibtoolzip_deploy.jar \
tools/objc/precomp_swiftstdlibtoolzip_deploy.jar
bazel_bootstrap //src/objc_tools/momczip:momczip_deploy.jar \
tools/objc/precomp_momczip_deploy.jar
bazel_bootstrap //src/tools/xcode/momcwrapper:momcwrapper tools/objc/momcwrapper.sh 0755
bazel_bootstrap //src/tools/xcode/swiftstdlibtoolwrapper:swiftstdlibtoolwrapper tools/objc/swiftstdlibtoolzip.sh 0755
bazel_bootstrap //src/objc_tools/bundlemerge:bundlemerge_deploy.jar \
tools/objc/precomp_bundlemerge_deploy.jar
bazel_bootstrap //src/objc_tools/plmerge:plmerge_deploy.jar \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void registerInterfaceBuilderActions(ObjcProvider objcProvider) {
ruleContext.registerAction(
ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext)
.setMnemonic("StoryboardCompile")
.setExecutable(attributes.ibtoolwrapper())
.setExecutable(attributes.ibtoolWrapper())
.setCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, storyboardInput))
.addOutput(zipOutput)
.addInput(storyboardInput)
Expand Down Expand Up @@ -263,15 +263,17 @@ private void registerMomczipActions(ObjcProvider objcProvider) {
for (Xcdatamodel datamodel : xcdatamodels) {
Artifact outputZip = datamodel.getOutputZip();
ruleContext.registerAction(
ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(ruleContext, attributes.momczipDeployJar())
ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext)
.setMnemonic("MomCompile")
.setExecutable(attributes.momcWrapper())
.addOutput(outputZip)
.addInputs(datamodel.getInputs())
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/google/bazel/issues/285 is fixed.
.addInput(attributes.realpath())
.setCommandLine(CustomCommandLine.builder()
.addPath(outputZip.getExecPath())
.add(datamodel.archiveRootForMomczip())
.add(IosSdkCommands.MOMC_PATH)

.add("-XD_MOMC_SDKROOT=" + IosSdkCommands.sdkDir(objcConfiguration))
.add("-XD_MOMC_IOS_TARGET_VERSION=" + bundling.getMinimumOsVersion())
.add("-MOMC_PLATFORMS")
Expand All @@ -294,7 +296,7 @@ private void registerConvertXibsActions(ObjcProvider objcProvider) {
ruleContext.registerAction(
ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext)
.setMnemonic("XibCompile")
.setExecutable(attributes.ibtoolwrapper())
.setExecutable(attributes.ibtoolWrapper())
.setCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, original))
.addOutput(zipOutput)
.addInput(original)
Expand Down Expand Up @@ -373,11 +375,15 @@ private void registerActoolActionIfNecessary(ObjcProvider objcProvider) {
// zip file will be rooted at the bundle root, and we have to prepend the bundle root to each
// entry when merging it with the final .ipa file.
ruleContext.registerAction(
ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(ruleContext, attributes.actoolzipDeployJar())
ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext)
.setMnemonic("AssetCatalogCompile")
.setExecutable(attributes.actoolWrapper())
.addTransitiveInputs(objcProvider.get(ASSET_CATALOG))
.addOutput(zipOutput)
.addOutput(actoolPartialInfoplist)
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/google/bazel/issues/285 is fixed.
.addInput(attributes.realpath())
.setCommandLine(actoolzipCommandLine(
objcProvider,
zipOutput,
Expand All @@ -391,9 +397,6 @@ private CommandLine actoolzipCommandLine(ObjcProvider provider, Artifact zipOutp
CustomCommandLine.Builder commandLine = CustomCommandLine.builder()
// The next three arguments are positional, i.e. they don't have flags before them.
.addPath(zipOutput.getExecPath())
.add("") // archive root
.add(IosSdkCommands.ACTOOL_PATH)

.add("--platform").add(objcConfiguration.getBundlingPlatform().getLowerCaseNameInPlist())
.addExecPath("--output-partial-info-plist", partialInfoPlist)
.add("--minimum-deployment-target").add(bundling.getMinimumOsVersion());
Expand Down Expand Up @@ -464,7 +467,7 @@ ImmutableSet<TargetDeviceFamily> families() {
/**
* Returns the location of the ibtoolwrapper tool.
*/
FilesToRunProvider ibtoolwrapper() {
FilesToRunProvider ibtoolWrapper() {
return ruleContext.getExecutablePrerequisite("$ibtoolwrapper", Mode.HOST);
}

Expand All @@ -478,17 +481,17 @@ Artifact realpath() {
}

/**
* Returns the location of the momczip deploy jar.
* Returns the location of the momcwrapper.
*/
Artifact momczipDeployJar() {
return ruleContext.getPrerequisiteArtifact("$momczip_deploy", Mode.HOST);
FilesToRunProvider momcWrapper() {
return ruleContext.getExecutablePrerequisite("$momcwrapper", Mode.HOST);
}

/**
* Returns the location of the actoolzip deploy jar.
* Returns the location of the actoolwrapper.
*/
Artifact actoolzipDeployJar() {
return ruleContext.getPrerequisiteArtifact("$actoolzip_deploy", Mode.HOST);
FilesToRunProvider actoolWrapper() {
return ruleContext.getExecutablePrerequisite("$actoolwrapper", Mode.HOST);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
*/
public class IosSdkCommands {
public static final String DEVELOPER_DIR = "/Applications/Xcode.app/Contents/Developer";
public static final String ACTOOL_PATH = DEVELOPER_DIR + "/usr/bin/actool";
public static final String MOMC_PATH = DEVELOPER_DIR + "/usr/bin/momc";

// There is a handy reference to many clang warning flags at
// http://nshipster.com/clang-diagnostics/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class ObjcRuleClasses {
static final PathFragment LIBTOOL = new PathFragment(BIN_DIR + "/libtool");
static final PathFragment DSYMUTIL = new PathFragment(BIN_DIR + "/dsymutil");
static final PathFragment LIPO = new PathFragment(BIN_DIR + "/lipo");
static final PathFragment SWIFT_STDLIB_TOOL = new PathFragment(BIN_DIR + "/swift-stdlib-tool");
static final PathFragment STRIP = new PathFragment(BIN_DIR + "/strip");

private static final PathFragment JAVA = new PathFragment("/usr/bin/java");
Expand Down Expand Up @@ -499,16 +498,14 @@ public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$plmerge", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:plmerge")))
.add(attr("$actoolzip_deploy", LABEL).cfg(HOST)
.value(env.getLabel("//tools/objc:actoolzip_deploy.jar")))
.add(attr("$actoolwrapper", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:actoolwrapper")))
.add(attr("$ibtoolwrapper", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:ibtoolwrapper")))
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/bazelbuild/bazel/issues/285 is fixed.
.add(attr("$realpath", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:realpath")))
.add(attr("$swiftstdlibtoolzip_deploy", LABEL).cfg(HOST)
.value(env.getLabel("//tools/objc:swiftstdlibtoolzip_deploy.jar")))
.build();
}
@Override
Expand Down Expand Up @@ -892,8 +889,10 @@ public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("families", STRING_LIST)
.value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
.add(attr("$momczip_deploy", LABEL).cfg(HOST)
.value(env.getLabel("//tools/objc:momczip_deploy.jar")))
.add(attr("$momcwrapper", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:momcwrapper")))
.add(attr("$swiftstdlibtoolwrapper", LABEL).cfg(HOST).exec()
.value(env.getLabel("//tools/objc:swiftstdlibtoolwrapper")))
.build();
}
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,7 @@ private void registerEntitlementsVariableSubstitutionAction(Artifact in, Artifac
.build(ruleContext));
}

/**
* Registers an action to copy Swift standard library dylibs into app bundle.
*/
/** Registers an action to copy Swift standard library dylibs into app bundle. */
private void registerSwiftStdlibActionsIfNecessary() {
if (!objcProvider.is(USES_SWIFT)) {
return;
Expand All @@ -751,18 +749,19 @@ private void registerSwiftStdlibActionsIfNecessary() {

CustomCommandLine.Builder commandLine = CustomCommandLine.builder()
.addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath())
.add("Frameworks")
.addPath(ObjcRuleClasses.SWIFT_STDLIB_TOOL)
.add("--platform").add(IosSdkCommands.swiftPlatform(objcConfiguration))
.addExecPath("--scan-executable", intermediateArtifacts.combinedArchitectureBinary());

ruleContext.registerAction(
ObjcRuleClasses.spawnJavaOnDarwinActionBuilder(
ruleContext, attributes.swiftStdlibToolDeployJar())
ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext)
.setMnemonic("SwiftStdlibCopy")
.setExecutable(attributes.swiftStdlibToolWrapper())
.setCommandLine(commandLine.build())
.addOutput(intermediateArtifacts.swiftFrameworksFileZip())
.addInput(intermediateArtifacts.combinedArchitectureBinary())
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/google/bazel/issues/285 is fixed.
.addInput(attributes.realpath())
.build(ruleContext));
}

Expand Down Expand Up @@ -859,11 +858,18 @@ Artifact runnerScriptTemplate() {
ruleContext.getPrerequisiteArtifact("$runner_script_template", Mode.HOST));
}

/** Returns the location of the swiftstdlibtoolwrapper. */
FilesToRunProvider swiftStdlibToolWrapper() {
return ruleContext.getExecutablePrerequisite("$swiftstdlibtoolwrapper", Mode.HOST);
}

/**
* Returns the location of the swiftstdlibtoolzip deploy jar.
* Returns the location of the realpath tool.
* TODO(dmaclach): Should not be required once https://github.com/google/bazel/issues/285
* is fixed.
*/
Artifact swiftStdlibToolDeployJar() {
return ruleContext.getPrerequisiteArtifact("$swiftstdlibtoolzip_deploy", Mode.HOST);
Artifact realpath() {
return ruleContext.getPrerequisiteArtifact("$realpath", Mode.HOST);
}

/**
Expand Down Expand Up @@ -966,9 +972,7 @@ public boolean defaultsToSelf() {
return true;
}

/**
* Returns the configuration distinguisher for this transition instance.
*/
/** Returns the configuration distinguisher for this transition instance. */
protected ConfigurationDistinguisher getConfigurationDistinguisher() {
return ConfigurationDistinguisher.APPLICATION;
}
Expand Down
11 changes: 0 additions & 11 deletions src/objc_tools/momczip/BUILD

This file was deleted.

2 changes: 0 additions & 2 deletions src/objc_tools/momczip/README

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions src/test/shell/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ filegroup(
srcs = select({
":darwin": [
"//src/objc_tools/bundlemerge:bundlemerge_deploy.jar",
"//src/objc_tools/momczip:momczip_deploy.jar",
"//src/objc_tools/plmerge:plmerge_deploy.jar",
"//src/objc_tools/xcodegen:xcodegen_deploy.jar",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip:actoolzip_deploy.jar",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip:swiftstdlibtoolzip_deploy.jar",
"//src/tools/xcode/actoolwrapper",
"//src/tools/xcode/environment:environment_plist",
"//src/tools/xcode/ibtoolwrapper",
"//src/tools/xcode/momcwrapper",
"//src/tools/xcode/realpath",
"//src/tools/xcode/stdredirect:StdRedirect.dylib",
"//src/tools/xcode/swiftstdlibtoolwrapper",
"//third_party/iossim",
],
"//conditions:default": [],
Expand Down
8 changes: 4 additions & 4 deletions src/test/shell/bazel/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ EOF
# Sets up Objective-C tools. Mac only.
function setup_objc_test_support() {
mkdir -p tools/objc
[ -e tools/objc/precomp_actoolzip_deploy.jar ] || ln -sv ${actoolzip_path} tools/objc/precomp_actoolzip_deploy.jar
[ -e tools/objc/actoolwrapper.jar ] || ln -sv ${actoolwrapper_path} tools/objc/actoolwrapper.sh
[ -e tools/objc/ibtoolwrapper.sh ] || ln -sv ${ibtoolwrapper_path} tools/objc/ibtoolwrapper.sh
[ -e tools/objc/precomp_swiftstdlibtoolzip_deploy.jar ] || ln -sv ${swiftstdlibtoolzip_path} tools/objc/precomp_swiftstdlibtoolzip_deploy.jar
[ -e tools/objc/precomp_momczip_deploy.jar ] || ln -sv ${momczip_path} tools/objc/precomp_momczip_deploy.jar
[ -e tools/objc/momcwrapper.sh ] || ln -sv ${momcwrapper_path} tools/objc/momcwrapper.sh
[ -e tools/objc/precomp_bundlemerge_deploy.jar ] || ln -sv ${bundlemerge_path} tools/objc/precomp_bundlemerge_deploy.jar
[ -e tools/objc/precomp_plmerge_deploy.jar ] || ln -sv ${plmerge_path} tools/objc/precomp_plmerge_deploy.jar
[ -e tools/objc/precomp_xcodegen_deploy.jar ] || ln -sv ${xcodegen_path} tools/objc/precomp_xcodegen_deploy.jar
[ -e tools/objc/StdRedirect.dylib ] || ln -sv ${stdredirect_path} tools/objc/StdRedirect.dylib
[ -e tools/objc/swiftstdlibtoolwrapper.sh ] || ln -sv ${swiftstdlibtoolwrapper_path} tools/objc/swiftstdlibtoolwrapper.sh
[ -e tools/objc/realpath ] || ln -sv ${realpath_path} tools/objc/realpath
[ -e tools/objc/environment_plist.sh ] || ln -sv ${environment_plist_path} tools/objc/environment_plist.sh

Expand Down Expand Up @@ -413,7 +413,7 @@ function tear_down() {
# Simples assert to make the tests more readable
#
function assert_build() {
bazel build -s $* || fail "Failed to build $*"
bazel build -s --verbose_failures $* || fail "Failed to build $*"
}

function assert_build_output() {
Expand Down
6 changes: 3 additions & 3 deletions src/test/shell/bazel/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ incrementaldeployment_path="${TEST_SRCDIR}/src/tools/android/java/com/google/dev

# iOS and Objective-C tooling
iossim_path="${TEST_SRCDIR}/third_party/iossim/iossim"
actoolzip_path="${TEST_SRCDIR}/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/actoolzip_deploy.jar"
actoolwrapper_path="${TEST_SRCDIR}/src/tools/xcode/actoolwrapper/actoolwrapper.sh"
ibtoolwrapper_path="${TEST_SRCDIR}/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh"
swiftstdlibtoolzip_path="${TEST_SRCDIR}/src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip/swiftstdlibtoolzip_deploy.jar"
momczip_path="${TEST_SRCDIR}/src/objc_tools/momczip/momczip_deploy.jar"
swiftstdlibtoolwrapper_path="${TEST_SRCDIR}/src/tools/xcode/swiftstdlibtoolwrapper/swiftstdlibtoolwrapper.sh"
momcwrapper_path="${TEST_SRCDIR}/src/tools/xcode/momcwrapper/momcwrapper.sh"
bundlemerge_path="${TEST_SRCDIR}/src/objc_tools/bundlemerge/bundlemerge_deploy.jar"
plmerge_path="${TEST_SRCDIR}/src/objc_tools/plmerge/plmerge_deploy.jar"
xcodegen_path="${TEST_SRCDIR}/src/objc_tools/xcodegen/xcodegen_deploy.jar"
Expand Down
2 changes: 0 additions & 2 deletions src/tools/xcode-common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package(default_visibility = ["//src/test:__subpackages__"])
filegroup(
name = "srcs",
srcs = [
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/common:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/swiftstdlibtoolzip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/util:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/zip:srcs",
"//src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput:srcs",
Expand Down
Loading

0 comments on commit 0bb2f02

Please sign in to comment.