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:
Justine Tunney 2016-08-05 09:49:56 -07:00
parent e1d02d1ea5
commit 3f4121b98c
3 changed files with 25 additions and 17 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -14,18 +14,18 @@
# limitations under the License.
[[ $# != 2 ]] && { echo "usage: $0 template outdir" >&2; exit 1; }
[[ $# != 2 ]] && { echo "usage: $0 TEMPLATE OUTDIR" >&2; exit 1; }
template=$1
outdir=$2
template="$1"
outdir="$2"
create() {
package=$1
namespace=$2
cat $template \
| sed -e s,@PACKAGE@,$package,g \
-e s,@NAMESPACE@,$namespace,g \
> $outdir/$package/package-info.java
sed -e "s,@PACKAGE@,${package},g" \
-e "s,@NAMESPACE@,${namespace},g" \
< "${template}" \
> "${outdir}/${package}/package-info.java"
}
create contact urn:ietf:params:xml:ns:contact-1.0