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

Basic versioning support #781

Merged
merged 6 commits into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,19 @@ update_error:

.PHONY: build clean update_error compile_error

VERSION := $$(opam query --version)
NAME_VERSION := $$(opam query --name-version)
ARCHIVE := $$(opam query --archive)

release:
git tag -a v$(VERSION) -m "Version $(VERSION)."
git push origin v$(VERSION)
opam publish prepare $(NAME_VERSION) $(ARCHIVE)
opam publish submit $(NAME_VERSION)
rm -rf $(NAME_VERSION)
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SUBSTS:=$(ROOT_DIR)/pkg/substs

release: test
ifndef version
$(error enviorment variable 'version' is undefined)
endif
$(SUBSTS) $(ROOT_DIR)/package.json.in
$(SUBSTS) $(ROOT_DIR)/opam.in
git add package.json opam
git commit -m "Version $(version)"
git tag -a $(version) -m "Version $(version)."
git push "[email protected]:facebook/Reason.git" $(version)
npm publish --access public

.PHONY: release
3 changes: 2 additions & 1 deletion opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

opam-version: "1.2"
name: "reason"
version: "0.0.6"
version: "1.2.5"
maintainer: "Jordan Walke <[email protected]>"
authors: [ "Jordan Walke <[email protected]>" ]
license: "BSD"
Expand Down
35 changes: 35 additions & 0 deletions opam.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
opam-version: "1.2"
name: "reason"
version: "@version@"
maintainer: "Jordan Walke <[email protected]>"
authors: [ "Jordan Walke <[email protected]>" ]
license: "BSD"
homepage: "https://github.com/facebook/reason"
doc: "http://facebook.github.io/reason"
bug-reports: "https://github.com/facebook/reason/issues"
dev-repo: "git://github.com/facebook/reason.git"
tags: [ "syntax" ]
substs: [ "pkg/META" ]
build: [
[make "compile_error"]
["ocaml" "pkg/build.ml" "native=%{ocaml-native}%"
"native-dynlink=%{ocaml-native-dynlink}%"
"utop=%{utop:installed}%"]
]
build-test: [
"ocamlbuild" "-classic-display" "-use-ocamlfind" "src_test/test_reason.byte" "--"
]
depends: [
"easy-format" {>= "1.2.0"}
"ocamlfind" {build}
"utop" {>= "1.17"}
"BetterErrors" {>= "0.0.1"}
"menhir" {>= "20160303"}
"re" {>= "1.5.0"}
]
depopts: [
]
conflicts: [
"utop" {< "1.17"}
]
available: [ ocaml-version = "4.02.3" ]
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

{
"version": "1.2.1",
"version": "1.2.5",
"description": "Reason Meta Language Toolchain",
"repository": {
"type": "git",
Expand All @@ -23,7 +24,7 @@
"val": "./_build/ocamlfind/lib"
},
"version": {
"val": "0.0.6",
"val": "1.2.5",
"global": true,
"globalCollisionBehavior": "clobber"
},
Expand All @@ -41,7 +42,7 @@
"reason_version": {
"global": true,
"globalCollisionBehavior": "clobber",
"val": "0.0.6"
"val": "1.2.5"
}
},
"name": "reason",
Expand Down
75 changes: 75 additions & 0 deletions package.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"version": "@version@",
"description": "Reason Meta Language Toolchain",
"repository": {
"type": "git",
"url": "https://github.com/facebook/reason.git"
},
"keywords": [
"reason"
],
"license": "BSD",
"homepage": "https://github.com/facebook/reason",
"exportedEnvVars": {
"reason_installed": {
"global": true,
"globalCollisionBehavior": "clobber",
"val": "true"
},
"FINDLIB": {
"global": true,
"resolveAsRelativePath": true,
"globalCollisionBehavior": "joinPath",
"val": "./_build/ocamlfind/lib"
},
"version": {
"val": "@version@",
"global": true,
"globalCollisionBehavior": "clobber"
},
"PATH": {
"global": true,
"resolveAsRelativePath": true,
"globalCollisionBehavior": "joinPath",
"val": "./_build/ocamlfind/bin"
},
"reason_enable": {
"global": true,
"globalCollisionBehavior": "clobber",
"val": "enable"
},
"reason_version": {
"global": true,
"globalCollisionBehavior": "clobber",
"val": "@version@"
}
},
"name": "reason",
"dependencies": {
"@opam-alpha/merlin": "^ 2.5.0",
"@opam-alpha/re": "^ 1.5.0",
"@opam-alpha/ocamlfind": "*",
"@opam-alpha/BetterErrors": ">= 0.0.1",
"@opam-alpha/easy-format": "^ 1.2.0",
"@opam-alpha/merlin-extend": "^ 0.3.0",
"@opam-alpha/menhir": ">= 20160303.0.0",
"@opam-alpha/ocaml": "= 4.02.3",
"dependency-env": "https://github.com/npm-ml/dependency-env.git",
"substs": "https://github.com/yunxing/substs.git",
"opam-installer-bin": "https://github.com/yunxing/opam-installer-bin.git",
"nopam": "https://github.com/yunxing/nopam.git",
"utop-bin": "https://github.com/reasonml/utop-bin"

},
"scripts": {
"editor": "eval $(dependencyEnv) && eval $EDITOR",
"postinstall": "eval $(dependencyEnv) && nopam && substs pkg/META.in && make compile_error && ocaml pkg/build.ml native=true native-dynlink=true utop=${utop_installed:-false} && (opam-installer --prefix=$opam_prefix || true)",
"clean": "eval $(dependencyEnv) && nopam && make clean",
"env": "eval $(dependencyEnv) && env",
"formatTest": "eval $(dependencyEnv) && cd formatTest; ./test.sh",
"whereisrefmt": "eval $(dependencyEnv) && which refmt"
},
"engines" : {
"npm" : ">=3.10.0"
}
}
13 changes: 13 additions & 0 deletions pkg/substs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Copyright (c) 2016-present, Facebook, Inc. All rights reserved.

re='(.*)@(.*)@(.*)'
replaced=${1%.in}
echo "" > $replaced
cat $1 | while IFS='' read line
do
while [[ $line =~ $re ]]; do
line=${BASH_REMATCH[1]}$(eval echo "\$${BASH_REMATCH[2]}")${BASH_REMATCH[3]}
done
echo "$line" >> $replaced
done