Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Upgrade PkgDev to a new 1.0 era #144

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
deps/build.log
deps/deps.jl
Manifest.toml
29 changes: 23 additions & 6 deletions .travis.yml
@@ -1,16 +1,33 @@
## Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
os:
- linux
- osx
julia:
- 0.6
- 0.7
- nightly
notifications:
email: false
git:
depth: 999999
#script: # use the default script which is equivalent to the following
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia -e 'Pkg.clone(pwd()); Pkg.build("PkgDev"); Pkg.test("PkgDev"; coverage=true)'
depth: 99999999

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - julia: nightly

## uncomment and modify the following lines to manually install system packages
#addons:
# apt: # apt-get for linux
# packages:
# - gfortran
#before_script: # homebrew for mac
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi

## uncomment the following lines to override the default test script
#script:
# - julia -e 'Pkg.build(); Pkg.test(; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("PkgDev")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
# push coverage results to Codecov
- julia -e 'Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
19 changes: 19 additions & 0 deletions Project.toml
@@ -0,0 +1,19 @@
name = "PkgDev"
uuid = "149e707d-584d-56d3-88ec-740c18e106ff"
version = "0.2.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Nullables = "4d1e1d77-625e-5b40-9113-a560ec7a8ecd"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
URIParser = "30578b45-9adc-5946-b283-645ec420af67"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
79 changes: 47 additions & 32 deletions README.md
@@ -1,54 +1,69 @@
# Julia Package Development Kit (PDK)
# Julia Package Development Kit

