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

Diff between typedclojure and clojure forks #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5a74d03
CLJ-2561 - Support s/form on dynamically resolved s/every
frenchy64 Mar 2, 2020
0ecf47d
CLJ-2562 - add s/expand-spec and s/create-spec for s/spec
frenchy64 Mar 2, 2020
c6c63f4
spec2 dev
frenchy64 Mar 6, 2020
3d4a392
pom
frenchy64 Mar 7, 2020
dbd36fb
prep
frenchy64 Mar 7, 2020
634d673
workflow
frenchy64 Mar 7, 2020
bee2bed
prep
frenchy64 Mar 7, 2020
fa32a9f
deploy
frenchy64 Mar 7, 2020
e02c9cd
snapshot
frenchy64 Mar 7, 2020
bf8076e
[prep-release] 0.2.177-frenchy64-1 0.2.177-frenchy64-2-SNAPSHOT
frenchy64 Mar 7, 2020
27bc6f2
pom
frenchy64 Mar 7, 2020
036f2e5
[prep-release] 0.2.177-frenchy64-1 0.2.177-frenchy64-2-SNAPSHOT
frenchy64 Mar 7, 2020
b9e7d0e
[maven-release-plugin] prepare release 0.2.177-frenchy64-1
frenchy64 Mar 7, 2020
7c9f7a5
[maven-release-plugin] prepare for next development iteration
frenchy64 Mar 7, 2020
ba4eebb
change name
frenchy64 Mar 7, 2020
890b92b
Merge branch 'typedclojure' of github.com:typedclojure/spec-alpha2 in…
frenchy64 Mar 7, 2020
97aa89c
pom
frenchy64 Mar 7, 2020
5c6af6d
[prep-release] 0.2.177-typedclojure-1 0.2.177-typedclojure-2-SNAPSHOT
frenchy64 Mar 7, 2020
972f426
[maven-release-plugin] prepare release 0.2.177-typedclojure-1
frenchy64 Mar 7, 2020
eeaa651
[maven-release-plugin] prepare for next development iteration
frenchy64 Mar 7, 2020
c2f7677
Merge branch 'master' of https://github.com/clojure/spec-alpha2 into …
frenchy64 Dec 18, 2020
b701770
bump setup-clojure
frenchy64 Dec 18, 2020
0390d6b
script
frenchy64 Dec 18, 2020
738fad2
[prep-release] 0.2.177-typedclojure-2 0.2.177-SNAPSHOT
frenchy64 Dec 18, 2020
9da58ec
[maven-release-plugin] prepare release 0.2.177-typedclojure-2
frenchy64 Dec 18, 2020
0debd54
[maven-release-plugin] prepare for next development iteration
frenchy64 Dec 18, 2020
cb6bac5
fix dev version
frenchy64 Dec 18, 2020
1eb3bd7
fix kfn construction
frenchy64 Dec 20, 2020
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
29 changes: 29 additions & 0 deletions .github/workflows/typedclojure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test and deploy

on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: DeLaGuardo/setup-clojure@e73bf2b6435244b2c9c5c226ae5022d91d0ce702
with:
tools-deps: latest
- name: Configure settings.xml
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>clojars</id><username>typedclojure-clojars</username><password>${{ secrets.ClojarsPassword }}</password></server></servers></settings>" > ~/.m2/settings.xml

- name: Deploy
run: ./script/deploy-actions.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.lein*
.nrepl-port
.cpcache
.*.swp
94 changes: 93 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.clojars.typedclojure-clojars</groupId>
<artifactId>alpha.spec</artifactId>
<version>0.2.177-SNAPSHOT</version>
<version>0.2.177-typedclojure-3-SNAPSHOT</version>
<name>alpha.spec</name>
<description>Specification of data and functions</description>

Expand All @@ -21,11 +22,26 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>clojars</id>
<name>Clojars repository</name>
<url>https://clojars.org/repo</url>
</snapshotRepository>
<repository>
<id>clojars</id>
<name>Clojars repository</name>
<url>https://clojars.org/repo</url>
</repository>
</distributionManagement>

<!--
<parent>
<groupId>org.clojure</groupId>
<artifactId>pom.contrib</artifactId>
<version>0.3.0</version>
</parent>
-->

