Version Gsmake--golang Gradle

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

What is Gsmake

Gsmake is an automated build tool similar to Gradle, developed using the Go language:

  1. Gsmake is a package management/download tool;
  2. Each package has its globally unique package name, as well as the version number;
  3. A package can define a series of tasks (tasks), and task support is written by Golang language;
  4. Packages can be referenced to each other, but no reference loops are present;
  5. Gsmake can easily execute the task defined by the package;

It is not difficult to see through the above description that Gsmake can not only manage Golang code with alternative make. It is also possible to write a series of plug-ins to support project management for C/C + +, even if you use it to write a book "Gsmake" is also possible this example is often mentioned in the introduction of Maven/gradle, in short, you can think of it as maven/ Gradle's Golang implementation version.

Why reinvent the wheel

  1. Programmers are common problems, their own wheels or more round;
  2. Our big Golang own package management tool, does not support versioning; There are three libraries for example: gopm trying to solve this problem, but I think the solution is not good enough;
  3. The JVM-based Maven/gradle is too heavyweight, and a JVM will be 200M;
  4. To center the--maven/gradle needs the central warehouse--gsmake not need, theoretically can be hosted in any code hosting site; At this stage, the following popular websites are supported: github/bitbucket/gopkg.in

How does Gsmake work?

Gsmake general work flow is as follows:

Because Golang is a compiled language, a compilation process is required, and the task calls from the previous step are compiled into a program with the user-defined task code and then run;

Task

Task has the following properties

  1. The task name is globally valid;
  2. A task can have a relationship of origin, but not a ring;
  3. Tasks defined by different packages can have the same name, as well as different predecessor-dependent tasks;
  4. Gsmake a task task with different packages but the same name as multiple executions of the same task;

Gsmake receives a task name and executes it--internally gsmake requires a task ordering process. The dependent task needs to be executed first:

By the above description we know that the user-defined task consists of a forward-and-loop graph, and we know that the ordering of this data structure is actually a simple topological ordering process, gsmake this part of the implementation here

Installation

Golang development environment is necessary, here is not tired of:

  1. Go get github.com/gsdocker/gsmake/cmd/gsmake, this step will install a temporary gsmake executable file into the ${gopath}/bin directory, do not forget to add the path to the system path
  2. Enter ${gopath}/src/github.com/gsdocker/gsmake, execute gsmake Setup ${installation directory}
  3. It is a bootstrap process to go into a long wait-to compile the gsmake itself again through Gsmake and install Gsmake through the setup task. Since then we can throw away the Gopath, as well as the Golang version trap to play happily.

A simple example

Look at the Gsmake project itself, it will manage itself:) POKE here!!!!! PS: Please ignore my English readme.md, you know:)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.