mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 08:11:20 +00:00
Remove:
```
__LATEST_COMPOSE_RELEASE_VERSION__
__KOTLIN_COMPOSE_VERSION__
System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION")
```
They pollute templates/examples.
Now, all paths where we need to change the version are hardcoded in the script.
Usage:
```
./replace.sh 1.0.0-rc6
```
This script is planned to run on CI
In the future I will add support for changing Kotlin version
52 lines
1.5 KiB
Bash
Executable File
52 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Replace hard-coded Compose version in Compose repo projects. Usage: ./replace.sh 1.0.0-rc6
|
|
|
|
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/..
|
|
|
|
# Add folders which should contain up-to-date versions
|
|
declare -a folders=(
|
|
"templates"
|
|
"examples"
|
|
"gradle-plugins"
|
|
"components"
|
|
"ci"
|
|
"web"
|
|
"tutorials"
|
|
)
|
|
|
|
if [ -z "$@" ]; then
|
|
echo "Specify Compose version. For example: ./replace.sh 1.0.0-rc6"
|
|
exit 1
|
|
fi
|
|
COMPOSE_VERSION=$@
|
|
|
|
if [[ $OSTYPE == 'darwin'* ]]; then
|
|
SED=gsed
|
|
else
|
|
SED=sed
|
|
fi
|
|
|
|
replaceCompose() {
|
|
$SED -i -e "s/$1/$2/g" $3
|
|
}
|
|
|
|
replaceComposeInFile() {
|
|
echo "Replace in $1"
|
|
replaceCompose '^compose.version=.*' 'compose.version='"$COMPOSE_VERSION"'' $1
|
|
replaceCompose '^COMPOSE_CORE_VERSION=.*' 'COMPOSE_CORE_VERSION='"$COMPOSE_VERSION"'' $1
|
|
replaceCompose '^COMPOSE_WEB_VERSION=.*' 'COMPOSE_WEB_VERSION='"$COMPOSE_VERSION"'' $1
|
|
replaceCompose 'id("org.jetbrains.compose") version ".*"' 'id("org.jetbrains.compose") version "'"$COMPOSE_VERSION"'"' $1
|
|
replaceCompose '"org.jetbrains.compose:compose-gradle-plugin:.*"' '"org.jetbrains.compose:compose-gradle-plugin:'"$COMPOSE_VERSION"'"' $1
|
|
}
|
|
|
|
replaceComposeInFolder() {
|
|
find $ROOT/$1 -wholename $2 -not -path "**/build**" -not -path "**/.gradle**" | while read file; do replaceComposeInFile "$file"; done
|
|
}
|
|
|
|
for folder in "${folders[@]}"
|
|
do
|
|
replaceComposeInFolder $folder "**gradle.properties"
|
|
replaceComposeInFolder $folder "**README.md"
|
|
done
|