create flutter packages under the prebuilt folder, fixes #224

This commit is contained in:
Taner Sener 2021-11-05 18:24:22 +00:00
parent b5c7a0c157
commit 626a7fa6d9

View File

@ -2,8 +2,8 @@
CURRENT_DIR=$(pwd)
BASEDIR="${CURRENT_DIR}/../../.."
TMPDIR="${BASEDIR}/.tmp"
PACKAGES_DIR="${TMPDIR}/flutter_packages"
PACKAGES_DIR_MAIN="${BASEDIR}/prebuilt/bundle-flutter-main"
PACKAGES_DIR_LTS="${BASEDIR}/prebuilt/bundle-flutter-lts"
SOURCE_DIR="${BASEDIR}/flutter/flutter"
PACKAGES=(min min-gpl https https-gpl audio video full full-gpl)
@ -18,8 +18,8 @@ prepare_inline_sed() {
create_main_releases() {
for CURRENT_PACKAGE in "${PACKAGES[@]}"; do
local FLUTTER_PACKAGE_NAME="$(echo "${CURRENT_PACKAGE}" | sed "s/\-/\_/g")"
local PACKAGE_PATH="${PACKAGES_DIR}/${CURRENT_PACKAGE}"
cp -r ${SOURCE_DIR} ${PACKAGE_PATH}
local PACKAGE_PATH="${PACKAGES_DIR_MAIN}/${CURRENT_PACKAGE}"
cp -R ${SOURCE_DIR} ${PACKAGE_PATH}
# 1. pubspec
$SED_INLINE "s|name: ffmpeg_kit_flutter|name: ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/pubspec.yaml
@ -29,32 +29,35 @@ create_main_releases() {
# 2. android
# UPDATE MIN SDK VERSION
$SED_INLINE "s|com.arthenica:.*|com.arthenica:ffmpeg-kit-$CURRENT_PACKAGE:$NATIVE_VERSION'|g" ${PACKAGE_PATH}/android/build.gradle
rm -f ${PACKAGE_PATH}/android/build.gradle.tmp
rm -f ${PACKAGE_PATH}/android/build.gradle.tmp
# 3. ios
$SED_INLINE "s|ffmpeg_kit_flutter|ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec
# UPDATE VERSION
$SED_INLINE "s|s.default_subspec.*|s.default_subspec = '$CURRENT_PACKAGE'|g" ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec
rm -f ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec.tmp
rm -f ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec.tmp
mv ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME.podspec
# 4. macos
$SED_INLINE "s|ffmpeg_kit_flutter|ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec
# UPDATE VERSION
$SED_INLINE "s|s.default_subspec.*|s.default_subspec = '$CURRENT_PACKAGE'|g" ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec
rm -f ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec.tmp
rm -f ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec.tmp
mv ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME.podspec
done;
# CREATE DEFAULT PACKAGE
cp -R "${SOURCE_DIR}" "${PACKAGES_DIR_MAIN}/default"
echo "main releases created!"
}
create_lts_releases() {
for CURRENT_PACKAGE in "${PACKAGES[@]}"; do
local FLUTTER_PACKAGE_NAME="$(echo "${CURRENT_PACKAGE}" | sed "s/\-/\_/g")"
local PACKAGE_PATH="${PACKAGES_DIR}/${CURRENT_PACKAGE}-lts"
cp -r ${SOURCE_DIR} ${PACKAGE_PATH}
local PACKAGE_PATH="${PACKAGES_DIR_LTS}/${CURRENT_PACKAGE}"
cp -R ${SOURCE_DIR} ${PACKAGE_PATH}
# 1. pubspec
$SED_INLINE "s|name: ffmpeg_kit_flutter|name: ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/pubspec.yaml
@ -64,24 +67,35 @@ create_lts_releases() {
# 2. android
$SED_INLINE "s|minSdkVersion.*|minSdkVersion 16|g" ${PACKAGE_PATH}/android/build.gradle
$SED_INLINE "s|com.arthenica:.*|com.arthenica:ffmpeg-kit-$CURRENT_PACKAGE:$NATIVE_VERSION.LTS'|g" ${PACKAGE_PATH}/android/build.gradle
rm -f ${PACKAGE_PATH}/android/build.gradle.tmp
rm -f ${PACKAGE_PATH}/android/build.gradle.tmp
# 3. ios
$SED_INLINE "s|ffmpeg_kit_flutter|ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec
$SED_INLINE "s|s.version.*|s.version = '$VERSION.LTS'|g" ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec
$SED_INLINE "s|s.default_subspec.*|s.default_subspec = '$CURRENT_PACKAGE-lts'|g" ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec
rm -f ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec.tmp
rm -f ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec.tmp
mv ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter.podspec ${PACKAGE_PATH}/ios/ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME.podspec
# 4. macos
$SED_INLINE "s|ffmpeg_kit_flutter|ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME|g" ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec
$SED_INLINE "s|s.version.*|s.version = '$VERSION.LTS'|g" ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec
$SED_INLINE "s|s.default_subspec.*|s.default_subspec = '$CURRENT_PACKAGE-lts'|g" ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec
rm -f ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec.tmp
rm -f ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec.tmp
mv ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter.podspec ${PACKAGE_PATH}/macos/ffmpeg_kit_flutter_$FLUTTER_PACKAGE_NAME.podspec
done;
# CREATE DEFAULT PACKAGE
cp -R "${PACKAGES_DIR_LTS}/https" "${PACKAGES_DIR_LTS}/default"
$SED_INLINE "s|name: ffmpeg_kit_flutter_https|name: ffmpeg_kit_flutter|g" ${PACKAGES_DIR_LTS}/default/pubspec.yaml
rm -f ${PACKAGES_DIR_LTS}/default/pubspec.yaml.tmp
$SED_INLINE "s|ffmpeg_kit_flutter_https|ffmpeg_kit_flutter|g" ${PACKAGES_DIR_LTS}/default/ios/ffmpeg_kit_flutter_https.podspec
rm -f ${PACKAGES_DIR_LTS}/default/ios/ffmpeg_kit_flutter_https.podspec.tmp
mv ${PACKAGES_DIR_LTS}/default/ios/ffmpeg_kit_flutter_https.podspec ${PACKAGES_DIR_LTS}/default/ios/ffmpeg_kit_flutter.podspec
$SED_INLINE "s|ffmpeg_kit_flutter_https|ffmpeg_kit_flutter|g" ${PACKAGES_DIR_LTS}/default/macos/ffmpeg_kit_flutter_https.podspec
rm -f ${PACKAGES_DIR_LTS}/default/macos/ffmpeg_kit_flutter_https.podspec.tmp
mv ${PACKAGES_DIR_LTS}/default/macos/ffmpeg_kit_flutter_https.podspec ${PACKAGES_DIR_LTS}/default/macos/ffmpeg_kit_flutter.podspec
echo "lts releases created!"
}
@ -94,13 +108,13 @@ fi
VERSION="$1"
NATIVE_VERSION="$2"
rm -rf "${PACKAGES_DIR}"
mkdir -p "${PACKAGES_DIR}"
rm -rf "${PACKAGES_DIR_MAIN}"
mkdir -p "${PACKAGES_DIR_MAIN}"
rm -rf "${PACKAGES_DIR_LTS}"
mkdir -p "${PACKAGES_DIR_LTS}"
prepare_inline_sed
create_main_releases;
create_lts_releases;
cp -r "${BASEDIR}/flutter/flutter_platform_interface" "$PACKAGES_DIR"