aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode-common
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-05-22 00:38:39 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-05-22 19:59:42 +0000
commita56a58b7c63f32ffb7ec08b4d223d6e5bd14befc (patch)
treee5c07641de11e5aa9cee1bf9268b91a30b2c5aa9 /src/tools/xcode-common
parente6566da66cff3511f6dfcad5d8dfe9a1cde767a9 (diff)
Fixes for several issues with using ibtool.
Added support for errors, warnings, notices from ibtool Canonicalizes paths passed to ibtool to get around radar 21045660 'ibtool has difficulty dealing with relative paths'. Added support for module argument to ibtool. Consolidates argument passing for storyboards and xibs. Sets output for ibtool to human readable. Turns on auto-activate-custom-fonts for ibtool to match Xcode invocations. -- MOS_MIGRATED_REVID=94240330
Diffstat (limited to 'src/tools/xcode-common')
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java19
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/ibtoolzip/IbtoolZip.java21
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java24
3 files changed, 44 insertions, 20 deletions
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java
index b028ae5947..8839fae067 100644
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/actoolzip/ActoolZip.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.xcode.actoolzip;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -35,22 +34,6 @@ import java.util.Set;
*/
public class ActoolZip implements Wrapper {
- private static final Function<String, String> CANONICAL_PATH =
- new Function<String, String>() {
- @Override
- public String apply(String path) {
- File file = new File(path);
- if (file.exists()) {
- try {
- return file.getCanonicalPath();
- } catch (IOException e) {
- // Pass through to return raw path
- }
- }
- return path;
- }
- };
-
@Override
public String name() {
return "ActoolZip";
@@ -69,7 +52,7 @@ public class ActoolZip implements Wrapper {
.add(outputDirectory)
// actool munges paths in some way which doesn't work if one of the directories in the path
// is a symlink.
- .addAll(Iterables.transform(args.subtoolExtraArgs(), CANONICAL_PATH))
+ .addAll(Iterables.transform(args.subtoolExtraArgs(), Wrappers.CANONICALIZE_IF_PATH))
.build();
}
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/ibtoolzip/IbtoolZip.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/ibtoolzip/IbtoolZip.java
index 892053b1f6..180f541bc8 100644
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/ibtoolzip/IbtoolZip.java
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/ibtoolzip/IbtoolZip.java
@@ -15,6 +15,7 @@
package com.google.devtools.build.xcode.ibtoolzip;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import com.google.devtools.build.xcode.zippingoutput.Arguments;
import com.google.devtools.build.xcode.zippingoutput.Wrapper;
import com.google.devtools.build.xcode.zippingoutput.Wrappers;
@@ -39,11 +40,27 @@ public class IbtoolZip implements Wrapper {
@Override
public Iterable<String> subCommand(Arguments args, String outputDirectory) {
+ // If we are running into problems figuring out ibtool issues, there are a couple
+ // of env variables that may help. Both of the following must be set to work.
+ // IBToolDebugLogFile=<OUTPUT FILE PATH>
+ // IBToolDebugLogLevel=4
+ // you may also see if
+ // IBToolNeverDeque=1
+ // helps.
+
+ // IBTool needs to have absolute paths sent to it, so we call CANONICALIZE_IF_PATH
+ // on all of them.
+ // Radar 21045660 ibtool has difficulty dealing with relative paths.
return new ImmutableList.Builder<String>()
.add(args.subtoolCmd())
+ .add("--errors")
+ .add("--warnings")
+ .add("--notices")
+ .add("--auto-activate-custom-fonts")
+ .add("--output-format").add("human-readable-text")
.add("--compile")
- .add(outputDirectory)
- .addAll(args.subtoolExtraArgs())
+ .add(Wrappers.CANONICALIZE_IF_PATH.apply(outputDirectory))
+ .addAll(Iterables.transform(args.subtoolExtraArgs(), Wrappers.CANONICALIZE_IF_PATH))
.build();
}
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
index 7d4df044d7..99af344362 100644
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
@@ -14,11 +14,13 @@
package com.google.devtools.build.xcode.zippingoutput;
+import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.io.CharStreams;
import com.google.devtools.build.singlejar.ZipCombiner;
import com.google.devtools.build.xcode.zip.ZipInputEntry;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -39,6 +41,28 @@ public class Wrappers {
}
/**
+ * Takes the string and canonicalizes if it is a path that exists on the file system.
+ * If it does not exist on the file system, returns the string passed in unchanged.
+ */
+ public static final Function<String, String> CANONICALIZE_IF_PATH =
+ new Function<String, String>() {
+ @Override
+ public String apply(String path) {
+ if (!path.startsWith("-")) {
+ File file = new File(path);
+ if (file.exists()) {
+ try {
+ return file.getCanonicalPath();
+ } catch (IOException e) {
+ // Pass through to return raw path
+ }
+ }
+ }
+ return path;
+ }
+ };
+
+ /**
* Executes the command specified by argsArray and wrapper, writing the output directly to this
* Java process's stdout/stderr. Calling this method should be the last thing you do in
* {@code main}, because it may exit prematurely with {@link System#exit(int)}.