ABT - Another/Awesome Build Tool

Table of Contents

Introduction

Building a JavaScript app? Does your app request multiple JavaScript files one by one? Multiple requests are slow and inefficient, even worse when the user is on a mobile connection.

Save your user's bandwidth and polish your app with nearly no extra work.

No one likes apps, that causes batteries to drain, and no one likes messy code; so get the best of both worlds!

What is it?

ABT - a command-line interface for merging files.

It is written in Java and therefore it can run on every platform that has a JVM installed and properly configured.

Installation

This section does currently not work with the public release version of ABT and is intended for the Development Version and Beta Testers. If you are not a Beta Tester, head right over to the manual installation notes.

Extract the abt.zip and run abt.jar either by double-clicking it or by running java -jar abt.jar inside a terminal. You need to to have SuperUser Permissionsn to install abt system-wide. For Linux you might do something like sudo java -jar abt.jar. If you happen to be stuck with a Windows PC you might try to right-click on abt.jar and select Run as Administrator. If this doesn't work try to hit WIN and type in cmd. Once it shows cmd.exe right-click it and select Run as Administrator.

Manual Installation

I highly recommend to create a wrapper-, executable file for ABT.

These wrapper files should work right out of the box, if you have put/extracted the abt directory to /opt/abt (linux) or C:\apps\abt (windows).

echo '#!/bin/sh' > /tmp/abt \
&& echo 'java -jar /opt/abt/abt.jar "$@"' >> /tmp/abt \
&& chmod +x /tmp/abt && sudo cp /tmp/abt /usr/bin/abt

.. or if you are coming from a Windows(r)(tm) background:

Create a abt.bat file and put it into your path.

Contents of the file

@echo off
java -jar C:\apps\abt\abt.jar "%*"

If you have a created a wrapper file, you can call abt instead of java -jar /path/to/abt.jar which is sexy and convenient.

Arguments

You can always see a list of all possible arguments by calling java -jar abt.jar -h.

Another/Awesome Build Tool.
No setup required; use the force wisely.

Mandatory arguments to long options are mandatory for short options too.

  --about                          Shows the splash-screen.

  -l  --list                       Lists all jobs (shows ID and comment).

  -h  --help                       Shows this screen.

  -v  --version                    Version info.

  --skel  --skeleton               Create a default (skeleton) abtfile.json

  -c  --config CONFIGFILE          Path to the config file.

  -j  --job ID1,ID2                Restrict to certain jobs.
                                   Runs only jobs with the supplied ID(s).
                                   IDs do not have to be unique.
                                   If you have multiple CSS jobs,
                                   you can group the jobs by assigning
                                   the same ID to them.

  -f  --force                      Force build. Skip required packages check.

  -h  --help                       Shows this screen.

Examples

I highly recommend that you head over to Yet Another 2048-Game Clone and take a look on how I rewrote some parts of the source, so we could utilize PGME / ABT. It's a real world example which is also well documented.

Configuration file

A configuration file (which defaults to ./abfile.json) is required. This is the content of the sample configuration file. You can generate a sample abtfile.json by running java -jar abt.jar --skeleton

{
  "version": "1",
  "watchers": [
    {
      "id": "sass",
      "author": "Marco Kellershoff <noreply@google.com>",
      "filepath": "./src/sass/app"
    },
    {
      "id": "js",
      "author": "Marco Kellershoff <noreply@google.com>",
      "filepath": "./src/js/app"
    },
    {
      "id": "css",
      "author": "Yvonne A. <noreply@google.com>",
      "filepath": "./src/css/app"
    }
  ],
  "jobs": [
    {
      "id": "sass",
      "author": "Marco Kellershoff <noreply@google.com>",
      "watcherOnly": true,
      "callbacks": [
        {
          "command": "sass",
          "args": "./src/sass/app/%modified-file-filename:./src/css/app/%modified-file-filename-without-extension.%modified-file-extension",
          "replace": [
            {
              "source": "%modified-file-extension",
              "search": "scss",
              "replace": "css"
            }
          ]
        }
      ]
    },
    {
      "id": "js",
      "author": "Marco Kellershoff <noreply@google.com>",
      "filepath": "./www/js/app.js",
      "contents": [
        "./src/js/skel/app/start.js",
        "./src/js/app/init.js",
        "./src/js/skel/app/end.js"
      ],
      "callbacks": [
        {
          "command": "jshint",
          "args": "%job-filepath"
        }
      ]
    },
    {
      "id": "css",
      "author": "Yvonne A. <noreply@google.com>",
      "filepath": "./www/css/app.css",
      "contents": [
        "./src/css/app/main.css"
      ],
      "callbacks": [
        {
          "command": "csslint",
          "args": "%job-filepath"
        }
      ]
    }
  ]
}

Download

Current Version is 5.2.0. You can download it here: abt.zip

Need help?

You already tinkered around, but don't really get how all of this works. I would be glad to lend you a helping hand. Just reach out to me via one of these networks: