GithubHelp home page GithubHelp logo

jnr-constants's Introduction

Java Native Runtime Constants

Build Status

Overview

This project contains Java enums for common POSIX constants. It is predominately used to make calls into jnr-posix far simpler.

Adding Constants

If you want to add new constants to the project, note that all the Java source code is generated. The gen/ directory contains Ruby code to declare the constants you want. The constant values themselves are exctracted by inspection. In order to do so, the code generator will compile a small program that outputs the values of the constants as discovered in declared header files. When the program is run, the output is parsed, and these are the values that are used when generating the Java source.

To run the code generator, you must have Rake installed in Ruby 1.9+. There are three tasks you must run in order to generate all the necessary files:

$ rake generate:xplatform
$ rake generate:platform
$ rake generate:fake

The generate:xplatform variant generates the top-level enum file. While this contains the necessary fields, it does not contain the integer values for those fields. The values lookup is delegated to either an OS-specific (and possibly architecture-specific) implementation or a so-called "fake" implementation.

To generate the OS-specific file, you use the generate:platform task. This must be run on each platform you'd like to generate the files for. As that can be cumbersome and you might not have access to a machine running each OS, you should also generate the "fake" implementation as a fail-safe. The generate:fake task is responsible for that.

The generated files are version-controlled. Please remember to commit them in addition to the Ruby templates for the generator.

Building

The project is maven-based. It uses standard maven lifecycle events. To build the code:

$ mvn package

To install the code into your local maven repository:

$ mvn install

To push snapshots out to Sonatype (you must have the necessary permissions):

$ mvn deploy

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.