Files
compose-multiplatform/tools/replaceVersion.sh
Oleksandr Karpovich bc6d42ef44 Update versions: compose - 1.3.0 and kotlin - 1.8.0 (#2651)
* Update versions in examples

* Add more scripts to validate example on android and k/js

* Add validateExamplesIos.sh

* Update CHANGELOG.md for 1.3.0

* check examples with 1.3.0-rc06

* Update the versions: compose-multiplatform - 1.3.0, kotlin - 1.8.0

* Update ComposeCompilerCompatibility (1.4.0)

* Update web/yarn.lock
2023-01-30 21:02:23 +01:00

65 lines
2.2 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"
"experimental/examples"
)
if [ -z "$1" ]; then
echo "Specify Compose version. For example: ./replace.sh 1.2.0-beta02 1.7.10"
exit 1
fi
if [ -z "$2" ]; then
echo "Specify Kotlin version. For example: ./replace.sh 1.2.0-beta02 1.7.10"
exit 1
fi
COMPOSE_VERSION=$1
KOTLIN_VERSION=$2
if [[ $OSTYPE == 'darwin'* ]]; then
SED=gsed
else
SED=sed
fi
replaceVersion() {
$SED -i -e "s/$1/$2/g" $3
}
replaceVersionInFile() {
echo "Replace in $1"
replaceVersion '^compose.version=.*' 'compose.version='"$COMPOSE_VERSION"'' $1
replaceVersion '^COMPOSE_CORE_VERSION=.*' 'COMPOSE_CORE_VERSION='"$COMPOSE_VERSION"'' $1
replaceVersion '^COMPOSE_WEB_VERSION=.*' 'COMPOSE_WEB_VERSION='"$COMPOSE_VERSION"'' $1
replaceVersion 'id("org.jetbrains.compose") version ".*"' 'id("org.jetbrains.compose") version "'"$COMPOSE_VERSION"'"' $1
replaceVersion '"org.jetbrains.compose:compose-gradle-plugin:.*"' '"org.jetbrains.compose:compose-gradle-plugin:'"$COMPOSE_VERSION"'"' $1
replaceVersion '^kotlin.version=.*' 'kotlin.version='"$KOTLIN_VERSION"'' $1
replaceVersion '^compose.tests.compiler.compatible.kotlin.version=.*' 'compose.tests.compiler.compatible.kotlin.version='"$KOTLIN_VERSION"'' $1
replaceVersion '^compose.tests.js.compiler.compatible.kotlin.version=.*' 'compose.tests.js.compiler.compatible.kotlin.version='"$KOTLIN_VERSION"'' $1
replaceVersion 'kotlin("multiplatform") version ".*"' 'kotlin("multiplatform") version "'"$KOTLIN_VERSION"'"' $1
replaceVersion 'kotlin("jvm") version ".*"' 'kotlin("jvm") version "'"$KOTLIN_VERSION"'"' $1
}
replaceVersionInFolder() {
find $ROOT/$1 -wholename $2 -not -path "**/build**" -not -path "**/.gradle**" | while read file; do replaceVersionInFile "$file"; done
}
for folder in "${folders[@]}"
do
replaceVersionInFolder $folder "**gradle.properties"
replaceVersionInFolder $folder "**README.md"
done