[![Build Status](https://travis-ci.org/JuliaLang/PkgDev.jl.svg?branch=master)](https://travis-ci.org/JuliaLang/PkgDev.jl)[![Build status](https://ci.appveyor.com/api/projects/status/gnd6dqbdaxcx1c23/branch/master?svg=true)](https://ci.appveyor.com/project/wildart/pkgdev-jl/branch/master)

PkgDev.jl provides a set of tools for a developer to create, maintain and register packages in Julia package repository, a.k.a. [METADATA](https://github.com/JuliaLang/METADATA.jl).
PkgDev.jl provides a set of tools for a developer to create, maintain and register packages in a Julia package registry, for example (but not limited to) [METADATA](https://github.com/JuliaLang/METADATA.jl).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to General by now?


## Requirements

For closer integration with GitHub API, PkgDev.jl requires `curl` to be installed.

## Usage

### register(pkg, [url])
Register `pkg` at the git URL `url`, defaulting to the configured origin URL of the git repository `Pkg.dir(pkg)`.
### Generating a `Project.toml` based on `REQUIRE`

In julia 0.7 and later, the file used to describe the dependnecies of a package was changed from a file
called `REQUIRE` to `Project.toml`. Use `PkgDev.add_project(pkgdir)` to add add a `Project.toml` file based on
the `REQUIRE` file.

### `generate(pkgdir, license)`

Generate a new package named `dirname(pkgdir)` at `pkgdir` with one of the bundled license: `"MIT"`, `"BSD"`, `CC0`, `"ISC"`, `"ASL"`, `"MPL"`, `"GPL-2.0+"`, `"GPL-3.0+"`, `"LGPL-2.1+"`, `"LGPL-3.0+"`.
If you want to make a package with a different license, you can edit it afterwards. `generate` creates a git repository at `pkgdir` for the package and inside it `LICENSE.md`, `README.md`, `Project.toml`, the julia entrypoint `$pkg/src/$pkg.jl`, and Travis and AppVeyor CI configuration files `.travis.yml` and `appveyor.yml`.

> *Warning*: If you release code for under the GPL, you may discourage collaboration from members of the Julia community who work on non-GPL packages. For example, if a user works on Package Y, which is licensed under the MIT license that is used in many community projects, other developers might not feel safe to read the code you contribute to Package Y because any indication that their work is derivative could lead to litigation. In effect, you create a situation in which your source code is percieved as being closed to anyone who is working on a non-GPL project.

Keyword parameters:

* `travis` - enables generation of the `.travis.yml` configuration for [Travis CI](https://travis-ci.org/) service, the default value is `true`.
* `appveyor` - enables generation of the `appveyor.yml` configuration for [Appveyor](http://www.appveyor.com/) service, the default value is `true`.
* `coverage` - enables generation of a code coverage reporting to [Codecov](https://codecov.io) services, default value is `true`.

### `register(pkgdir; [commit, registry, url])

Register the package at `pkgdir` at the git URL `url` to the registry at `registry` at `commit`,
defaulting to the configured origin URL of the git repository at `pkgdir`.
The `registry` defaults to the General registry, typically located at `~/.julia/registries/General` and
`commit` defaults to the current commit of the repo.

### tag(pkg, [ver, [commit]])
Tag `commit` as version `ver` of package `pkg` and create a version entry in `METADATA`. If not provided, `commit` defaults to the current commit of the `pkg` repository. If `ver` is one of the symbols `:patch`, `:minor`, `:major` the next patch, minor or major version is used. If `ver` is not provided, it defaults to `:patch`.
### `tag(pkgdir; [commit, registry])`

Tag the package at `pkgdir` on `commit` to the registry at `registry`, defaulting to the configured origin URL of the git repository at `pkgdir`. The `registry` defaults to the General registry, typically located at `~/.julia/registries/General` and `commit` defaults to the current commit of the repo.
The version used is the `version` entry in the package's project file (typically `Project.toml`).

You are strongly encouraged to update the version numbers in accordance with the [semver standard](http://semver.org/):
* Use `tag(pkg, :major)` when you make *backwards-incompatible* API changes (i.e. changes that will break existing user code).
* Use `tag(pkg, :minor)` when you *add functionality* in a backwards-compatible way (i.e. existing user code will still work, but code using the *new* functionality will not work with *older* versions of your package).
* Use `tag(pkg, :patch)` when you make bug fixes and other improvements that *don't change the API* (i.e. user code is unchanged).

If your version is above 1.0 use the following scheme for bumping version numbers:

1. **major tag** when you make *backwards-incompatible* API changes (i.e. changes that will break existing user code).
2. **minor tag** when you *add functionality* in a backwards-compatible way (i.e. existing user code will still work, but code using the *new* functionality will not work with *older* versions of your package).
3. **patch tag** when you make bug fixes and other improvements that *don't change the API* (i.e. user code is unchanged).

If your version is below 1.0, use minor tags for case 1 and patch tags for both case 2 and 3.

The key question is not how "small" the change is, but how it affects the API and user code. (Don't be reluctant to bump the minor version when you add new features to the API, no matter how trivial — version numbers are cheap!)

If you drop support for an older version of Julia, you should make at least a minor version bump even if there were no API changes.

### publish()
For each new package version tagged in `METADATA` not already published, make sure that the tagged package commits have been pushed to the repository at the registered URL for the package and if they all have, open a pull request to `METADATA`.
### `publish(registry)`

### generate(pkg, license)
Generate a new package named `pkg` with one of the bundled license: `"MIT"`, `"BSD"`, `CC0`, `"ISC"`, `"ASL"`, `"MPL"`, `"GPL-2.0+"`, `"GPL-3.0+"`, `"LGPL-2.1+"`, `"LGPL-3.0+"`. If you want to make a package with a different license, you can edit it afterwards. Generate creates a git repository at `Pkg.dir(pkg)` for the package and inside it `LICENSE.md`, `README.md`, `REQUIRE`, the julia entrypoint `$pkg/src/$pkg.jl`, and Travis and AppVeyor CI configuration files `.travis.yml` and `appveyor.yml`.
For each new package version tagged in the registry not already published, make sure that the tagged package commits have been pushed to the repository at the registered URL for the package and if they all have, open a pull request to the registry if it resides on GitHub.

> *Warning*: If you release code for Package X under the GPL, you may discourage collaboration from members of the Julia community who work on non-GPL packages. For example, if a user works on Package Y, which is licensed under the MIT license that is used in many community projects, other developers might not feel safe to read the code you contribute to Package Y because any indication that their work is derivative could lead to litigation. In effect, you create a situation in which your source code is percieved as being closed to anyone who is working on a non-GPL project.

Keyword parameters:
### `create_registry`

* `path` - a location where the package will be generated, the default location is `Pkg.dir()`
* `travis` - enables generation of the `.travis.yml` configuration for [Travis CI](https://travis-ci.org/) service, the default value is `true`.
* `appveyor` - enables generation of the `appveyor.yml` configuration for [Appveyor](http://www.appveyor.com/) service, the default value is `true`.
* `coverage` - enables generation of a code coverage reporting to [Coveralls](https://coveralls.io) and [Codecov](https://codecov.io) services, default value is `true`.

### license([lic])
List all bundled licenses. If a license label specified as a parameter then a full text of the license will be printed.

### freeable([io])
Returns a list of packages which are good candidates for
`Pkg.free`. These are packages for which you are not tracking the
tagged release, but for which a tagged release is equivalent to the
current version. You can use `Pkg.free(PkgDev.freeable())` to
automatically free all such packages.

This also prints (to `io`, defaulting to standard output) a list of
packages that are ahead of a tagged release, and prints the number of
commits that separate them. It can help discover packages that may be
due for tagging.
### `license([lic])`

List all bundled licenses. If a license label specified as a parameter then a full text of the license will be printed.
3 changes: 1 addition & 2 deletions REQUIRE
@@ -1,5 +1,4 @@
julia 0.6
julia 0.7-beta
JSON
URIParser
Compat 0.62.0
Nullables
21 changes: 14 additions & 7 deletions appveyor.yml
@@ -1,13 +1,22 @@
environment:
JULIA_PROJECT: "@."
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
Expand All @@ -30,10 +39,8 @@ install:
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"PkgDev\"); Pkg.build(\"PkgDev\")"
- C:\projects\julia\bin\julia -e "import InteractiveUtils; versioninfo();
Pkg.build()"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"PkgDev\")"
- C:\projects\julia\bin\julia -e "Pkg.test()"