Fix the build on MacOS

The build on MacOS fails (https://github.com/google/nomulus/issues/67) due to different syntax for sed on BSD vs. Linux.

See this StackOverflow discussion: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux

Also adds a newline between @SuppressWarnings annotation and the class definition.

Note that MacOS support is best-effort only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161661181
This commit is contained in:
jianglai 2017-07-12 07:11:52 -07:00
parent 77b8729ec6
commit b235565eef

View file

@ -44,9 +44,9 @@ genrule(
"cp $(SRCS) $$TMP", "cp $(SRCS) $$TMP",
"cd $$TMP", "cd $$TMP",
"$$XJC -npa -quiet -extension -d $$OUT -b *.xjb *.xsd", "$$XJC -npa -quiet -extension -d $$OUT -b *.xjb *.xsd",
("find $$OUT -name '*.java' | xargs sed -i 's/" + ("find $$OUT -name '*.java' | xargs sed -i.bak 's/" +
"public class/" + "public class/" +
"@SuppressWarnings({\"unchecked\",\"serial\",\"cast\"}) " + "@SuppressWarnings({\"unchecked\",\"serial\",\"cast\"})\\\n" +
"public class/'"), "public class/'"),
"cd $$REP", "cd $$REP",
"rm -rf $$TMP", "rm -rf $$TMP",