Giter Club home page Giter Club logo

corral's Introduction

Corral

Pony dependency manager

Status

Corral is beta level software.

About Corral

Corral is a dependency management tool for Pony. Corral:

  • Provides extensibility for VCS and Commands.
  • Supports semver version constraints on dependencies.
  • Supports transitive dependencies.
  • Supports revision locking on dependencies using a lock.json file.
  • Uses a distinct shared VCS repo pool from per-project dependency workspace tree.
  • Uses the Pony process package for running external tools like Git and ponyc.

Design

See Corral Design for more details about the design of Corral. Ongoing questions and notes for future work can be found in Questions / Notes

Background

Check out Pony Package Dependency Management for a discussion of the research and requirements work behind Corral.

Installation

Pre-built binaries of Corral are available for Linux x86, MacOS x86, and Windows x86. To install on any of these platforms, use ponyup. For any other platform, you'll need to be build from source.

The following command is assuming that ponyup, our toolchain multiplexer, is already installed on your machine and is locatable by the name ponyup. If you don't have ponyup installed, please follow the ponyup installation instructions.

ponyup update corral release

Building From Source

See BUILD.md

Getting started using Corral

After installation, add Corral's current path to $PATH environment variable if you haven't already and follow these steps to create your first project using Corral.

Create a project

Make an empty folder and switch to this directory. This will be our example project to use Corral

mkdir myproject
cd myproject

Initialize Corral

It will create corral.json and lock.json files. At this moment they won't have much information since you haven't added any dependencies yet.

corral init

Add a dependency

This is the way to tell Corral that your project depends on this and you want to include it when building your project.

corral add github.com/ponylang/valbytes.git

Use a dependency

Create a file main.pony with following code.

use "valbytes"

actor Main
  new create(env: Env) =>
    var buf: ByteArrays = ByteArrays
    buf = buf + "!!" + "Hello," + " " + "World!"
    let greetings = buf.drop(2).string()
    env.out.print(greetings)

Get dependencies

The example Pony code is using ByteArrays type which is defined in the dependency which you have just added. Pony needs to have the source code of ByteArrays type to compile successfully. When corral update is run, Corral retrieves the source and makes it available when compiling the source code.

corral update

Build the project

Corral will now use this information to build the project. The command below act as a wrapper for ponyc

corral run -- ponyc

If there are no errors generated then an executable myproject will be created in the same folder.

You will also notice that there are two new folders _corral and _repos in your project folder now. They were generated by the corral update command. Please make sure to include them in your .gitignore file as there is no need to keep them in a versioning system since they are maintained by Corral itself.

Documentation

See DOCS.md

corral's People

Stargazers

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

Watchers

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

corral's Issues

Update to support Pony 0.34.0

Ponyc 0.34.0 has removed the Unsupported error from ProcessMonitor. It was never used. However, corral referenced it to get a displayable error message in a match statement here: https://github.com/ponylang/corral/blob/master/corral/util/action.pony#L146

When 0.34.0 is released, we'll update corral to remove the match statement and call a new method on the ProcessError (probably called string) that will get a String representation of the error.

@kulibali is in the process of adding the string error message support to ProcessMonitor prior to the 0.34.0 release.

TODO item: Do something interesting with bundle info

We currently have these fields in the bundle-level info object:

  • name
  • description
  • homepage
  • license
  • version
    Are these useful? We might also want:
  • Ponyc compiler version (range)
  • Information about non-source artifacts of the bundle. (eg, native code)
  • ?

Replace "regex" library usage

Currently, the git cmd uses "regex" functionality. Once the ci branch is merged, we want to remove the vendored regex functionality that depends on PRCRE2 and use something that has no external dependencies to make bootstrapping corral easier.

To that end

  • Regex using code should be rewritten
  • README should have "how to install pcre2" removed
  • "vendored" regex library should be removed

Add "version" command

Currently corral doesn't have the version command.

It should print corral 0.1.0 on corral version.

Improve error detection & handling in json parsing

Current parsing is optimistic and completely ignores unknown elements, and wrong types (like array instead of object). The parser should check that there are no unknown elements and all provided elements are of the correct type. Informative errors should be printed or returned.

