Skip to content

Commit 74bd485

Browse files
committed
rename some traces as print. Update dox
1 parent 4b3b37b commit 74bd485

14 files changed

+273
-77
lines changed

bin/release.sh

+200-30
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,142 @@
1-
#! /bin/sh
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (c) 2017 Nat! - Mulle kybernetiK
4+
# All rights reserved.
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions are met:
8+
#
9+
# Redistributions of source code must retain the above copyright notice, this
10+
# list of conditions and the following disclaimer.
11+
#
12+
# Redistributions in binary form must reproduce the above copyright notice,
13+
# this list of conditions and the following disclaimer in the documentation
14+
# and/or other materials provided with the distribution.
15+
#
16+
# Neither the name of Mulle kybernetiK nor the names of its contributors
17+
# may be used to endorse or promote products derived from this software
18+
# without specific prior written permission.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
# POSSIBILITY OF SUCH DAMAGE.
31+
#
32+
33+
34+
# Define your project and the dependencies for homebrew
35+
# DEPENDENCIES and BUILD_DEPENDENCIES will be evaled later!
36+
# Then run this as
37+
# ./bin/release.sh --publisher mulle-nat --publisher-tap mulle-kybernetik/alpha/
38+
#
239

340
PROJECT="MulleObjcRuntime" # requires camel-case
441
DESC="An Objective-C runtime, written 100% in C"
5-
DEPENDENCIES='${DEPENDENCY_TAP}mulle-concurrent
6-
${DEPENDENCY_TAP}mulle-vararg' # no camel case, will be evaled later!
742
LANGUAGE=c # c,cpp, objc
843

9-
HEADER="src/mulle_objc_version.h"
10-
VERSIONNAME="MULLE_OBJC_RUNTIME_VERSION"
1144
NAME="mulle-objc-runtime"
1245

46+
47+
#
48+
# Keep these commented out, if the automatic detection works well
49+
# enough for you
50+
#
51+
VERSIONFILE="src/mulle_objc_version.h"
52+
VERSIONNAME="MULLE_OBJC_RUNTIME_VERSION"
53+
54+
#
55+
# Specify needed homebrew packages by name as you would when saying
56+
# `brew install`.
57+
#
58+
# Use the ${DEPENDENCY_TAP} prefix for non-official dependencies.
59+
#
60+
DEPENDENCIES='${DEPENDENCY_TAP}mulle-concurrent
61+
${DEPENDENCY_TAP}mulle-vararg'
62+
63+
BUILD_DEPENDENCIES='${BOOTSTRAP_TAP}mulle-bootstrap
64+
${BOOTSTRAP_TAP}mulle-build
65+
cmake' # cmake would be useful to, if you are cmake based!
66+
67+
68+
#######
69+
# If you are using mulle-build, you don't hafta change anything after this
70+
#######
71+
72+
#
73+
# Generate your `def install` `test do` lines here to stdout.
74+
#
75+
generate_brew_formula_build()
76+
{
77+
local project="$1"
78+
local name="$2"
79+
local version="$3"
80+
81+
generate_brew_formula_mulle_build "${project}" "${name}" "${version}"
82+
generate_brew_formula_mulle_test "${project}" "${name}" "${version}"
83+
}
84+
85+
1386
#
14-
# Ideally you don't hafta change anything below this line
87+
# If you are unhappy with the formula in general, then change
88+
# this function. Print your formula to stdout.
1589
#
16-
# source mulle-homebrew.sh (clumsily)
90+
generate_brew_formula()
91+
{
92+
# local project="$1"
93+
# local name="$2"
94+
# local version="$3"
95+
# local dependencies="$4"
96+
# local builddependencies="$5"
97+
# local homepage="$6"
98+
# local desc="$7"
99+
# local archiveurl="$8"
100+
101+
_generate_brew_formula "$@"
102+
}
17103

18-
PUBLISHER="mulle-nat"
19-
PUBLISHER_TAP="mulle-kybernetik/software/"
20-
DEPENDENCY_TAP="mulle-kybernetik/software/"
21-
BOOTSTRAP_TAP="mulle-kybernetik/alpha/"
104+
#######
105+
# Ideally changes to the following values are done with the command line
106+
# which makes it easier for forks.
107+
#######
22108

