test
This commit is contained in:
parent
058110a793
commit
c18696d9aa
2 changed files with 24 additions and 20 deletions
|
|
@ -26,12 +26,9 @@ class Application {
|
|||
static final Application _instance = Application._privateConstructor();
|
||||
static Application get instance => _instance;
|
||||
static String get current {
|
||||
if(Application.instance.buildType == BuildType.jenkins)
|
||||
{
|
||||
if (Application.instance.buildType == BuildType.jenkins) {
|
||||
return Platform.environment['WORKSPACE']!;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return pathlib.current;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +56,11 @@ class Application {
|
|||
return _buildType;
|
||||
}
|
||||
|
||||
Future build( BuildType buildType, {String? yamlContent,
|
||||
DataBuild? buildData, bool logEnable = true, String? logPath}) async {
|
||||
Future build(BuildType buildType,
|
||||
{String? yamlContent,
|
||||
DataBuild? buildData,
|
||||
bool logEnable = true,
|
||||
String? logPath}) async {
|
||||
_buildType = buildType;
|
||||
_logEnable = logEnable;
|
||||
setUTF8();
|
||||
|
|
@ -70,7 +70,7 @@ class Application {
|
|||
// var envArgs = envArguments(arguments);
|
||||
// bool isTest = envArgs.containsKey('isTest'); //for Unit Test
|
||||
try {
|
||||
if(_buildType == BuildType.scheduler) {
|
||||
if (_buildType == BuildType.scheduler) {
|
||||
commonData = DataCommon.fromJson(FileData.jenkinsMap!);
|
||||
build = buildData!;
|
||||
_logFile = File(logPath!);
|
||||
|
|
@ -81,17 +81,19 @@ class Application {
|
|||
commonData = composer.commonData;
|
||||
build = DataBuild.fromJson(getMapFromYamlA(composer.buildYaml)!);
|
||||
}
|
||||
if(_logEnable) {
|
||||
await CLI.printString('$enter********************************* Build Data *************************************', color: Color.magenta);
|
||||
if(composer != null) log(composer.buildYaml);
|
||||
if (_logEnable) {
|
||||
await CLI.printString(
|
||||
'$enter********************************* Build Data *************************************',
|
||||
color: Color.green);
|
||||
if (composer != null) log(composer.buildYaml);
|
||||
}
|
||||
|
||||
property = build.property ?? {};
|
||||
if(!property.containsKey('workspace')) {
|
||||
if (!property.containsKey('workspace')) {
|
||||
property['workspace'] = current;
|
||||
}
|
||||
property = Command.replaceAllTagsMap(property, replace: true);
|
||||
|
||||
|
||||
//set command in dic, 중복 커맨드 id 필터
|
||||
for (var command in build.commands) {
|
||||
if (dataCommandMap.containsKey(command.id)) {
|
||||
|
|
@ -124,15 +126,17 @@ class Application {
|
|||
exit(10);
|
||||
}
|
||||
|
||||
if(logEnable) await printBuildStep('Build Successfully Complete', Color.cyan);
|
||||
if(buildType != BuildType.scheduler) {
|
||||
if (logEnable)
|
||||
await printBuildStep('Build Successfully Complete', Color.cyan);
|
||||
if (buildType != BuildType.scheduler) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Future setUTF8() async {
|
||||
if (Platform.isWindows) {
|
||||
var data = await ProcessExecutor.start(StringBuffer('chcp 65001'), logHandler: logWithType);
|
||||
var data = await ProcessExecutor.start(StringBuffer('chcp 65001'),
|
||||
logHandler: logWithType);
|
||||
var exitCode = await data.process.exitCode;
|
||||
log('Set Korean: ${exitCode == 0}');
|
||||
}
|
||||
|
|
@ -144,11 +148,12 @@ class Application {
|
|||
}
|
||||
|
||||
static void log(String message, {LogType logType = LogType.verbose}) {
|
||||
if(_logFile == null) {
|
||||
if (_logFile == null) {
|
||||
print(message);
|
||||
} else {
|
||||
if(_logEnable || logType == LogType.error) {
|
||||
_logFile?.writeAsStringSync('[${getDates()}] $message\n', mode: FileMode.append, flush: true);
|
||||
if (_logEnable || logType == LogType.error) {
|
||||
_logFile?.writeAsStringSync('[${getDates()}] $message\n',
|
||||
mode: FileMode.append, flush: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ class Shell extends Command {
|
|||
} else {
|
||||
await process.waitForExit();
|
||||
var str = process.stdout.toString();
|
||||
print('====================> $str');
|
||||
var length = str.length;
|
||||
str = str.substring(0, length - 1);
|
||||
await setProperty(data.setMessage!, str);
|
||||
|
|
|
|||
Loading…
Reference in a new issue