<developers>
<developer>
Expand All @@ -37,6 +53,13 @@

<properties>
<clojure.version>1.10.0</clojure.version>
<!-- By default, do not enable *warn-on-reflection*, may be
overridden in projects at the command line. -->
<clojure.warnOnReflection>false</clojure.warnOnReflection>

<clojure.source.dir>src/main/clojure</clojure.source.dir>
<clojure.testSource.dir>src/test/clojure</clojure.testSource.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
Expand Down Expand Up @@ -107,6 +130,75 @@
</testSourceDirectories>
</configuration>
</plugin>

<!-- build.pom extras, copied from TC needed to avoid sonatype and delete parent pom -->
<plugin>
<!-- Add Clojure sources to the project's source directories -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-clojure-source-dirs</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
<goal>add-resource</goal>
</goals>
<configuration>
<sources>
<source>${clojure.source.dir}</source>
</sources>
<resources>
<resource>
<directory>${clojure.source.dir}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-clojure-test-source-dirs</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
<goal>add-test-resource</goal>
</goals>
<configuration>
<sources>
<source>${clojure.testSource.dir}</source>
</sources>
<resources>
<resource>
<directory>${clojure.testSource.dir}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Clojure targets Java 1.8+ -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{project.version}</tagNameFormat>
<!-- allow local cleanup if deploy fails -->
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
</plugins>
</build>
</project>
27 changes: 27 additions & 0 deletions script/deploy-actions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/bash
# Deploys either a snapshot or release in GitHub Actions.
# If the commit message is of the form:
# [typedclojure-release] <release-version> <new-dev-version>

set -e

if [[ "$GITHUB_ACTIONS" != 'true' ]]; then
echo "Only call this script in GitHub Actions"
exit 1
fi

if [[ "$GITHUB_REPOSITORY" != 'typedclojure/spec-alpha2' ]]; then
echo "This script only deploys in typedclojure/spec-alpha2, not $GITHUB_REPOSITORY. Doing nothing."
exit 0
fi

COMMIT_MSG=$(git log --format=%B -n 1 "${GITHUB_SHA}")
echo $COMMIT_MSG
if [[ "$COMMIT_MSG" =~ ^\[prep-release\] ]]; then
#https://stackoverflow.com/a/9294015
COMMIT_MSG_ARRAY=($COMMIT_MSG)
./script/release-and-push.sh "${COMMIT_MSG_ARRAY[1]}" "${COMMIT_MSG_ARRAY[2]}"
else
echo "Not deploying snapshot releases"
#./script/deploy-snapshot.sh
fi
77 changes: 77 additions & 0 deletions script/increment-semversion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

#The MIT License (MIT)
#
#Copyright (c) 2014 Fritz Mahnke
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.

# Copied from: https://github.com/fmahnke/shell-semver/blob/4c89b49beb11034d7b384680a02f1bcfb1db249e/increment_version.sh

# Increment a version string using Semantic Versioning (SemVer) terminology.

# Parse command line options.

while getopts ":Mmp" Option
do
case $Option in
M ) major=true;;
m ) minor=true;;
p ) patch=true;;
esac
done

shift $(($OPTIND - 1))

version=$1

# Build array from version string.

