Giter Site home page Giter Site logo

zpm's Introduction

A package composition tool for zig

A package configuration and discovery tool.

Usage

# initializes a zpm instance in the current directory by creating a hidden .zpm folder.
# packages will then be auto-collected and .zpm/pkgs.zig will be created.
zpm init 

# re-runs package autodetection and will regenerate .zpm/pkgs.zig
zpm update

After initialization, ZPM will create the folder .zpm which contains a file .zpm/pkgs.zig. This file contain all collected packages that are available and can be imported into build.zig.

It will look roughly like this:

const std = @import("std");

pub const pkgs = struct {
    pub const android = std.build.Pkg{
        .name = "android",
        .path = .{ .path = "../vendor/AndroidSdk/source/android.zig" },
        .dependencies = &[_]std.build.Pkg{},
    };
};

pub const imports = struct {
    pub const AndroidSdk = @import("../vendor/AndroidSdk/Sdk.zig");
};

Configuration

ZPM will create a zpm.conf file in the .zpm directory that can be used to configure the project instance. This config file is a ini file and has the following entries:

# configures the path where the build.zig import file is generated.
# the path is relative to this file.
pkgs-file = pkgs.zig

Add packages

To add a new package, put a .zpm file anywhere in your project tree next or below the .zpm folder. These files must be ini files where each section declares a package named after the section.

The section allows the following keys:

[zpm]
file = rel/path/to/source.zig # a path relative to this files folder
                              # where the package root is located
deps = args, ini, uri         # comma-separated list of dependencies names
kind = default                # default = a normal runtime package, available under .pkgs
                              # build   = the package will be available under .imports 
                              # combo   = mixed build- and runtime package

These package files don't have to reside next to the package, but can also be declared outside the package source tree. This allows to configure external packages in the .zpm folder for example.

If you change anything in your package declaration files, run zpm update.

Contributing

This reboot of ZPM is made to be super-simple, but the implementation might be too simple right now. If you feel like something is missing, feel free to fork and PR!

zpm's People

Contributors

ikskuh avatar sno2 avatar

Watchers

 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.