TODO item: Include hashes in lock file

When we locate the tag/version of a commit that we want during update, we should also record its commit hash in the lock file. We can then verify this when we fetch.

The Golang module system does this to avoid surprises caused by people moving tags around out from under people and quietly breaking builds.

Idea for local override

Local Override: Stable allows local bundles that are just [relative] path entries in the bundle, resulting in canonicalized paths in the PONYPATH. How can we do this while also tracking a remote location to allow local development of a published library? That is: use remote, fork remote and work on local, commit fork to remote and go back to using that. This could be a simple matter of tracking the local location as a temporary override. Or, we just let the developer update (remove+add) the bundle with the alternate locator. Or, use a more general alias technique like go mod?

My idea: Use a general alias technique in a separate file (e.g. local-overrides.json). This way the developer(s) could have this file but do not check it into the repo. So the users cloning the repo won't have the overrides (but could add them easily if needed).

Add basic "how to" information to the README

should include:

  • how to manage dependencies with corral
  • how to install
  • how to build from source

this should be at least as good as the information that is currently in the stable README.

Add versioning

There's no version or version info right now. Will need to be able to set.

Add tests

We need tests. We don't really have any. A good start would be to copy/borrow the things we were testing with Pony-stable over to corral. There will be some conversion needed but its a start.

TODO item: Get repo cache situated in the right location

Corral uses two special locations for storing things:

  • repo_cache: Central location (per user or workspace) for caching repositories (without indexes or workspaces)
  • corral_base: Per-project location for holding the checked-out source of each dependency of the project.

Currently, these are both being put into . as:

  • ./_repos
  • ./_corral

I think these are good names, but we should add a flag / env var to control the repo cache location, defaulting to $HOME if possible. And, we should make sure we situate the corral_base next to the bundle.json in all cases. (ancestor of CWD or a dir passed on the CLI)

Allow use of lldb for corral run target

With stable it was possible for me to debug ponyc while invoking it from the stable env.

stable env lldb ponyc -- -p ./lib/osx/  --pic 

With corral this doesn't seem to be possible:

beast:pony.bzip2 rjbowli$ corral run -- lldb ponyc
run: lldb ponyc
  exit: 0
  out: (lldb) target create "ponyc"
Current executable set to 'ponyc' (x86_64).

  err: 
beast:pony.bzip2 rjbowli$ 

I don't know if there is a work-around I am missing? If not, I will probably dig into fixing this tomorrow as this is a showstopper for me.

Add FreeBSD support

I believe this is mostly adding in order as we verify everything:

1- PR support for FreeBSD
2- Nightly builds
3- Release builds

Because GitHub actions don't have FreeBSD support, we'll need to use CirrusCI.

`corral init` does not create bundle.json

Running corral init in a new directory does not create a bundle.json file on my machine. I believe this is because Bundle.modified is set to false upon construction of a new Bundle instance, and calling Bundle.save() checks modified before doing anything.

I think I can fix this with a one-liner. Stay tuned.

TODO item: Improve tool output printing, verbosity levels.

Currently, Corral has a mix of writing user output to env.out (which may be OK), and more developer-focused debug output to env.err and to a log stream. Also, the user output should support quiet/normal/verbose levels as described in the CLI options.

We should formalize the output usage and make the code consistent. I do think the user vs developer separation is useful, so maybe we can use two instances of the Log class:

  • the current Log for developer messages could remain as-is, possibly renamed to dev_log.
  • a new Log could be configured for user output, and use a leaner LogFormatter. The CLI options would map to log levels, like quiet=>err or warn, normal=>info, verbose=>fine.
  • all env.err use should be updated to one of the above logs.

Setup CI

I need to set up our standard CI.

Release 0.3.1

Should be released once #80 is merged; that's a nasty bug for folks to work with. I want to get a release out ASAP.

Improve constraint solver use

A couple of sub-issues related to how corral makes use of the semver solver:

  • If the solver returns more than one solution to a version constraint, how should we choose? Many dependency tools just pick the latest solution, but we could have other options. At least pick one.
  • Update should use the solver across the whole graph, and not just individual deps in isolation.
  • Non-semver constraints could be added to the semver solver, as a literal comparison, to allow the solver to operate across the whole graph.

