From cdfc39b75e5ea2fd9130790eecb39c3e276139dd Mon Sep 17 00:00:00 2001 From: Toki Date: Mon, 23 Sep 2024 21:01:29 +0900 Subject: [PATCH] build security added --- lib/oto/commands/build/build_ios.dart | 63 +++--- lib/oto/commands/build/build_security.dart | 15 ++ lib/oto/commands/command.dart | 17 +- lib/oto/data/command_data.dart | 13 +- lib/oto/data/command_data.g.dart | 216 +++++++++++++-------- lib/oto/data/jenkins_data.g.dart | 4 +- lib/oto/data/jira_data.g.dart | 4 +- 7 files changed, 199 insertions(+), 133 deletions(-) create mode 100644 lib/oto/commands/build/build_security.dart diff --git a/lib/oto/commands/build/build_ios.dart b/lib/oto/commands/build/build_ios.dart index b11f140..9fe6cce 100644 --- a/lib/oto/commands/build/build_ios.dart +++ b/lib/oto/commands/build/build_ios.dart @@ -13,15 +13,17 @@ class BuildiOS extends Command { @override Future execute(DataCommand command) async { var data = DataBuildiOS.fromJson(getParam(command)); - var xcodeProjectPath = data.xcworkspaceFilePath ?? data.xcodeProjectFilePath; - if(xcodeProjectPath == null) throw Exception('"xcodeProjectFilePath" or "xcworkspaceFilePath" must set at least one.'); + var xcodeProjectPath = + data.xcworkspaceFilePath ?? data.xcodeProjectFilePath; + if (xcodeProjectPath == null) { + throw Exception( + '"xcodeProjectFilePath" or "xcworkspaceFilePath" must set at least one.'); + } var xcworkspaceFilePath = Command.getPathNormal(xcodeProjectPath); var os = 'iOS'; - if(data.os != null) - { - if(data.os == BuildPlatform.Macos) - { + if (data.os != null) { + if (data.os == BuildPlatform.Macos) { os = 'macOS'; } } @@ -31,38 +33,32 @@ class BuildiOS extends Command { var podFile = File('$xcodeProjectParentPath/PodFile'); var project = ''; - if(data.xcworkspaceFilePath != null) { + if (data.xcworkspaceFilePath != null) { project = '-workspace $xcodeProjectPath'; } else { project = '-project $xcodeProjectPath'; } var configuration = ''; - if(data.configuration != null) - { + if (data.configuration != null) { configuration = ' -configuration ${data.configuration}'; } var derivedDataPath = ''; - if(data.derivedDataPath != null) - { + if (data.derivedDataPath != null) { derivedDataPath = ' -derivedDataPath ${data.configuration}'; } var settings = ''; - if(data.settings != null) - { + if (data.settings != null) { var map = data.settings!; - for(var item in map.entries) - { + for (var item in map.entries) { settings += ' ${item.key}="${item.value}"'; } } var shell = StringBuffer(); - shell.write('security unlock-keychain -p${data.macPassword}'); shell.write(' && cd $xcodeProjectParentPath'); shell.write(' && export LANG=en_US.UTF-8'); - if(podFile.existsSync()) - { + if (podFile.existsSync()) { shell.write(' && rm -rf Pods'); shell.write(' && rm -rf Podfile.lock'); if (cleanPod) { @@ -100,8 +96,7 @@ class CodeSign extends Command { Future execute(DataCommand command) async { var data = DataCodeSign.fromJson(getParam(command)); var entitlement = ''; - if(data.entitlementPath == null) - { + if (data.entitlementPath == null) { entitlement = ' --entitlements "${data.entitlementPath}"'; } var shell = StringBuffer(getCDPath(workspace)); @@ -139,13 +134,16 @@ class ProductBuild extends Command { Future execute(DataCommand command) async { var data = DataProductBuild.fromJson(getParam(command)); var shell = StringBuffer(getCDPath(workspace)); - if(data.scripts != null) { + if (data.scripts != null) { shell.write(' && chmod a+x "${data.scripts}/postinstall"'); - shell.write(' && pkgbuild --identifier "${data.identifier}" --scripts "${data.scripts}" --component "${data.appPath}" --sign "${data.installCertificationName}" --install-location "/Applications" "${data.unsignedResultPath}"'); + shell.write( + ' && pkgbuild --identifier "${data.identifier}" --scripts "${data.scripts}" --component "${data.appPath}" --sign "${data.installCertificationName}" --install-location "/Applications" "${data.unsignedResultPath}"'); } else { - shell.write(' && productbuild --component "${data.appPath}" /Applications --sign "${data.installCertificationName}" "${data.unsignedResultPath}"'); + shell.write( + ' && productbuild --component "${data.appPath}" /Applications --sign "${data.installCertificationName}" "${data.unsignedResultPath}"'); } - shell.write(' && productsign --sign "${data.installCertificationName}" "${data.unsignedResultPath}" "${data.signedResultPath}"'); + shell.write( + ' && productsign --sign "${data.installCertificationName}" "${data.unsignedResultPath}" "${data.signedResultPath}"'); var process = await ProcessExecutor.start(shell, workspace: workspace, printStderr: false); @@ -163,23 +161,27 @@ class Notarize extends Command { var isApp = path.extension(data.resultPath).toLowerCase().contains('app'); var shell = StringBuffer(getCDPath(workspace)); shell.write(' && security unlock-keychain -p${data.macPassword}'); - shell.write(' && xcrun notarytool store-credentials "${data.bundleName}" --apple-id "${data.appleAccount}" --team-id "${data.teamId}" --password "${data.applePassword}"'); + shell.write( + ' && xcrun notarytool store-credentials "${data.bundleName}" --apple-id "${data.appleAccount}" --team-id "${data.teamId}" --password "${data.applePassword}"'); var notaryTarget = data.resultPath; var appFileName = ''; var zipFileName = ''; - if(isApp) { + if (isApp) { var dir = Directory(data.resultPath).parent; appFileName = path.basename(data.resultPath); zipFileName = '${path.basenameWithoutExtension(data.resultPath)}.zip'; notaryTarget = '${dir.path}/$zipFileName'; shell.write(' && cd ${dir.path}'); - shell.write(' && ditto -c -k --sequesterRsrc --keepParent "$appFileName" "$zipFileName"'); + shell.write( + ' && ditto -c -k --sequesterRsrc --keepParent "$appFileName" "$zipFileName"'); } - shell.write(' && xcrun notarytool submit "$notaryTarget" --keychain-profile "${data.bundleName}" --wait'); + shell.write( + ' && xcrun notarytool submit "$notaryTarget" --keychain-profile "${data.bundleName}" --wait'); shell.write(' && xcrun stapler staple "${data.resultPath}"'); - if(isApp) { + if (isApp) { shell.write(' && rm $zipFileName'); - shell.write(' && ditto -c -k --sequesterRsrc --keepParent "$appFileName" "$zipFileName"'); + shell.write( + ' && ditto -c -k --sequesterRsrc --keepParent "$appFileName" "$zipFileName"'); } var process = await ProcessExecutor.start(shell, @@ -189,7 +191,6 @@ class Notarize extends Command { } } - class ArchiveiOS extends Command { Function? get error => null; diff --git a/lib/oto/commands/build/build_security.dart b/lib/oto/commands/build/build_security.dart new file mode 100644 index 0000000..000e34f --- /dev/null +++ b/lib/oto/commands/build/build_security.dart @@ -0,0 +1,15 @@ +import 'dart:async'; + +import 'package:dart_framework/utils/system_util.dart'; +import 'package:oto_cli/oto/commands/build/build_dart.dart'; +import 'package:oto_cli/oto/data/command_data.dart'; + +class BuildSecurity extends BuildDart { + @override + Future appendShell( + StringBuffer shell, DataCommand command) async { + var data = DataBuildSecurity.fromJson(command.param); + shell.write('security unlock-keychain -p${data.macPassword}'); + return dataFutrue(shell); + } +} diff --git a/lib/oto/commands/command.dart b/lib/oto/commands/command.dart index cbee057..c1aa9af 100644 --- a/lib/oto/commands/command.dart +++ b/lib/oto/commands/command.dart @@ -13,6 +13,7 @@ import 'package:oto_cli/oto/commands/build/build_dot_net.dart'; import 'package:oto_cli/oto/commands/build/build_flutter.dart'; import 'package:oto_cli/oto/commands/build/build_ios.dart'; import 'package:oto_cli/oto/commands/build/build_msbuild.dart'; +import 'package:oto_cli/oto/commands/build/build_security.dart'; import 'package:oto_cli/oto/commands/file/directory.dart'; import 'package:oto_cli/oto/commands/file/file.dart'; import 'package:oto_cli/oto/commands/file/file_diff_check.dart'; @@ -52,6 +53,7 @@ enum CommandType { BuildDotNet, BuildiOS, BuildMSBuild, + BuildSecurity, CodeSign, CodeSignVerify, ProductBuild, @@ -109,6 +111,7 @@ abstract class Command { CommandType.BuildDotNet: () => BuildDotNet(), CommandType.BuildiOS: () => BuildiOS(), CommandType.BuildMSBuild: () => BuildMSBuild(), + CommandType.BuildSecurity: () => BuildSecurity(), CommandType.CodeSign: () => CodeSign(), CommandType.CodeSignVerify: () => CodeSignVerify(), CommandType.ProductBuild: () => ProductBuild(), @@ -371,12 +374,9 @@ abstract class Command { Future executeHandle(DataCommand command, ExeHandleData handleData) async { exeHandle = handleData; - try - { + try { return await execute(command); - } - on Exception catch (e) - { + } on Exception catch (e) { return await exeHandle!.pipelineFail!.execute(); } } @@ -428,8 +428,7 @@ abstract class Command { await setProperty(data.setResult!, resultMessage); } } - if(exeHandle == null) - { + if (exeHandle == null) { if (passExitCodesMerge.contains(exitCode)) { return simpleFuture; } else { @@ -439,9 +438,7 @@ abstract class Command { data.message = errorMessage; throw Exception(data); } - } - else - { + } else { if (passExitCodesMerge.contains(exitCode)) { return await exeHandle!.pipelineSuccess!.execute(); } else { diff --git a/lib/oto/data/command_data.dart b/lib/oto/data/command_data.dart index cf28706..cdd69f4 100644 --- a/lib/oto/data/command_data.dart +++ b/lib/oto/data/command_data.dart @@ -182,12 +182,22 @@ class DataBuildDotNet extends DataParam { Map toJson() => _$DataBuildDotNetToJson(this); } +@JsonSerializable() +class DataBuildSecurity extends DataParam { + DataBuildSecurity(); + + late String macPassword; + + factory DataBuildSecurity.fromJson(Map json) => + _$DataBuildSecurityFromJson(json); + Map toJson() => _$DataBuildSecurityToJson(this); +} + //BuildiOS @JsonSerializable() class DataBuildiOS extends DataParam { DataBuildiOS(); - late String macPassword; late String scheme; late BuildPlatform? os; late String? xcodeProjectFilePath; @@ -642,7 +652,6 @@ class DataGitHubPullRequestClose extends DataParam { Map toJson() => _$DataGitHubPullRequestCloseToJson(this); } - //Protobuf @JsonSerializable() class DataProtobuf extends DataParam { diff --git a/lib/oto/data/command_data.g.dart b/lib/oto/data/command_data.g.dart index 1270238..2382678 100644 --- a/lib/oto/data/command_data.g.dart +++ b/lib/oto/data/command_data.g.dart @@ -44,6 +44,7 @@ const _$CommandTypeEnumMap = { CommandType.BuildDotNet: 'BuildDotNet', CommandType.BuildiOS: 'BuildiOS', CommandType.BuildMSBuild: 'BuildMSBuild', + CommandType.BuildSecurity: 'BuildSecurity', CommandType.CodeSign: 'CodeSign', CommandType.CodeSignVerify: 'CodeSignVerify', CommandType.ProductBuild: 'ProductBuild', @@ -91,8 +92,9 @@ const _$CommandTypeEnumMap = { DataParam _$DataParamFromJson(Map json) => DataParam() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String?; @@ -107,7 +109,7 @@ DataSimpleCommand _$DataSimpleCommandFromJson(Map json) => DataSimpleCommand() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -124,8 +126,9 @@ Map _$DataSimpleCommandToJson(DataSimpleCommand instance) => DataPrint _$DataPrintFromJson(Map json) => DataPrint() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..message = json['message'] as String; @@ -140,8 +143,9 @@ Map _$DataPrintToJson(DataPrint instance) => { DataSetValue _$DataSetValueFromJson(Map json) => DataSetValue() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..values_int = json['values-int'] as Map? @@ -165,7 +169,7 @@ DataAppDataCreator _$DataAppDataCreatorFromJson(Map json) => DataAppDataCreator() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -201,7 +205,7 @@ DataBuildMSBuild _$DataBuildMSBuildFromJson(Map json) => DataBuildMSBuild() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -235,7 +239,7 @@ DataBuildDart _$DataBuildDartFromJson(Map json) => DataBuildDart() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -254,7 +258,7 @@ DataBuildFlutter _$DataBuildFlutterFromJson(Map json) => DataBuildFlutter() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -278,7 +282,7 @@ DataBuildDartCompile _$DataBuildDartCompileFromJson( DataBuildDartCompile() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -302,7 +306,7 @@ DataBuildDotNet _$DataBuildDotNetFromJson(Map json) => DataBuildDotNet() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -317,13 +321,32 @@ Map _$DataBuildDotNetToJson(DataBuildDotNet instance) => 'projectFile': instance.projectFile, }; +DataBuildSecurity _$DataBuildSecurityFromJson(Map json) => + DataBuildSecurity() + ..workspace = json['workspace'] as String? + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() + ..setResult = json['setResult'] as String? + ..setExitCode = json['setExitCode'] as String? + ..macPassword = json['macPassword'] as String; + +Map _$DataBuildSecurityToJson(DataBuildSecurity instance) => + { + 'workspace': instance.workspace, + 'passExitCodes': instance.passExitCodes, + 'setResult': instance.setResult, + 'setExitCode': instance.setExitCode, + 'macPassword': instance.macPassword, + }; + DataBuildiOS _$DataBuildiOSFromJson(Map json) => DataBuildiOS() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? - ..macPassword = json['macPassword'] as String ..scheme = json['scheme'] as String ..os = $enumDecodeNullable(_$BuildPlatformEnumMap, json['os']) ..xcodeProjectFilePath = json['xcodeProjectFilePath'] as String? @@ -341,7 +364,6 @@ Map _$DataBuildiOSToJson(DataBuildiOS instance) => 'passExitCodes': instance.passExitCodes, 'setResult': instance.setResult, 'setExitCode': instance.setExitCode, - 'macPassword': instance.macPassword, 'scheme': instance.scheme, 'os': _$BuildPlatformEnumMap[instance.os], 'xcodeProjectFilePath': instance.xcodeProjectFilePath, @@ -364,8 +386,9 @@ const _$BuildPlatformEnumMap = { DataCodeSign _$DataCodeSignFromJson(Map json) => DataCodeSign() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..appPath = json['appPath'] as String @@ -387,7 +410,7 @@ DataCodeSignVerify _$DataCodeSignVerifyFromJson(Map json) => DataCodeSignVerify() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -406,7 +429,7 @@ DataProductBuild _$DataProductBuildFromJson(Map json) => DataProductBuild() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -433,8 +456,9 @@ Map _$DataProductBuildToJson(DataProductBuild instance) => DataNotarize _$DataNotarizeFromJson(Map json) => DataNotarize() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..macPassword = json['macPassword'] as String @@ -462,7 +486,7 @@ DataArchiveiOS _$DataArchiveiOSFromJson(Map json) => DataArchiveiOS() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -487,7 +511,7 @@ DataExportiOS _$DataExportiOSFromJson(Map json) => DataExportiOS() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -510,7 +534,7 @@ DataPublishiOS _$DataPublishiOSFromJson(Map json) => DataPublishiOS() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -541,12 +565,13 @@ Map _$DataPublishiOSToJson(DataPublishiOS instance) => DataUploader _$DataUploaderFromJson(Map json) => DataUploader() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..sftp = json['sftp'] as bool - ..port = json['port'] as int + ..port = (json['port'] as num).toInt() ..host = json['host'] as String ..user = json['user'] as String ..password = json['password'] as String @@ -568,8 +593,9 @@ Map _$DataUploaderToJson(DataUploader instance) => DataCopy _$DataCopyFromJson(Map json) => DataCopy() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..ignorePattern = (json['ignorePattern'] as List?) @@ -592,8 +618,9 @@ Map _$DataCopyToJson(DataCopy instance) => { DataDelete _$DataDeleteFromJson(Map json) => DataDelete() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..ignorePattern = (json['ignorePattern'] as List?) @@ -613,8 +640,9 @@ Map _$DataDeleteToJson(DataDelete instance) => DataRename _$DataRenameFromJson(Map json) => DataRename() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..ignorePattern = (json['ignorePattern'] as List?) @@ -636,7 +664,7 @@ DataFileDiffCheck _$DataFileDiffCheckFromJson(Map json) => DataFileDiffCheck() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -656,8 +684,9 @@ Map _$DataFileDiffCheckToJson(DataFileDiffCheck instance) => DataFileRead _$DataFileReadFromJson(Map json) => DataFileRead() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..path = json['path'] as String @@ -677,7 +706,7 @@ DataFileWrite _$DataFileWriteFromJson(Map json) => DataFileWrite() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -698,7 +727,7 @@ DataDirectoryCreate _$DataDirectoryCreateFromJson(Map json) => DataDirectoryCreate() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -718,7 +747,7 @@ DataSlackSender _$DataSlackSenderFromJson(Map json) => DataSlackSender() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -741,7 +770,7 @@ DataSlackBuild _$DataSlackBuildFromJson(Map json) => DataSlackBuild() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -780,8 +809,9 @@ const _$SlackBuildTypeEnumMap = { DataJira _$DataJiraFromJson(Map json) => DataJira() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..id = json['id'] as String @@ -812,8 +842,9 @@ Map _$DataJiraToJson(DataJira instance) => { DataJiraUser _$DataJiraUserFromJson(Map json) => DataJiraUser() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..mail = json['mail'] as String? @@ -831,8 +862,9 @@ Map _$DataJiraUserToJson(DataJiraUser instance) => DataZip _$DataZipFromJson(Map json) => DataZip() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..zipFile = json['zipFile'] as String @@ -850,8 +882,9 @@ Map _$DataZipToJson(DataZip instance) => { DataShell _$DataShellFromJson(Map json) => DataShell() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..commands = @@ -869,7 +902,7 @@ DataShellFile _$DataShellFileFromJson(Map json) => DataShellFile() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -886,8 +919,9 @@ Map _$DataShellFileToJson(DataShellFile instance) => DataGit _$DataGitFromJson(Map json) => DataGit() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..commands = @@ -903,8 +937,9 @@ Map _$DataGitToJson(DataGit instance) => { DataGitPush _$DataGitPushFromJson(Map json) => DataGitPush() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..branch = json['branch'] as String?; @@ -922,7 +957,7 @@ DataGitCheckout _$DataGitCheckoutFromJson(Map json) => DataGitCheckout() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -941,8 +976,9 @@ Map _$DataGitCheckoutToJson(DataGitCheckout instance) => DataGitCount _$DataGitCountFromJson(Map json) => DataGitCount() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..setValue = json['setValue'] as String; @@ -958,8 +994,9 @@ Map _$DataGitCountToJson(DataGitCount instance) => DataGitRev _$DataGitRevFromJson(Map json) => DataGitRev() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..branch = json['branch'] as String? @@ -977,8 +1014,9 @@ Map _$DataGitRevToJson(DataGitRev instance) => DataGitHub _$DataGitHubFromJson(Map json) => DataGitHub() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..commands = @@ -998,7 +1036,7 @@ DataGitHubPullRequestCreate _$DataGitHubPullRequestCreateFromJson( DataGitHubPullRequestCreate() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1027,7 +1065,7 @@ DataGitHubPullRequestList _$DataGitHubPullRequestListFromJson( DataGitHubPullRequestList() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1054,7 +1092,7 @@ DataGitHubPullRequestClose _$DataGitHubPullRequestCloseFromJson( DataGitHubPullRequestClose() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1072,8 +1110,9 @@ Map _$DataGitHubPullRequestCloseToJson( DataProtobuf _$DataProtobufFromJson(Map json) => DataProtobuf() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..commands = @@ -1092,7 +1131,7 @@ DataJsonReader _$DataJsonReaderFromJson(Map json) => DataJsonReader() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1115,7 +1154,7 @@ DataJsonReaderFile _$DataJsonReaderFileFromJson(Map json) => DataJsonReaderFile() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1145,8 +1184,9 @@ Map _$DataPairToJson(DataPair instance) => { DataAwsCli _$DataAwsCliFromJson(Map json) => DataAwsCli() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..subCommand = json['sub-command'] as String @@ -1164,8 +1204,9 @@ Map _$DataAwsCliToJson(DataAwsCli instance) => DataDocker _$DataDockerFromJson(Map json) => DataDocker() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..command = json['command'] as String @@ -1183,8 +1224,9 @@ Map _$DataDockerToJson(DataDocker instance) => DataGradle _$DataGradleFromJson(Map json) => DataGradle() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..args = (json['args'] as List).map((e) => e as String).toList(); @@ -1202,12 +1244,12 @@ DataStringSub _$DataStringSubFromJson(Map json) => DataStringSub() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? - ..startIndex = json['startIndex'] as int? - ..lastIndex = json['lastIndex'] as int? + ..startIndex = (json['startIndex'] as num?)?.toInt() + ..lastIndex = (json['lastIndex'] as num?)?.toInt() ..text = json['text'] as String ..setValue = json['setValue'] as String; @@ -1227,7 +1269,7 @@ DataStringReplace _$DataStringReplaceFromJson(Map json) => DataStringReplace() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1250,8 +1292,9 @@ Map _$DataStringReplaceToJson(DataStringReplace instance) => DataWebBase _$DataWebBaseFromJson(Map json) => DataWebBase() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..url = json['url'] as String @@ -1279,8 +1322,9 @@ Map _$DataWebBaseToJson(DataWebBase instance) => DataWebFile _$DataWebFileFromJson(Map json) => DataWebFile() ..workspace = json['workspace'] as String? - ..passExitCodes = - (json['passExitCodes'] as List?)?.map((e) => e as int).toList() + ..passExitCodes = (json['passExitCodes'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? ..url = json['url'] as String @@ -1316,7 +1360,7 @@ DataProcessPortUse _$DataProcessPortUseFromJson(Map json) => DataProcessPortUse() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1337,7 +1381,7 @@ DataProcessRun _$DataProcessRunFromJson(Map json) => DataProcessRun() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? @@ -1358,7 +1402,7 @@ DataProcessKill _$DataProcessKillFromJson(Map json) => DataProcessKill() ..workspace = json['workspace'] as String? ..passExitCodes = (json['passExitCodes'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ..setResult = json['setResult'] as String? ..setExitCode = json['setExitCode'] as String? diff --git a/lib/oto/data/jenkins_data.g.dart b/lib/oto/data/jenkins_data.g.dart index 921400c..6d390dc 100644 --- a/lib/oto/data/jenkins_data.g.dart +++ b/lib/oto/data/jenkins_data.g.dart @@ -14,8 +14,8 @@ DataCommon _$DataCommonFromJson(Map json) => DataCommon() ..jobUrl = json['jobUrl'] as String ..jobName = json['jobName'] as String ..gitCommit = json['gitCommit'] as String - ..buildNumber = json['buildNumber'] as int - ..buildID = json['buildID'] as int + ..buildNumber = (json['buildNumber'] as num).toInt() + ..buildID = (json['buildID'] as num).toInt() ..buildDisplayName = json['buildDisplayName'] as String ..gitBranch = json['gitBranch'] as String ..buildTag = json['buildTag'] as String; diff --git a/lib/oto/data/jira_data.g.dart b/lib/oto/data/jira_data.g.dart index 1ff06fd..d30682c 100644 --- a/lib/oto/data/jira_data.g.dart +++ b/lib/oto/data/jira_data.g.dart @@ -102,7 +102,7 @@ DataJiraIssueStatusCategory _$DataJiraIssueStatusCategoryFromJson( Map json) => DataJiraIssueStatusCategory() ..self = json['self'] as String? - ..id = json['id'] as int? + ..id = (json['id'] as num?)?.toInt() ..key = json['key'] as String? ..colorName = json['colorName'] as String? ..name = json['name'] as String?; @@ -141,7 +141,7 @@ Map _$DataJiraUserToJson(DataJiraUser instance) => DataJiraIssueDesc _$DataJiraIssueDescFromJson(Map json) => DataJiraIssueDesc() - ..version = json['version'] as int? + ..version = (json['version'] as num?)?.toInt() ..doc = json['doc'] as String? ..content = (json['content'] as List?) ?.map((e) => DataJiraContent.fromJson(e as Map))