a=( ${version//./ } )

# If version string is missing or has the wrong number of members, show usage message.

if [ ${#a[@]} -ne 3 ]
then
echo "usage: $(basename $0) [-Mmp] major.minor.patch"
exit 1
fi

# Increment version numbers as requested.

if [ ! -z $major ]
then
((a[0]++))
a[1]=0
a[2]=0
fi

if [ ! -z $minor ]
then
((a[1]++))
a[2]=0
fi

if [ ! -z $patch ]
then
((a[2]++))
fi

echo "${a[0]}.${a[1]}.${a[2]}"

35 changes: 35 additions & 0 deletions script/prep-actions-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#
# Prompts for next release version and dev version and
# creates a commit that triggers GitHub Actions to deploy
# the release version and bump the repo to the next dev
# version.

echo "Determining current version..."

TYPED_VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec)


if [[ "$TYPED_VERSION" == *-SNAPSHOT ]]; then
echo "Current version: ${TYPED_VERSION}"

#https://stackoverflow.com/a/125340
DEFAULT_RELEASE_VERSION="${TYPED_VERSION%-SNAPSHOT}"
#https://stackoverflow.com/a/2642592 (bash 3 compatible)
read -p "Choose release version [${DEFAULT_RELEASE_VERSION}]: " RELEASE_VERSION
RELEASE_VERSION=${RELEASE_VERSION:-${DEFAULT_RELEASE_VERSION}}

# default: increment patch
DEFAULT_DEV_VERSION=$(printf "%s-SNAPSHOT" $(./script/increment-semversion.sh -p ${RELEASE_VERSION}))
read -p "Choose next dev version [${DEFAULT_DEV_VERSION}]: " DEV_VERSION
DEV_VERSION=${DEV_VERSION:-${DEFAULT_DEV_VERSION}}

git commit --allow-empty -m "$(printf "[prep-release] %s %s" "${RELEASE_VERSION}" "${DEV_VERSION}")"
else
echo "Can only prep a release from a SNAPSHOT version, found $TYPED_VERSION"
exit 1
fi
81 changes: 81 additions & 0 deletions script/release-and-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
#
# Cuts a release of spec-alpha2. Requires two arguments:
# - the release version to use
# - the development SNAPSHOT version to use
#
# eg., to cut version 1.0.0 and then move to 1.0.1-SNAPSHOT,
# call this script like so:
#
# ./script/release-and-push.sh 1.0.0 1.0.1-SNAPSHOT
#
# and then push the resulting commit to the master branch.
# GitHub Actions will automatically deploy a 1.0.0 release and
# update the dev version to 1.0.1-SNAPSHOT.

set -e

DEPLOY_BRANCH="typedclojure"
DEPLOY_REPO="typedclojure/spec-alpha2"
ALLOWED_ACTOR="frenchy64"
USER_EMAIL="[email protected]"
USER_NAME="Ambrose Bonnaire-Sergeant"


if [[ "$GITHUB_ACTIONS" != 'true' ]]; then
echo "Must release on GitHub Actions only."
exit 1
fi

if [[ `git symbolic-ref --short HEAD` != "$DEPLOY_BRANCH" ]]; then
echo "Releases only triggered on the master branch. Doing nothing."
exit 0
fi

if [[ "$GITHUB_ACTOR" != "$ALLOWED_ACTOR" ]]; then
echo "Only maintainers may deploy a release. Doing nothing."
exit 0
fi

if [[ "$GITHUB_REPOSITORY" != "$DEPLOY_REPO" ]]; then
echo "Releases only allowed from $DEPLOY_REPO. Doing nothing."
exit 0
fi

git config --local user.email "$USER_EMAIL"
git config --local user.name "$USER_NAME"

RELEASE_VERSION=$1
DEVELOPMENT_VERSION=$2

if [[ -z "$RELEASE_VERSION" ]]; then
echo "Must specify release version"
exit 1
fi

if [[ -z "$DEVELOPMENT_VERSION" ]]; then
echo "Must specify development version"
exit 1
fi

# there's a chance this can fail and we have a partial
# release to Clojars. We minimize the damage by avoiding
# pushing back to master, but there's a chance the version
# was partially deployed. The correct fix (wrt clojars) is to simply
# deploy a new version (eg., if 1.0.0 fails, try 1.0.1 next).
( set -x;
mvn release:prepare release:perform \
-DreleaseVersion="$RELEASE_VERSION" \
-Dtag="$RELEASE_VERSION" \
-DdevelopmentVersion="$DEVELOPMENT_VERSION"
)

#( set -x;
#./script/bump-readme-version "$RELEASE_VERSION"
#)

#git add .
#git commit -m "Bump README versions for $RELEASE_VERSION"

# DON'T PRINT HERE
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "${DEPLOY_BRANCH}" --tags
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/alpha/spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
"Given a function symbol, set of constants, or anonymous function,
returns a spec object."
[s]
`(resolve-spec '~(explicate (ns-name *ns*) s)))
`(resolve-spec '~(explicate (ns-name *ns*) `(spec ~s))))

(defn register
"Given a namespace-qualified keyword or resolvable symbol k, and a
Expand Down
Loading