339 lines
9.1 KiB
Dart
339 lines
9.1 KiB
Dart
import 'dart:io';
|
|
// ignore: depend_on_referenced_packages
|
|
|
|
import 'package:oto/oto/commands/build/build_flutter.dart';
|
|
|
|
class FileData {
|
|
static Map<String, dynamic>? get jenkinsMap {
|
|
return {
|
|
"workspace": Directory.current.path.replaceAll('\\', '/'),
|
|
"jenkinsHome": "",
|
|
"jenkinsUrl": "",
|
|
"buildUrl": "",
|
|
"jobUrl": "",
|
|
"jobName": "",
|
|
"gitCommit": "",
|
|
"buildNumber": 0,
|
|
"buildID": 0,
|
|
"buildDisplayName": "",
|
|
"gitBranch": "",
|
|
"buildTag": ""
|
|
};
|
|
}
|
|
}
|
|
|
|
class TestData {
|
|
static String get buildYaml {
|
|
String yaml = '';
|
|
if (Platform.isMacOS) {
|
|
yaml = '''
|
|
---
|
|
property:
|
|
workspace: ${Directory.current.path}
|
|
|
|
pipeline:
|
|
id: main
|
|
workflow:
|
|
- exe: createApp
|
|
|
|
commands:
|
|
- command: CreateAppData
|
|
id: createApp
|
|
param:
|
|
scm: Git
|
|
name: OTO
|
|
relativeAssetPath: assets/data
|
|
setVersion: "<@property.version>"
|
|
setHash: "<@property.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
|
|
|
|
#- command: Mattermost
|
|
# param:
|
|
# url: https://mattermost.example.com/api/v4/posts
|
|
# token: bot-token
|
|
# channelId: n78a1wrdwjydzdoat6gci8cphe
|
|
# message:
|
|
# message: Bot test message.
|
|
# props:
|
|
# attachments:
|
|
# - pretext: Mattermost Bot Test
|
|
# text: If sent successfully, this message will appear in the channel.
|
|
|
|
''';
|
|
} else if (Platform.isWindows) {
|
|
yaml = '''
|
|
---
|
|
property:
|
|
workspace: ${Directory.current.path}
|
|
|
|
commands:
|
|
- command: CreateAppData
|
|
id: createApp
|
|
param:
|
|
scm: Git
|
|
name: Build Manager
|
|
relativeAssetPath: assets/data
|
|
return-version: "<!property.version>"
|
|
return-hash: "<!property.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
|
|
|
|
#- command: Mattermost
|
|
# param:
|
|
# url: https://mattermost.example.com/api/v4/posts
|
|
# token: bot-token
|
|
# channelId: n78a1wrdwjydzdoat6gci8cphe
|
|
# message:
|
|
# message: Bot test message.
|
|
# props:
|
|
# attachments:
|
|
# - pretext: Mattermost Bot Test
|
|
# text: If sent successfully, this message will appear in the channel.
|
|
|
|
''';
|
|
} else if (Platform.isLinux) {}
|
|
|
|
return yaml;
|
|
}
|
|
|
|
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": buildYaml
|
|
};
|
|
} 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": buildYaml
|
|
};
|
|
}
|
|
return map;
|
|
}
|
|
}
|