Update compound scripts.
Ensure drawable folder is emptied before importing tokens and import again.
This commit is contained in:
parent
b2bb4dcee3
commit
517f990cb0
2 changed files with 15 additions and 14 deletions
|
|
@ -101,10 +101,10 @@ files = [
|
||||||
def main():
|
def main():
|
||||||
for file in files:
|
for file in files:
|
||||||
# Open file for read
|
# Open file for read
|
||||||
with open("./compound/src/main/res/drawable/" + file, 'r') as f:
|
with open("./libraries/compound/src/main/res/drawable/" + file, 'r') as f:
|
||||||
data = f.read().split("\n")
|
data = f.read().split("\n")
|
||||||
# Open file to write
|
# Open file to write
|
||||||
with open("./compound/src/main/res/drawable/" + file, 'w') as f:
|
with open("./libraries/compound/src/main/res/drawable/" + file, 'w') as f:
|
||||||
# Write new data
|
# Write new data
|
||||||
# write the 3 first lines in data
|
# write the 3 first lines in data
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
|
|
||||||
|
|
@ -2,37 +2,38 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SHORT=b,:
|
|
||||||
LONG=branch,:
|
|
||||||
BRANCH='main'
|
BRANCH='main'
|
||||||
|
|
||||||
while getopts b: flag
|
while getopts b: flag
|
||||||
do
|
do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
b) BRANCH=${OPTARG};;
|
b) BRANCH=${OPTARG};;
|
||||||
|
*) echo "usage: $0 [-b branch]" >&2
|
||||||
|
exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Branch used: $BRANCH"
|
echo "Branch used: $BRANCH"
|
||||||
|
|
||||||
echo "Cloning the compound-design-tokens repository..."
|
echo "Cloning the compound-design-tokens repository..."
|
||||||
if [ -d tmp ]; then
|
if [ -d tmpCompound ]; then
|
||||||
echo "Deleting tmp folder..."
|
echo "Deleting tmpCompound folder..."
|
||||||
rm -rf tmp
|
rm -rf tmpCompound
|
||||||
fi
|
fi
|
||||||
mkdir tmp
|
mkdir tmpCompound
|
||||||
pushd tmp
|
pushd tmpCompound
|
||||||
git clone --branch $BRANCH https://github.com/vector-im/compound-design-tokens
|
git clone --branch "${BRANCH}" https://github.com/vector-im/compound-design-tokens
|
||||||
|
|
||||||
echo "Copying files from tokens repository..."
|
echo "Copying files from tokens repository..."
|
||||||
cp -R compound-design-tokens/assets/android/res/drawable ../compound/src/main/res/
|
rm -R ../libraries/compound/src/main/res/drawable
|
||||||
cp -R compound-design-tokens/assets/android/src/* ../compound/src/main/kotlin/io/element/android/compound/tokens/generated/
|
cp -R compound-design-tokens/assets/android/res/drawable ../libraries/compound/src/main/res/
|
||||||
|
cp -R compound-design-tokens/assets/android/src/* ../libraries/compound/src/main/kotlin/io/element/android/compound/tokens/generated/
|
||||||
popd
|
popd
|
||||||
|
|
||||||
echo "Adding autoMirrored attribute..."
|
echo "Adding autoMirrored attribute..."
|
||||||
python3 ./scripts/addAutoMirrored.py
|
python3 ./tools/compound/addAutoMirrored.py
|
||||||
|
|
||||||
echo "Removing temporary files..."
|
echo "Removing temporary files..."
|
||||||
rm -rf tmp
|
rm -rf tmpCompound
|
||||||
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue