上传版本号集成在增加版本号脚本中

pull/1/head
张萌 2 years ago
parent 9496071917
commit fd45bfda92

@ -1,4 +1,4 @@
import 'package:aku_app_upgrade/aku_app_upgrade.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -111,6 +111,7 @@ class _SplashPageState extends State<SplashPage> {
// await Permission.locationWhenInUse.request(); // await Permission.locationWhenInUse.request();
// } // }
// //
await AppUpgrade().checkUpgrade(context);
MainInitialize.initJPush(); MainInitialize.initJPush();
EquatableConfig.stringify = true; EquatableConfig.stringify = true;
AMapFlutterLocation.updatePrivacyShow(true, true); AMapFlutterLocation.updatePrivacyShow(true, true);

@ -15,6 +15,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
aku_app_upgrade:
dependency: "direct main"
description:
path: "../aku_app_upgrade"
relative: true
source: path
version: "0.0.1"
amap_flutter_base: amap_flutter_base:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1391,7 +1398,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.20" version: "6.1.2"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:

@ -131,6 +131,9 @@ dependencies:
sp_util: ^2.0.0 sp_util: ^2.0.0
#系统通知栏消息 #系统通知栏消息
flutter_local_notifications: ^9.5.3+1 flutter_local_notifications: ^9.5.3+1
#app更新
aku_app_upgrade:
path: ../aku_app_upgrade
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -17,6 +17,8 @@ main(args) => grind(args);
@Task('add minor version number') @Task('add minor version number')
void addVersion() async { void addVersion() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -28,10 +30,14 @@ void addVersion() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍\n');
await uploadVersion(force);
} }
@Task('add path version number') @Task('add path version number')
void addVersionPatch() async { void addVersionPatch() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -43,10 +49,14 @@ void addVersionPatch() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍');
await uploadVersion(force);
} }
@Task('add major version number') @Task('add major version number')
void addVersionMajor() async { void addVersionMajor() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -58,10 +68,14 @@ void addVersionMajor() async {
String result = yamlContent.replaceFirst(version, resultVersion.toString()); String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
stdout.write('version has been add 👍');
await uploadVersion(force);
} }
@Task() @Task()
Future<String> getVersion() async { Future<String> getVersion() async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString(); String yamlContent = await File(yamlPath).readAsString();
@ -71,9 +85,7 @@ Future<String> getVersion() async {
} }
@Task() @Task()
Future uploadVersion() async { Future uploadVersion(bool force) async {
TaskArgs args = context.invocation.arguments;
bool force = args.getFlag('f');
var version = await getVersion(); var version = await getVersion();
List<String> spVersion = version.split('+'); List<String> spVersion = version.split('+');
stdout.write('版本号:' + spVersion[0] + '\n'); stdout.write('版本号:' + spVersion[0] + '\n');

Loading…
Cancel
Save