dartle 0.10.0 copy "dartle: ^0.10.0" to clipboard
dartle: ^0.10.0 copied to clipboard

outdated

A simple build system written in Dart. Tasks are declared in a regular Dart file.

example/dartle.dart

import 'dart:convert';

import 'package:dartle/dartle.dart';

final allTasks = [
  Task(hello, argsValidator: const ArgsCount.range(min: 0, max: 1)),
  Task(bye, dependsOn: const {'hello'}),
  Task(clean),
  Task(encodeBase64,
      description: 'Encodes input.txt in base64, writing to output.txt',
      runCondition: RunOnChanges(
        inputs: file('input.txt'),
        outputs: file('output.txt'),
      )),
];

void main(List<String> args) async =>
    run(args, tasks: allTasks.toSet(), defaultTasks: {allTasks[0]});

/// To pass an argument to a task, use a ':' prefix, e.g.:
/// dartle hello :joe
void hello(List<String> args) =>
    print("Hello ${args.isEmpty ? 'World' : args[0]}!");

/// If no arguments are expected, use `_` as the function parameter.
void bye(_) => print('Bye!');

Future<void> encodeBase64(_) async {
  final input = await (await file('input.txt').files.first).readAsBytes();
  await (await file('output.txt').files.first)
      .writeAsString(base64.encode(input));
}

Future<void> clean(_) => deleteOutputs(allTasks);
7
likes
0
pub points
18%
popularity

Publisher

unverified uploader

A simple build system written in Dart. Tasks are declared in a regular Dart file.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

actors, args, clock, collection, crypto, io, logging, meta, path, test_report_parser

More

Packages that depend on dartle