Skip to content

Commit

Permalink
Move metadataGenerator to scripts/metadataGenerator.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
paween committed Jul 29, 2020
1 parent 7f45d50 commit 449bc39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libPhoneNumber/GeneratePhoneNumberHeader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ set -eu
cd "${BASH_SOURCE%/*}" || exit

TEMPDIR=$(mktemp -d)
gzip -c "../libPhoneNumberTests/generatedJSON/PhoneNumberMetaDataForTesting.json" > "$TEMPDIR/PhoneNumberMetaDataForTesting.zip"
gzip -c "../libPhoneNumberTests/generatedJSON/PhoneNumberMetaData.json" > "$TEMPDIR/PhoneNumberMetaData.zip"
gzip -c "../libPhoneNumberTests/generatedJSON/ShortNumberMetaData.json" > "$TEMPDIR/ShortNumberMetaData.zip"
gzip -c "../generatedJSON/PhoneNumberMetaDataForTesting.json" > "$TEMPDIR/PhoneNumberMetaDataForTesting.zip"
gzip -c "../generatedJSON/PhoneNumberMetaData.json" > "$TEMPDIR/PhoneNumberMetaData.zip"
gzip -c "../generatedJSON/ShortNumberMetaData.json" > "$TEMPDIR/ShortNumberMetaData.zip"

cat > "NBGeneratedPhoneNumberMetaData.h" <<'EOF'
/*****
Expand Down Expand Up @@ -51,7 +51,7 @@ cat >> "NBGeneratedPhoneNumberMetaData.h" <<'EOF'
};
z_const size_t kPhoneNumberMetaDataCompressedLength = sizeof(kPhoneNumberMetaData);
EOF
LIB_SIZE=$(stat -f%z "../libPhoneNumberTests/generatedJSON/PhoneNumberMetaDataForTesting.json")
LIB_SIZE=$(stat -f%z "../generatedJSON/PhoneNumberMetaDataForTesting.json")
echo "z_const size_t kPhoneNumberMetaDataExpandedLength = $LIB_SIZE;" >> "NBGeneratedPhoneNumberMetaData.h"

cat >> "NBGeneratedPhoneNumberMetaData.h" <<'EOF'
Expand All @@ -67,7 +67,7 @@ cat >> "NBGeneratedPhoneNumberMetaData.h" <<'EOF'
};
z_const size_t kPhoneNumberMetaDataCompressedLength = sizeof(kPhoneNumberMetaData);
EOF
LIB_SIZE=$(stat -f%z "../libPhoneNumberTests/generatedJSON/PhoneNumberMetaData.json")
LIB_SIZE=$(stat -f%z "../generatedJSON/PhoneNumberMetaData.json")
echo "z_const size_t kPhoneNumberMetaDataExpandedLength = $LIB_SIZE;" >> "NBGeneratedPhoneNumberMetaData.h"
echo "#endif // TESTING" >> "NBGeneratedPhoneNumberMetaData.h"

Expand All @@ -85,7 +85,7 @@ cat >> "NBGeneratedPhoneNumberMetaData.h" <<'EOF'
};
z_const size_t kShortNumberMetaDataCompressedLength = sizeof(kShortNumberMetaData);
EOF
LIB_SIZE=$(stat -f%z "../libPhoneNumberTests/generatedJSON/ShortNumberMetaData.json")
LIB_SIZE=$(stat -f%z "../generatedJSON/ShortNumberMetaData.json")
echo "z_const size_t kShortNumberMetaDataExpandedLength = $LIB_SIZE;" >> "NBGeneratedPhoneNumberMetaData.h"
echo "#endif // SHORT_NUMBER_SUPPORT" >> "NBGeneratedPhoneNumberMetaData.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ let shortNumberMetadata = URL(string: "https://raw.githubusercontent.com/googlei

let currentDir = FileManager.default.currentDirectoryPath
let baseURL = URL(fileURLWithPath: currentDir).appendingPathComponent("generatedJSON")
try? FileManager.default.createDirectory(at: baseURL, withIntermediateDirectories: true)

// Phone metadata.
do {
Expand Down

0 comments on commit 449bc39

Please sign in to comment.