109+
MULLE_BOOTSTRAP_FAIL_PREFIX="`basename -- $0`"
110+
MULLE_HOMEBREW_VERSION="3.4.3"
23111

24-
MULLE_BOOTSTRAP_FAIL_PREFIX="release.sh"
25-
DIR="`dirname -- "$0"`"
26-
. ${DIR}/mulle-homebrew/mulle-homebrew.sh || exit 1
27-
cd "${DIR}/.."
112+
INSTALLED_MULLE_HOMEBREW_VERSION="`mulle-homebrew-env version`" || exit 1
113+
LIBEXEC_DIR="`mulle-homebrew-env libexec-path`" || exit 1
114+
115+
. "${LIBEXEC_DIR}/mulle-homebrew.sh" || exit 1
116+
. "${LIBEXEC_DIR}/mulle-git.sh" || exit 1
117+
118+
if ! homebrew_is_compatible_version "${INSTALLED_MULLE_HOMEBREW_VERSION}" "${MULLE_HOMEBREW_VERSION}"
119+
then
120+
fail "Installed mulle-homebrew version ${INSTALLED_MULLE_HOMEBREW_VERSION} is \
121+
not compatible with this script from version ${MULLE_HOMEBREW_VERSION}"
122+
fi
28123

29124
# parse options
30125
homebrew_parse_options "$@"
31126

32-
# dial past options
127+
#
128+
# dial past options now as they have been parsed
129+
#
33130
while [ $# -ne 0 ]
34131
do
35132
case "$1" in
36133
-*)
37-
shift # assume treated by homebrew options
134+
shift
38135
;;
39136

40137
--*)
41-
shift # assume treated by homebrew options
42-
shift # assume treated by homebrew options
138+
shift
139+
shift
43140
;;
44141

45142
*)
@@ -48,30 +145,103 @@ do
48145
esac
49146
done
50147

148+
# --- FORMULA GENERATION ---
51149

150+
BOOTSTRAP_TAP="${BOOTSTRAP_TAP:-mulle-kybernetik/software/}"
151+
152+
DEPENDENCY_TAP="${DEPENDENCY_TAP:-${PUBLISHER_TAP}}"
52153

53154
#
54-
# this can usually be deduced, if you follow the conventions
155+
# these can usually be deduced, if you follow the conventions
55156
#
56-
VERSION="`get_header_version "${HEADER}" "${VERSIONNAME}"`"
157+
if [ -z "${NAME}" ]
158+
then
159+
NAME="`get_name_from_project "${PROJECT}" "${LANGUAGE}"`"
160+
fi
161+
162+
if [ -z "${VERSIONFILE}" ]
163+
then
164+
VERSIONFILE="`get_header_from_name "${NAME}"`"
165+
fi
166+
167+
if [ -z "${VERSIONNAME}" ]
168+
then
169+
VERSIONNAME="`get_versionname_from_project "${PROJECT}"`"
170+
fi
171+
172+
if [ -f VERSION ]
173+
then
174+
VERSION="`head -1 VERSION`"
175+
else
176+
VERSION="`get_project_version "${VERSIONFILE}" "${VERSIONNAME}"`"
177+
if [ -z "${VERSION}" ]
178+
then
179+
VERSION="`get_project_version "src/version.h" "${VERSIONNAME}"`"
180+
fi
181+
fi
182+
183+
# where homebrew grabs the archive off
184+
ARCHIVE_URL="${ARCHIVE_URL:-https://github.com/${PUBLISHER}/${NAME}/archive/${VERSION}.tar.gz}"
185+
186+
# written into formula for homebrew, will be evaled
187+
HOMEPAGE_URL="${HOMEPAGE_URL:-https://github.com/${PUBLISHER}/${NAME}}"
188+
189+
190+
# --- HOMEBREW TAP ---
191+
# Specify to where and under what name to publish via your brew tap
192+
#
193+
if [ -z "${PUBLISHER_TAP}" ]
194+
then
195+
fail "you need to specify a publisher tap with --publisher-tap (hint: <mulle-kybernetik/software/>)"
196+
fi
197+
198+
TAPS_LOCATION="${TAPS_LOCATION:-..}"
199+
200+
HOMEBREW_TAP="${HOMEBREW_TAP:-${TAPS_LOCATION}/homebrew-`basename -- ${PUBLISHER_TAP}`}"
201+
202+
RBFILE="${RBFILE:-${NAME}.rb}"
57203

