Coder Social home page Coder Social logo

buildobjects's Introduction

buildobjects

buildobjects is an object based general purpose build tool

buildobjects provides a number of java classes that allow you to code your build process in a truly object-oriented fashion. It is not forcing you into a certain way of structuring your code and projects. Instead it aims at providing useful building blocks.

The rationale for using java was the availability of the full tool support to th build script. So when using buildobjects you get completetion, search for usage, and a fully featured debugger.

This prototype was originally hosted in google code and it has been migrated here for archiving purposes.

Getting Started

Download and install buildobjects

  1. Get the buildobjects-dep.jar from the downnloads section.
  2. Put the file into the local file system and create and an alias or a script to run it: alias bo="java -jar /pathtobuildobjects/buildobjects-dep.jar" Make sure that you are using java 6.

Getting the project set up

The project to be built looks somewhat like this:

.
|-- build
|   `-- Build.java
|-- lib
|   |-- commons-lang-2.3.jar
|   `-- junit-4.4.jar
|-- src
|   `-- example
|       |-- A.java
|       `-- B.java
`-- test
    `-- example
        |-- ATest.java
        `-- BTest.java

The build folder contains the actual build script. A minimal build script looks like this:

import org.buildobjects.BuildBase; 
import org.buildobjects.artifacts.Classes; 
import org.buildobjects.artifacts.FileLocation;
import org.buildobjects.artifacts.Location;
import org.buildobjects.projectmodel.JavaModule;

public class Build extends BuildBase {

    private JavaModule module;

    public Build() {
        Location location = new FileLocation(".");
        Classes libraries = location.jarDir("lib");
        module = new JavaModule(tasks, location, libraries);
    }


    public void build() {        
        build.publish(module.publishable());
    }

    public static void main(String[] args) {
        new Build().build();
    }

It is a good practice to have a separate project in your IDE setup for the builds. This includes the buildobjects-dep.jar on the classpath.

How to run?

To trigger your build form the IDE you can just execute the main method in the build file. To run a build from the command line the buildfile has to be compiled. Fortunately the buildobjects Tasklets do the job for you: bo -source build Build

After running the build you will see the following content in the target diretory:

target 0 $ tree --charset unicode
.
|-- SUCCEEDED
|-- index.html
`-- testproject-simple
    |-- test-results.txt
    `-- testproject-simple.jar

To see what this build actually published have a look at the JavaModule class. It is expected that projects will define their own JavaModule class. If it is put in the build folder it will be compiled when the build is run.

Full Example.

Project Structure

buildobjects is structured into multiple packages.In the artifacts package there are a number of classes that define different artifacts. Artifacts are mainly Sources and Classes , which are representing filesystem like tree structures. The common aspect of Sources and Classes are abstracted in Resources. There are several implementations, e.g. classes in a directory structure, classes in a jar file or classes in an in-memory structure.

The compiler package is providing a wrapper around the newly introduced java compiler API (hence it needs java6) using the concepts from the artifacts package.

On top of that the tasks package has a collection of Tasks that are the basic abstraction for a functional defintion of your build. A task being something like a function-object that can be fully wired up, before actually doing any work.

It is expected that projects build their own abstractions on top of these tasks pretty much like JavaModel , which provides a reusable default implementation for a module build. Another example of such an abstraction ist the Libraries class which provides a type safe way of expressing dependencies to external libraries.

The tasklet package provides a [Tasklet] runner, that allows to run small java programs form the command line. This way you don't have to compile your build file to build your project.

buildobjects's People

Contributors

fleipold avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.