Add Windows builds

Start with nightly. From there, incorporate as part of the release process.

TODO item: Figure out & fix layout of recursive deps

This is related to the tree structure under _corral, and whether to flatten all transitive dependencies to the top level there (with name flattening) or nest them under the immediate deps. I am pretty sure that this is done (as flat) already but creating an issue from the README just in case.

Transition from stable is currently problematic

There's a problem right now with using corral with various dependencies. If that dependency has a "Stable" format bundle.json then corral will try to operate on it and choke.

I think that we should take 1 of 2 possible approaches

stable format support

For a while, we should add support to handle stable format bundle.json files to corral so corral can do its thing with them in terms of handling transitive dependencies.

don't use bundle.json

The other option is to make a clean break and change the name of bundle.json for corral to something like corral.json.

Corral should support a bundle alias mechanism

To allow local development of Pony bundles, and replacement of public bundles with local or private shared versions. It would be convenient if this aliasing could be a simple override mechanism to define aliases for bundles referenced in deps that are otherwise unmodified. The aliases should apply to transitive deps too. Something like:

{
  "deps": [{ "locator": "github.com/ponylang/corral-test-repo.git/bundle2" }],
  "aliases: [{ "locator": "github.com/ponylang/corral-test-repo.git/bundle2", "alias":  "../bundle2" }]
}

But it could also be an alias field in each dep, or both. And, with either approach, Corral could load them from a distinct file that could be kept local for local development.

TODO item: Implement local paths

For local paths we should be able to skip the clone and fetch steps, and version/tag queries and checkout using symlink or copy or logical reference path in PONYPATH.

Maybe this can be done via a special "local" VCS.

Make code conform to Pony style guide

It almost assuredly doesn't.

Given this will touch a lot of code, if you can't do this in a fairly quick go, to avoid merge conflicts, it would be best to do in short increments that can be done off of latest master and merged quickly.

Perhaps a module at a time.

Issues to fix before Corral can replace Stable

This is a master list of issues that should be addressed in order for Corral to meet feature parity and be able to replace Stable.

Must-haves:

  • #26 Must support simple tag / branch references
  • #32 Remote GitLab & Bitbucket support
  • #33 Local git repos
  • #34 Local bundles (w/o vcs)
  • #59 Update recursion is a must-have, master lock is a should-have
  • #55 Windows builds

Should-haves:

  • #7 Should have at least simple usage info in a howto
  • #27 The -n option will help people learn how Corral works
  • #28 It might be messy to move the repo cache later.
  • #62 Don't want recursion crashes.

`corral run` only accepts argv[0] if it's in $PATH

To replicate:
corral run /path/to/alternate/ponyc

cmd_run.pony:39 checks that the first argument to corral run is in $PATH. This might cause frustration if people test with different versions of ponyc than the one in $PATH.

One solution to this might be to replace that check with a more permissive one, like making sure the file specified by the argument exists (or is in $PATH) and is executable.

Cleanup logging and user output

Currently, logging for programmer debugging is on by default and noisy. And, the output for user consumption doesn't respect the --quiet or --verbose flags and gets all mixed in and badly formatted.

Proposal:

  1. Add a new --debug flag for setting the programmer debugging log level, defaulting to LvlNone.
  2. Create a second Log instance for user output, with the simple formatter that sets its level based on the quiet and verbose flags to one of 3: --quiet => Warn. (default) => Info. --verbose => Fine. Add this to Context.

Could also add colors to one or both loggers like Ponyup.

Remove promisicious Env usage?

Currently all the VCSes get passed Env which allows them to print to stdout, stderr etc.

Unfortunately this also gives me ambient auth which we probably do not want. Given that Env gives access to root it would allow for anything to be done, open files, open sockets, etc.

I think we should narrow down to passing only the minimally needed env usage and work from there and add additional access as needed.

Release 0.3.2

Release date is Monday May 4. I'm going to give us a day of nightlies to make sure everything is working before doing the release.

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.