536 lines
16 KiB
Dart
536 lines
16 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
// ignore: depend_on_referenced_packages
|
|
import 'package:yaml/yaml.dart' as yaml;
|
|
|
|
import 'package:oto_cli/oto/build/build_flutter.dart';
|
|
|
|
class TestData {
|
|
static Map<String, dynamic> get buildMap {
|
|
Map<String, dynamic> map = {
|
|
"common": {"workspace": ""},
|
|
"commands": []
|
|
};
|
|
if (Platform.isMacOS) {
|
|
map = {
|
|
"common": {"workspace": Directory.current.path},
|
|
"commands": [
|
|
// {
|
|
// "command": "BuildDart",
|
|
// "param": {"targetPath": "./"}
|
|
// },
|
|
// {
|
|
// "command": "BuildFlutter",
|
|
// "param": {
|
|
// "targetPath": "../desktop_service_frontend",
|
|
// "platform": BuildPlatform.Macos.toString()
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "BuildFlutter",
|
|
// "param": {
|
|
// "targetPath": "../desktop_service_frontend",
|
|
// "platform": BuildPlatform.Web.toString()
|
|
// }
|
|
// },
|
|
{
|
|
"command": "BuildDartCompile",
|
|
"param": {
|
|
"targetPath": "/Users/toki/works/dart/desktop_service_cli",
|
|
"targetDartFile": "./bin/desktop_service_cli.dart",
|
|
"buildFileName": "desktop_service_cli"
|
|
}
|
|
},
|
|
// {
|
|
// "command": "Copy",
|
|
// "param": {
|
|
// "ignorePattern": [
|
|
// ".git",
|
|
// ".dart_tool",
|
|
// ".gitignore",
|
|
// ".idea",
|
|
// "example"
|
|
// ],
|
|
// "isMove": false,
|
|
// "copyMap": {
|
|
// "<!common.workspace>/*": "/Users/toki/server/temp",
|
|
// // "../toki_flutter_framework/*":
|
|
// // "/Users/toki/server/toki_flutter_framework"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Zip",
|
|
// "param": {
|
|
// "zipFile":
|
|
// "<!common.workspace>/test_v<!common.version>_<!common.hash>.zip",
|
|
// "zipList": [
|
|
// "<!common.workspace>/bin/*",
|
|
// "<!common.workspace>/README.md"
|
|
// ]
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Upload",
|
|
// "param": {
|
|
// "sftp": false,
|
|
// "host": "toki-labs.com",
|
|
// "port": 215,
|
|
// "user": "spritex",
|
|
// "password": "Na2674126",
|
|
// "uploadMap": {
|
|
// "README.md": "/HDD1/WEB/_tmp",
|
|
// "bin/*": "/HDD1/WEB/_tmp/bin"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Shell",
|
|
// "param": {
|
|
// "workspace": "<!common.workspace>",
|
|
// "path": "<!common.workspace>/lib/shell/jenkins_env_params.sh"
|
|
// }
|
|
// }
|
|
]
|
|
};
|
|
|
|
var json = jsonEncode(yaml.loadYaml('''
|
|
---
|
|
common:
|
|
workspace: ${Directory.current.path}
|
|
|
|
commands:
|
|
- command: CreateAppData
|
|
param:
|
|
scm: Git
|
|
relativeAssetPath: assets/data
|
|
returnVersion: "<!common.version>"
|
|
returnHash: "<!common.hash>"
|
|
|
|
#- command: BuildDart
|
|
# param:
|
|
# targetPath: "./"
|
|
|
|
#- command: BuildFlutter
|
|
# param:
|
|
# targetPath: "../tplayer"
|
|
# executeBuildRunner: false
|
|
# platform: ${BuildPlatform.Apk.toString()}
|
|
# additional: "--release --target-platform=android-arm64"
|
|
|
|
#- command: BuildiOS
|
|
# param:
|
|
# workspacePath: "/Users/toki/jenkins/workspace/tplayer_ios/ios/Runner.xcworkspace"
|
|
# scheme: Runner
|
|
# destination: "generic/platform=iOS build"
|
|
|
|
#- command: PublishiOS
|
|
# param:
|
|
# bundleID: com.tokilabs.tokiplayer
|
|
# version: <!common.version>
|
|
# appName: TPlayer
|
|
# ipaURL: https://toki-labs.com/build/tplayer/ios/tplayer.ipa
|
|
# menifestURL: https://toki-labs.com/build/tplayer/ios/menifest.plist
|
|
# displayImageURL: https://toki-labs.com/build/tplayer/icon.png
|
|
# fullSizeImageURL: https://toki-labs.com/build/tplayer/icon.png
|
|
# destinationPath: d:/build
|
|
|
|
#- command: ArchiveiOS
|
|
# param:
|
|
# workspacePath: "<!common.workspace>/ios/Runner.xcworkspace"
|
|
# scheme: Runner
|
|
# archivePath: "<!common.workspace>/build/ios/TPlayer"
|
|
|
|
#- command: ExportiOS
|
|
# param:
|
|
# archivePath: "<!common.workspace>/build/ios/TPlayer"
|
|
# exportOptionPlistPath: "<!common.workspace>/ExportOptions.plist"
|
|
# exportPath: "<!common.workspace>/build/ios"
|
|
|
|
#- command: BuildDartCompile
|
|
# param:
|
|
# targetPath: d:/work/dart/desktop_service_cli
|
|
# buildFileName: desktop_service_cli
|
|
|
|
#- command: Copy
|
|
# param:
|
|
# ignorePattern: []
|
|
# isMove: false
|
|
# copyMap:
|
|
# "<!common.workspace>/README.md": "<!common.workspace>/../temp"
|
|
# "<!common.workspace>/bin/*": "<!common.workspace>/../temp/bin"
|
|
|
|
#- command: Rename
|
|
# param:
|
|
# renameMap:
|
|
# "<!common.workspace>/../temp/README.md": "README_<!common.version>.md.back"
|
|
# "<!common.workspace>/../temp/bin/main.dart": "main.dart.back"
|
|
# "<!common.workspace>/../temp/test": "test2"
|
|
|
|
#- command: Copy
|
|
# param:
|
|
# isMove: true
|
|
# copyMap:
|
|
# "<!common.workspace>/../temp/README.md": "<!common.workspace>/../temp/bin"
|
|
|
|
#- command: Zip
|
|
# param:
|
|
# zipFile: "<!common.workspace>/test_v<!common.version>_<!common.hash>.zip"
|
|
# zipList:
|
|
# - "<!common.workspace>/bin/*"
|
|
# - "<!common.workspace>/README.md"
|
|
|
|
#- command: Upload
|
|
# param:
|
|
# sftp: false
|
|
# host: toki-labs.com
|
|
# port: 215
|
|
# user: spritex
|
|
# password: Na2674126
|
|
# uploadMap:
|
|
# README.md: "/HDD1/WEB/_tmp"
|
|
# bin/*: "/HDD1/WEB/_tmp/bin"
|
|
|
|
#- command: Shell
|
|
# param:
|
|
# workspace: "<!common.workspace>"
|
|
# path: "<!common.workspace>/lib/shell/jenkins_env_params.bat"
|
|
|
|
#- command: ExecuteApp
|
|
# param:
|
|
# executable: D:/Program Files/TokiSystemTrading/SystemTradingAPIApp.exe
|
|
# desktopServicePath: D:/work/dart/build_manager
|
|
|
|
#- command: SlackBuild
|
|
# param:
|
|
# appName: tplayer
|
|
# type: android
|
|
# color: ED1458
|
|
# version: <!common.version>
|
|
# downloadURL: http://toki-labs.com/build/tplayer/android/tplayer_arm64_<!common.version>.apk
|
|
# channel: release
|
|
|
|
'''));
|
|
map = jsonDecode(json);
|
|
} else if (Platform.isWindows) {
|
|
var json = jsonEncode(yaml.loadYaml('''
|
|
---
|
|
common:
|
|
workspace: ${Directory.current.path}
|
|
|
|
commands:
|
|
- command: CreateAppData
|
|
param:
|
|
scm: Git
|
|
name: Build Manager
|
|
relativeAssetPath: assets/data
|
|
returnVersion: "<!common.version>"
|
|
returnHash: "<!common.hash>"
|
|
|
|
#- command: BuildDart
|
|
# param:
|
|
# targetPath: "./"
|
|
|
|
#- command: BuildFlutter
|
|
# param:
|
|
# targetPath: "../tplayer"
|
|
# executeBuildRunner: false
|
|
# platform: ${BuildPlatform.Apk.toString()}
|
|
# additional: "--release --target-platform=android-arm64"
|
|
|
|
#- command: BuildiOS
|
|
# param:
|
|
# workspacePath: "<!common.workspace>/ios/Runner.xcworkspace"
|
|
# scheme: Runner
|
|
# destination: "generic/platform=iOS build"
|
|
|
|
#- command: ArchiveiOS
|
|
# param:
|
|
# workspacePath: "<!common.workspace>/ios/Runner.xcworkspace"
|
|
# scheme: Runner
|
|
# archivePath: "<!common.workspace>/build/ios/TPlayer"
|
|
|
|
#- command: ExportiOS
|
|
# param:
|
|
# archivePath: "<!common.workspace>/build/ios/TPlayer"
|
|
# exportOptionPlistPath: "<!common.workspace>/ExportOptions.plist"
|
|
# exportPath: "<!common.workspace>/build/ios"
|
|
|
|
#- command: PublishiOS
|
|
# param:
|
|
# bundleID: com.tokilabs.tokiplayer
|
|
# version: <!common.version>
|
|
# appName: TPlayer
|
|
# ipaURL: https://toki-labs.com/build/tplayer/ios/tplayer.ipa
|
|
# menifestURL: https://toki-labs.com/build/tplayer/ios/manifest.plist
|
|
# displayImageURL: https://toki-labs.com/build/tplayer/icon.png
|
|
# fullSizeImageURL: https://toki-labs.com/build/tplayer/icon.png
|
|
# destinationPath: d:/build
|
|
|
|
#- command: BuildDartCompile
|
|
# param:
|
|
# targetPath: d:/work/dart/desktop_service_cli
|
|
# buildFileName: desktop_service_cli
|
|
|
|
#- command: Copy
|
|
# param:
|
|
# ignorePattern: []
|
|
# isMove: false
|
|
# copyMap:
|
|
# "<!common.workspace>/README.md": "<!common.workspace>/../temp"
|
|
# "<!common.workspace>/bin/*": "<!common.workspace>/../temp/bin"
|
|
|
|
#- command: Rename
|
|
# param:
|
|
# renameMap:
|
|
# "<!common.workspace>/../temp/README.md": "README_<!common.version>.md.back"
|
|
# "<!common.workspace>/../temp/bin/main.dart": "main.dart.back"
|
|
# "<!common.workspace>/../temp/test": "test2"
|
|
|
|
#- command: Copy
|
|
# param:
|
|
# isMove: true
|
|
# copyMap:
|
|
# "<!common.workspace>/../temp/README.md": "<!common.workspace>/../temp/bin"
|
|
|
|
#- command: Zip
|
|
# param:
|
|
# zipFile: "<!common.workspace>/test_v<!common.version>_<!common.hash>.zip"
|
|
# zipList:
|
|
# - "<!common.workspace>/bin/*"
|
|
# - "<!common.workspace>/README.md"
|
|
|
|
#- command: Upload
|
|
# param:
|
|
# sftp: false
|
|
# host: toki-labs.com
|
|
# port: 215
|
|
# user: spritex
|
|
# password: Na2674126
|
|
# uploadMap:
|
|
# README.md: "/HDD1/WEB/_tmp"
|
|
# bin/*: "/HDD1/WEB/_tmp/bin"
|
|
|
|
#- command: Shell
|
|
# param:
|
|
# workspace: "<!common.workspace>"
|
|
# path: "<!common.workspace>/lib/shell/jenkins_env_params.bat"
|
|
|
|
#- command: ExecuteApp
|
|
# param:
|
|
# executable: D:/Program Files/TokiSystemTrading/SystemTradingAPIApp.exe
|
|
# desktopServicePath: D:/work/dart/build_manager
|
|
|
|
#- command: SlackBuild
|
|
# param:
|
|
# appName: tplayer
|
|
# type: android
|
|
# color: ED1458
|
|
# version: <!common.version>
|
|
# downloadURL: http://toki-labs.com/build/tplayer/android/tplayer_arm64_<!common.version>.apk
|
|
# channel: release
|
|
|
|
'''));
|
|
map = jsonDecode(json);
|
|
|
|
// map = {
|
|
// "common": {"workspace": Directory.current.path},
|
|
// "commands": [
|
|
// {
|
|
// "command": "CreateAppData",
|
|
// "param": {
|
|
// "scm": "Git",
|
|
// "relativeAssetPath": "assets/data",
|
|
// "returnVersion": "<!common.version>",
|
|
// "returnHash": "<!common.hash>"
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "BuildDart",
|
|
// "param": {"targetPath": "./"}
|
|
// },
|
|
// {
|
|
// "command": "BuildFlutter",
|
|
// "param": {
|
|
// "targetPath": "../desktop_service_frontend",
|
|
// "platform": BuildPlatform.Windows.toString()
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "BuildDartCompile",
|
|
// "param": {
|
|
// "targetPath": "d:\\work\\dart\\desktop_service_cli",
|
|
// "buildFileName": "desktop_service_cli"
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Copy",
|
|
// "param": {
|
|
// "ignorePattern": [],
|
|
// "isMove": false,
|
|
// "copyMap": {
|
|
// "<!common.workspace>/README.md": "<!common.workspace>/../temp",
|
|
// "<!common.workspace>/bin/*": "<!common.workspace>/../temp/bin"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Zip",
|
|
// "param": {
|
|
// "zipFile":
|
|
// "<!common.workspace>/test_v<!common.version>_<!common.hash>.zip",
|
|
// "zipList": [
|
|
// "<!common.workspace>/bin/*",
|
|
// "<!common.workspace>/README.md"
|
|
// ]
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Upload",
|
|
// "param": {
|
|
// "sftp": false,
|
|
// "host": "toki-labs.com",
|
|
// "port": 215,
|
|
// "user": "spritex",
|
|
// "password": "Na2674126",
|
|
// "uploadMap": {
|
|
// "README.md": "/HDD1/WEB/_tmp",
|
|
// "bin/*": "/HDD1/WEB/_tmp/bin"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Shell",
|
|
// "param": {
|
|
// "workspace": "<!common.workspace>",
|
|
// "path": "<!common.workspace>/lib/shell/jenkins_env_params.bat"
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "ExecuteApp",
|
|
// "param": {
|
|
// "executable":
|
|
// "D:/Program Files/TokiSystemTrading/SystemTradingAPIApp.exe",
|
|
// "desktopServicePath": "D:/work/dart/toki_desktop_service"
|
|
// }
|
|
// }
|
|
// ]
|
|
// };
|
|
} else if (Platform.isLinux) {
|
|
map = {
|
|
"common": {"workspace": Directory.current.path},
|
|
"commands": [
|
|
// {
|
|
// "command": "BuildDart",
|
|
// "param": {"targetPath": "<!common.workspace>"}
|
|
// },
|
|
{
|
|
"command": "BuildDartCompile",
|
|
"param": {
|
|
"targetPath": "/home/deck/work/desktop_service_cli",
|
|
"targetDartFile": "./bin/desktop_service_cli.dart",
|
|
"buildFileName": "desktop_service_cli"
|
|
}
|
|
},
|
|
// {
|
|
// "command": "BuildFlutter",
|
|
// "param": {
|
|
// "targetPath": "../desktop_service_frontend",
|
|
// "platform": BuildPlatform.Linux.toString()
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Copy",
|
|
// "param": {
|
|
// "ignorePattern": [
|
|
// ".git",
|
|
// ".dart_tool",
|
|
// ".gitignore",
|
|
// ".idea",
|
|
// "example"
|
|
// ],
|
|
// "isMove": false,
|
|
// "copyMap": {
|
|
// "<!common.workspace>/*": "/home/deck/temp",
|
|
// // "../toki_flutter_framework/*":
|
|
// // "/Users/toki/server/toki_flutter_framework"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Zip",
|
|
// "param": {
|
|
// "zipFile":
|
|
// "<!common.workspace>/test_v<!common.version>_<!common.hash>.zip",
|
|
// "zipList": [
|
|
// "<!common.workspace>/bin/*",
|
|
// "<!common.workspace>/README.md"
|
|
// ]
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Upload",
|
|
// "param": {
|
|
// "sftp": false,
|
|
// "host": "toki-labs.com",
|
|
// "port": 215,
|
|
// "user": "spritex",
|
|
// "password": "Na2674126",
|
|
// "uploadMap": {
|
|
// "README.md": "/HDD1/WEB/_tmp",
|
|
// "bin/*": "/HDD1/WEB/_tmp/bin"
|
|
// }
|
|
// }
|
|
// },
|
|
// {
|
|
// "command": "Shell",
|
|
// "param": {
|
|
// "workspace": "<!common.workspace>",
|
|
// "path": "<!common.workspace>/lib/shell/jenkins_env_params.sh"
|
|
// }
|
|
// }
|
|
]
|
|
};
|
|
}
|
|
|
|
return map;
|
|
}
|
|
|
|
static Map<String, dynamic>? get jenkinsMap {
|
|
Map<String, dynamic>? map;
|
|
if (Platform.isMacOS || Platform.isLinux) {
|
|
map = {
|
|
"workspace": Directory.current.path,
|
|
"jenkinsHome": "/var/lib/jenkins",
|
|
"jenkinsUrl": "http://toki-labs.com:8083/",
|
|
"buildUrl": "http://toki-labs.com:8083/job/toki_os/54/",
|
|
"jobUrl": "http://toki-labs.com:8083/job/toki_os/",
|
|
"jobName": "toki_os",
|
|
"gitCommit": "6087aadcf9f8dbe0d2f024ae32dbcf0f6955d45b",
|
|
"buildNumber": 54,
|
|
"buildID": 54,
|
|
"buildDisplayName": "#54",
|
|
"gitBranch": "origin/master",
|
|
"buildTag": "jenkins-toki_os-54",
|
|
"buildData": buildMap
|
|
};
|
|
} else if (Platform.isWindows) {
|
|
map = {
|
|
"workspace": Directory.current.path,
|
|
"jenkinsHome": "/var/lib/jenkins",
|
|
"jenkinsUrl": "http://toki-labs.com:8083/",
|
|
"buildUrl": "http://toki-labs.com:8083/job/toki_system_trading/18/",
|
|
"jobUrl": "http://toki-labs.com:8083/job/toki_system_trading/",
|
|
"jobName": "toki_system_trading",
|
|
"gitCommit": "abef2bc09c1d82e69ebe897ee079135aac9e797a",
|
|
"buildNumber": 18,
|
|
"buildID": 18,
|
|
"buildDisplayName": "#18",
|
|
"gitBranch": "origin/master",
|
|
"buildTag": "jenkins-toki_system_trading-18",
|
|
"buildData": buildMap
|
|
};
|
|
}
|
|
return map;
|
|
}
|
|
}
|