58204
# --- GIT ---
205+
206+
#
207+
# require PUBLISHER (and PUBLISHER_TAP) as command line parameter, so
208+
# that forks don't have to edit this constantly
209+
#
210+
if [ -z "${PUBLISHER}" ]
211+
then
212+
fail "you need to specify a publisher with --publisher (hint: https://github.com/<publisher>)"
213+
fi
214+
215+
59216
# tag to tag your release
60-
# and the origin where
61-
TAG="${TAG:-${TAGPREFIX}${VERSION}}"
217+
TAG="${TAG:-${TAG_PREFIX}${VERSION}}"
62218

219+
# git remote to push to, usually origin
220+
ORIGIN="${ORIGIN:-origin}"
63221

64-
# --- HOMEBREW TAP ---
65-
# Specify to where and under what bame to publish via your brew tap
66-
#
67-
RBFILE="${NAME}.rb" # ruby file for brew
68-
HOMEBREWTAP="../homebrew-`basename -- ${PUBLISHER_TAP}`" # your tap repository path
222+
# git remote to push to, usually github, can be empty
223+
GITHUB="${GITHUB:-github}"
224+
225+
# git branch to release to, source is always current
226+
BRANCH="${BRANCH:-release}"
69227

70228

71229
main()
72230
{
73-
git_main "${ORIGIN}" "${TAG}" || exit 1
74-
homebrew_main
231+
# do the release
232+
git_main "${BRANCH}" "${ORIGIN}" "${TAG}" "${GITHUB}" || exit 1
233+
234+
# generate the formula and push it
235+
homebrew_main "${PROJECT}" \
236+
"${NAME}" \
237+
"${VERSION}" \
238+
"${DEPENDENCIES}" \
239+
"${BUILD_DEPENDENCIES}" \
240+
"${HOMEPAGE_URL}" \
241+
"${DESC}" \
242+
"${ARCHIVE_URL}" \
243+
"${HOMEBREW_TAP}" \
244+
"${RBFILE}"
75245
}
76246

77247
main "$@"

dox/API_CLASS.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ very similiar, it makes sense to read this introduction to classes:
77

88
Nevertheless here are some definitions:
99

10-
class : A class is one of a classpair
11-
classpair : A classpair consists of an infraclass and a metaclass.
12-
infraclass : Often just synonym with class, this holds the methods for instances (like -dealloc)
13-
metaclass : This holds the methods for classes (+alloc)
14-
superclass : The class a class inherits from (`@interface Foo : Bar // Bar is the superclass`)
15-
protocol : A protocol is a unique id, that tags a classpair. You can ask a class
16-
if it conforms to a protocol (has this tag)
17-
category : An extension of a classpair, that adds methods to it
10+
Name | Definition
11+
-------------|-------------------------------------------
12+
class | A class is one of a classpair
13+
classpair | A classpair consists of an infraclass and a metaclass.
14+
infraclass | Often just synonym with class, this holds the methods for instances (like -dealloc)
15+
metaclass | This holds the methods for classes (like +alloc)
16+
superclass | The class a class inherits from (`@interface Foo : Bar // Bar is the superclass`)
17+
protocol | A protocol is a unique id, that tags a classpair. You can ask a class if it conforms to a protocol (has this tag)
18+
category | An extension of a classpair, that adds methods to it
1819

1920

