Giter VIP home page Giter VIP logo

zig-maven-plugin's Introduction

Zig Maven plugin

This plugin allows you to execute zig build to build JNI code of your java project as a part of maven build to cross compile it for different platforms making JNI great again ;).

Check https://ziglang.org to learn about zig. The most exciting things are:

  • it can compile C code
  • it can cross compile C code for different targets (linux/win/osx/...)

Check jnidemo project for quick example how to do it

How it works

It downloads zig runtime for your platform and caches it in ~/.zigcache directory. Also, it downloads missing JNIheaders necessary for cross compilation. As of now headers are provided for windows, linux, osx

It uses build.zig file (must be next to your pom.xml) and runs zig build according to parameters configured for the plugin. Check the sample pom.xml copied from jnidemo project:

      <plugin>
        <groupId>io.github.nevgeniev.zig</groupId>
        <artifactId>zig-maven-plugin</artifactId>
        <version>0.2.1</version>
        <configuration>
          <zigVersion>0.8.0</zigVersion>
          <targets>
            <target>
              <platform>x86_64-linux-gnu</platform>
              <packageName>ne.zig.demo.amd64.linux</packageName>
            </target>
            <target>
              <platform>x86_64-windows-gnu</platform>
              <packageName>ne.zig.demo.amd64.windows</packageName>
            </target>
            <target>
              <platform>x86_64-macos</platform>
              <packageName>ne.zig.demo.amd64.osx</packageName>
            </target>
            <target>
              <platform>aarch64-linux-gnu</platform>
              <packageName>ne.zig.demo.aarch64.linux</packageName>
            </target>
          </targets>
        </configuration>
        <executions>
          <execution>
            <id>zig-build</id>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

One last thing

You can code JNI in zig! Happy hacking :)

zig-maven-plugin's People

Contributors

nevgeniev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

icodein

zig-maven-plugin's Issues

Is this project maintained?

Hi! I'm trying to play around with zig and came around your maven plugin, but none of the zig tutorials seem to work. It looks like there were a changes between 0.8.0 and 0.10.1 that broke compatibility.

Would it be possible to release a new version and/or have the version directly download from the zig website?

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.