Add pause and add compile script to Jenkinsfile

This commit is contained in:
zontreck 2024-08-30 20:53:18 -07:00
parent 81a1b27250
commit 1dd986ed50
2 changed files with 61 additions and 0 deletions

26
Jenkinsfile vendored
View file

@ -10,11 +10,37 @@ pipeline {
steps {
sh '''
#!/bin/bash
pushd dart
mkdir out
dart compile exe -o out/dbikc-linux-x64 bin/dbikc.dart
dart compile exe -o out/mkfsreport-linux-x64 bin/mkfsreport.dart
dart compile exe -o out/nbt2snbt-linux-x64 bin/nbt2snbt.dart
dart compile exe -o out/snbt2nbt-linux-x64 bin/snbt2nbt.dart
dart compile exe -o out/uuidgen-linux-x64 bin/uuidgen.dart
dart compile exe -o out/pause-linux-x64 bin/pause.dart
popd
pushd cpp
mkdir build
pushd build
cmake ..
make
popd
popd
'''
}
post {
always {
archiveArtifacts artifacts: "dart/out/*", fingerprint: true
archiveArtifacts artifacts: "cpp/build/vsleep", fingerprint: true
archiveArtifacts artifacts: "cpp/build/pause", fingerprint: true
deleteDir()
}
}

35
dart/bin/pause.dart Normal file
View file

@ -0,0 +1,35 @@
import 'dart:io';
import 'package:libac_dart/utils/IOTools.dart';
String getKeyPress() {
// Disable line mode to capture a single key press without requiring Enter
stdin.echoMode = false;
stdin.lineMode = false;
// Read a single byte from stdin
int byte = stdin.readByteSync();
// Restore line mode and echo mode to default settings
stdin.echoMode = true;
stdin.lineMode = true;
// Return the character representation of the byte
return String.fromCharCode(byte);
}
int main() {
prnt("\rPress Any Key To Continue...");
// Listen for a key press
String key = getKeyPress();
// Erase the line by printing a new line
prnt("\r\n");
// Check if the pressed key is 'Z'
if (key.toUpperCase() == 'Z') {
return 1;
}
return 0;
}