2021
## Functions
@@ -33,21 +34,21 @@ int mulle_objc_class_add_methodlist( struct _mulle_objc_class *cls,
3334
Add methodlist `list` to `cls`. The methodlist isn't copied, so be sure that is sticks around for the lifetime of the runtime. (Check out `mulle_objc_runtime_unfailing_add_gift`)
3435

3536

36-
### `mulle_objc_class_add_protocol`
37+
### `mulle_objc_classpair_add_protocolid`
3738

3839
```
39-
void mulle_objc_class_add_protocol( struct _mulle_objc_class *cls,
40+
void mulle_objc_classpair_add_protocolid( struct _mulle_objc_class *cls,
4041
mulle_objc_protocolid_t protocolid)
4142
```
4243

4344
Add `protocolid` to class `cls`. The protocolid should be added to the infraclass and to the metaclass using two calls to `mulle_objc_class_add_protocol`. The function does not check for duplicates.
4445

4546

4647

47-
### `mulle_objc_class_is_protocol_class`
48+
### `mulle_objc_infraclass_is_protocol_class`
4849

4950
```
50-
int mulle_objc_class_is_protocol_class( struct _mulle_objc_class *cls);
51+
int mulle_objc_infraclass_is_protocol_class( struct _mulle_objc_infraclass *cls);
5152
```
5253

5354
A class is a protocol class if (and only if)
@@ -196,10 +197,10 @@ struct _mulle_objc_class *mulle_objc_class_get_metaclass( struct _mulle_objc_c
196197
Given any class of a classpair, returns the metaclass.
197198

198199

199-
### `mulle_objc_class_conforms_to_protocol`
200+
### `mulle_objc_class_conformsto_protocol`
200201

201202
```
202-
int mulle_objc_class_conforms_to_protocol( struct _mulle_objc_class *cls, mulle_objc_protocolid_t protocolid)
203+
int mulle_objc_class_conformsto_protocol( struct _mulle_objc_class *cls, mulle_objc_protocolid_t protocolid)
203204
```
204205

205206
Returns 1 if `cls` conforms to a protocol with `protocolid`. This can be asked

dox/API_GLOBAL.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Compute the **ivarid** from ASCII string `s`. Will return
8383
mulle_objc_methodid_t mulle_objc_methodid_from_string( char *s)
8484
```
8585

86-
Compute the **methodif** from ASCII string `s`. Will return
86+
Compute the **methodid** from ASCII string `s`. Will return
8787
`MULLE_OBJC_NO_METHODID` if `s` is NULL.
8888

8989

@@ -96,6 +96,7 @@ mulle_objc_protocolid_t mulle_objc_protocolid_from_string( char *s)
9696
Compute the **protocolid** from ASCII string `s`. Will return
9797
`MULLE_OBJC_NO_PROTOCOLID` if `s` is NULL.
9898

99+
99100
## Thread Functions
100101

101102
If your thread wants to acces the mulle-runtime (except the thread you

dox/API_METHOD.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ Returns the @encoded type of the method. This is an ASCII string, terminated
2626
by \0. It's lifetime is the same as that of `method`. Don't free it.
2727

2828

29-
### `mulle_objc_method_get_id`
29+
### `mulle_objc_method_get_methodid`
3030

3131
```
32-
mulle_objc_methodid_t mulle_objc_method_get_id( struct _mulle_objc_method *method)
32+
mulle_objc_methodid_t mulle_objc_method_get_methodid( struct _mulle_objc_method *method)
3333
```
3434

3535
{
36-
return( method ? _mulle_objc_method_get_id( method) : MULLE_OBJC_NO_METHODID);
36+
return( method ? _mulle_objc_method_get_methodid( method) : MULLE_OBJC_NO_METHODID);
3737
}
3838

3939

40-
Returns the ID od the method. This is a unique hash across all methods.
40+
Returns the ID of the method. This is a unique hash across all methods.
4141

4242
### `mulle_objc_method_get_implementation`
4343

dox/API_PROPERTY.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ char *mulle_objc_property_get_signature( struct _mulle_objc_property *property
2323

2424
Get the signature of the property. This is not the same as the signature of the instance variable. The returned string's lifetime is that of the property. Don't free it.
2525

26-
### `mulle_objc_property_get_id`
26+
### `mulle_objc_property_get_propertyid`
2727

2828
```
29-
mulle_objc_propertyid_t mulle_objc_property_get_id( struct _mulle_objc_property *property)
29+
mulle_objc_propertyid_t mulle_objc_property_get_propertyid( struct _mulle_objc_property *property)
3030
```
3131

3232
Get the **propertyid** of the property.

0 commit comments

Comments
 (0)