0
点赞
收藏
分享

微信扫一扫

基于android的物业管理系统的设计与实现19.8

老罗话编程 2024-03-15 阅读 6

flutter运行ios时总得执行三个命令,中间还得等待,有没有脚本自动执行

## ios 执行命令
- flutter clean
- flutter pub get
- cd ios
- pod install

有,项目根目录创建shell 文件夹,新建setup.sh
在这里插入图片描述
setup.sh里面放如下代码

#!/bin/bash

# ios 一键三连
cd ..
set -e

# Save current directory
current_dir=$(pwd)

# Clean the Flutter project
echo "Cleaning Flutter project..."
flutter clean

# Get all the dependencies
echo "Getting dependencies..."
flutter pub get

# Navigate to the iOS directory which is assumed to be at the parent directory of where the script is located
echo "Navigating to the iOS directory..."


if [ -d "ios" ]; then
  cd ios
  
  # Install CocoaPods dependencies
  echo "Installing CocoaPods dependencies..."
  pod install

  # Go back to the original directory
  cd "$current_dir"
  echo "Setup completed successfully."
else
  echo "Error: 'ios' directory does not exist."
fi

运行命令,会看到自动执行一键三连

cd shell
执行 ./setup.sh

还可以扩展比如总是要生成代码用 flutter pub run build_runner build
可以加到脚本,新建build.sh放如下代码

#!/bin/bash

echo "开始生成代码"
flutter pub run build_runner build 
#flutter pub run build_runner build --delete-conflicting-outputs

运行

cd shell
执行 ./build.sh
举报

相关推荐

基于springboot小区物业管理系统

0 条评论