mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 09:57:17 +02:00
Clean up some genrule() script code
The XJC genrule in particular was dirtying /tmp which I believe may have been causing problems for Donuts. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129451600
This commit is contained in:
parent
e1d02d1ea5
commit
3f4121b98c
3 changed files with 25 additions and 17 deletions
|
@ -15,6 +15,7 @@ sh_binary(
|
||||||
"//third_party/java/jaxb:jaxb-xjc",
|
"//third_party/java/jaxb:jaxb-xjc",
|
||||||
"//java/google/registry/xml:xml_schema_files",
|
"//java/google/registry/xml:xml_schema_files",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
genrule(
|
genrule(
|
||||||
|
@ -25,23 +26,29 @@ genrule(
|
||||||
],
|
],
|
||||||
outs = xjc_generated_files,
|
outs = xjc_generated_files,
|
||||||
cmd = " && ".join([
|
cmd = " && ".join([
|
||||||
"XJC=$$PWD/$(location //third_party/java/jaxb:jaxb-xjc)",
|
"REP=$$(pwd)",
|
||||||
"OUT=$$PWD/$(GENDIR)/java",
|
"XJC=$$REP/$(location //third_party/java/jaxb:jaxb-xjc)",
|
||||||
|
"OUT=$$REP/$(GENDIR)/java",
|
||||||
|
"TMP=$$(mktemp -d $${TMPDIR:-/tmp}/jaxb.XXXXXXXXXX)",
|
||||||
"mkdir -p $$OUT",
|
"mkdir -p $$OUT",
|
||||||
"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 's/" +
|
||||||
"public class/" +
|
"public class/" +
|
||||||
"@SuppressWarnings({\"unchecked\",\"serial\",\"cast\"}) " +
|
"@SuppressWarnings({\"unchecked\",\"serial\",\"cast\"}) " +
|
||||||
"public class/'",
|
"public class/'"),
|
||||||
|
"cd $$REP",
|
||||||
|
"rm -rf $$TMP",
|
||||||
]),
|
]),
|
||||||
tools = ["//third_party/java/jaxb:jaxb-xjc"],
|
tools = ["//third_party/java/jaxb:jaxb-xjc"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
sh_binary(
|
sh_binary(
|
||||||
name = "make_pkginfo",
|
name = "make_pkginfo",
|
||||||
srcs = ["make_pkginfo.sh"],
|
srcs = ["make_pkginfo.sh"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
genrule(
|
genrule(
|
||||||
|
@ -53,6 +60,7 @@ genrule(
|
||||||
":jaxb_srcs",
|
":jaxb_srcs",
|
||||||
":make_pkginfo",
|
":make_pkginfo",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
java_library(
|
java_library(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -14,18 +14,18 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
[[ $# != 2 ]] && { echo "usage: $0 template outdir" >&2; exit 1; }
|
[[ $# != 2 ]] && { echo "usage: $0 TEMPLATE OUTDIR" >&2; exit 1; }
|
||||||
|
|
||||||
template=$1
|
template="$1"
|
||||||
outdir=$2
|
outdir="$2"
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
package=$1
|
package=$1
|
||||||
namespace=$2
|
namespace=$2
|
||||||
cat $template \
|
sed -e "s,@PACKAGE@,${package},g" \
|
||||||
| sed -e s,@PACKAGE@,$package,g \
|
-e "s,@NAMESPACE@,${namespace},g" \
|
||||||
-e s,@NAMESPACE@,$namespace,g \
|
< "${template}" \
|
||||||
> $outdir/$package/package-info.java
|
> "${outdir}/${package}/package-info.java"
|
||||||
}
|
}
|
||||||
|
|
||||||
create contact urn:ietf:params:xml:ns:contact-1.0
|
create contact urn:ietf:params:xml:ns:contact-1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue