Home /Modules/operating-system/SLOSBuildReport.sleela

SLOSBuildReport.sleela

lib/operating-system/SLOSBuildReport.sleela · 95 line(s) · sleela

<< lib/operating-system/SLOSBuildReport.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLOSBuildReport — the running record of an OS build. As
     SLOSCompiler, SLISOBuilder, and SLInstallerGenerator produce SLOSArtifacts,
     each is recorded here with its path, kind, and byte size, building a
     printable index of everything the pipeline emitted. It also tracks the
     model identity the build started from and an overall success flag, so a
     caller can print one summary and know exactly which files to persist.
   
   The index is a newline-separated manifest ("kind size path"); no dynamic
   array is needed. This mirrors the honest, enumerable-output style the rest of
   the library favours.
   
   Family: operating-system. Collects SLOSArtifact; summarises an SLOSModel build. >>
#sleela 2.5
material;
class SLOSBuildReport {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10925;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < the model identity this build is for >
  String identity;
  < newline-separated "kind size path" lines >
  String index;
  int artifactCount;
  < 1 if the build completed without a failure >
  int ok;

  void configure(String modelIdentity) {
    identity = modelIdentity; index = ""; artifactCount = 0; ok = 1;
  }

  < Record one produced artifact. >
  void record(SLOSArtifact a) {
    String line = a.kindName() + " " + intToStr(a.byteCount()) + " " + a.outputPath();
    if (index == "") { index = line; } else { index = index + "\n" + line; }
    artifactCount = artifactCount + 1;
  }

  < Mark the build as failed (e.g. an unbuildable model). >
  void fail() { ok = 0; }

  boolean succeeded()   { return ok == 1; }
  int count()           { return artifactCount; }
  String artifactIndex(){ return index; }
  String modelIdentity(){ return identity; }

  < A one-line human summary. >
  String summary() {
    String state = "FAILED";
    if (ok == 1) { state = "OK"; }
    return state + ": " + identity + " -> " + intToStr(artifactCount) + " artifacts";
  }

  String intToStr(int v) { return "" + v; }
}