Adds a utility binary and adds tasks to the windows node

This commit is contained in:
zontreck 2024-08-24 00:02:02 -07:00
parent 6555b6c8f0
commit 92df8e4dcd
3 changed files with 104 additions and 14 deletions

48
Jenkinsfile vendored
View file

@ -1,7 +1,6 @@
pipeline {
agent {
label 'linux'
}
agent any
options {
buildDiscarder(
logRotator(
@ -11,8 +10,10 @@ pipeline {
}
stages {
stage('Build') {
agent {
label 'linux'
}
stage('Build on linux') {
steps {
script {
// Use bash as the shell for these commands
@ -26,26 +27,45 @@ pipeline {
mkdir -p out
dart compile exe -o out/dbikc bin/dbikc.dart
dart compile exe -o out/mkfsreport bin/mkfsreport.dart
tar -cvf docs.tgz doc/api/*
flutter pub publish -f --skip-validation
'''
}
}
post {
always {
archiveArtifacts artifacts: "*.tgz", fingerprint: true
archiveArtifacts artifacts: "out/*", fingerprint: true
deleteDir()
}
}
}
stage('Deploy') {
stage('Build on Windows') {
agent {
label 'windows'
}
steps {
sh 'flutter pub publish -f --skip-validation'
script {
bat "dart pub get"
bat "mkdir out"
bat "dart compile exe -o out/dbikc.exe bin/dbikc.dart"
bat "dart compile exe -o out/mkfsreport.exe bin/mkfsreport.dart"
}
}
post {
always {
archiveArtifacts artifacts: "out\\*.exe", fingerprint: true
deleteDir()
}
}
}
}
post {
always {
archiveArtifacts artifacts: "*.tgz", fingerprint: true
archiveArtifacts artifacts: "out/*", fingerprint: true
deleteDir()
}
}
}

67
bin/mkfsreport.dart Normal file
View file

@ -0,0 +1,67 @@
/*
Make File System Report
This tool will generate a HTML report for the base path specified.
*/
import 'dart:ffi';
import 'dart:io';
import 'package:libac_dart/argparse/Args.dart';
import 'package:libac_dart/argparse/Builder.dart';
import 'package:libac_dart/argparse/CLIHelper.dart';
import 'package:libac_dart/argparse/types/Bool.dart';
import 'package:libac_dart/argparse/types/String.dart';
import 'package:libac_dart/consts.dart';
import 'package:libac_dart/utils/IOTools.dart';
Future<int> main(List<String> args) async {
String VERSION = "1.0.082424.0001";
Arguments defaults = ArgumentsBuilder.builder()
.withArgument(BoolArgument(
name: "asc",
description: "Operate in ascending mode, smallest size listed first"))
.withArgument(StringArgument(
name: "path",
value: "/",
description: "The path to generate a report for"))
.withArgument(
BoolArgument(name: "help", description: "Hey look! It's me!"))
.withArgument(StringArgument(
name: "o",
value: "file.html",
description:
"Where to place the report. If not specified, stdout is used"))
.build();
Arguments parsed = await CLIHelper.parseArgs(args, Arguments());
String helpTest =
"Make File System Report\nVersion: $VERSION\nUsing LibAC Version: ${Constants.VERSION}\nAuthor: Tara Piccari\n\n${CLIHelper.makeArgCLIHelp(defaults)}";
if (parsed.count == 0 || !parsed.hasArg("path") || parsed.hasArg("help")) {
print(helpTest);
return 0;
}
bool ascending = false;
if (parsed.hasArg("asc")) ascending = true;
StringArgument pathArg = parsed.getArg("path") as StringArgument;
print("> Analyzing files...");
await getDirectorySize(pathArg.value,
cacheSize: true, recursive: true, verbose: parsed.hasArg("o"));
FileInformationCache FIC = FileInformationCache.obtain();
String report =
await FIC.generateHTMLReport(ascending: ascending, VERSION: VERSION);
if (parsed.hasArg("o")) {
prnt("> Generating report...\r");
StringArgument outputPath = parsed.getArg("o") as StringArgument;
await File(outputPath.value).writeAsString(report);
prnt("\r> Task Completed\n");
} else {
print(report);
}
return 0;
}

3
lib/consts.dart Normal file
View file

@ -0,0 +1,3 @@
class Constants {
static const VERSION = "1.2.082424+0001";
}