builder

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package builder compiles a module's RPG sources into ILE objects on an IBM i host, extracts the service program signature, and packages a SAVF.

It drives the host directly with CL (no Bob dependency): upload source over SFTP, CRTRPGMOD + CRTSRVPGM, read the signature via DSPSRVPGM, then SAVOBJ -> CPYTOSTMF -> download.

Package builder compiles module sources into ILE objects in dependency order, generates the *BNDDIR from the manifest, computes the *SRVPGM signature, and packages a SAVF. It wraps Bob (ibmi-bob) where that adds value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CL

func CL(h Host, label, command string) error

CL runs a single CL command and returns an error on a transport failure or a non-zero CL exit. Shared with other packages that drive the host (e.g. deploy). On CL failure the error includes the IBM i diagnostics found in the output.

func DeterministicSignature

func DeterministicSignature(name string, major uint64) string

DeterministicSignature derives a stable 16-byte signature (32 hex chars) from the module name and MAJOR version. It is stable across minor/patch releases (binary-compatible) and changes only on a major bump (breaking).

func FormatDiagnostics

func FormatDiagnostics(label, stdout, stderr string) string

FormatDiagnostics builds a readable failure message from a command's output. It surfaces the IBM i message ids found; if none, it falls back to the raw trimmed output so nothing is hidden.

func Signature

func Signature(h Host, lib, srv string) (string, error)

Signature reads the current signature of a service program via DSPSRVPGM.

Types

type Diagnostic

type Diagnostic struct {
	ID   string
	Text string
}

Diagnostic is one IBM i message extracted from command output.

func ParseDiagnostics

func ParseDiagnostics(output string) []Diagnostic

ParseDiagnostics extracts distinct IBM i messages from command output (stdout+stderr of a `system "..."` call), preserving order. The text is the trimmed line the id appeared on.

type Host

type Host interface {
	Run(cmd string) (transport.Result, error)
	RunCL(cl string) (transport.Result, error)
	Upload(localPath, remotePath string) error
	Download(remotePath, localPath string) error
}

Host is the slice of the SSH transport the builder needs.

type Options

type Options struct {
	Manifest   *manifest.Manifest
	SourceDir  string // local dir holding the module's source files
	TargetLib  string // IBM i library to build into (overrides manifest.Library)
	OutputPath string // local path to write the resulting .savf
	Keep       bool   // keep remote work objects/dir for debugging
	Logf       func(string, ...any)
}

Options configures a remote build.

type Result

type Result struct {
	Signature string   // current *SRVPGM signature (hex, e.g. "0000...E3C5C5D9C7")
	SavfPath  string   // local path of the packaged SAVF
	TargetLib string   // library the objects were built into
	Srvpgm    string   // service program name
	Modules   []string // module names built
}

Result is the outcome of a build.

func Build

func Build(h Host, opts Options) (*Result, error)

Build runs the full remote build pipeline and downloads the SAVF.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL