Skip to content

Commit 935ee30

Browse files
committed
Docker Compose project to regenerate JAXB files
Previously, the files were generated with local versions of Trang/Maven. It was causing to drown actual changes in cosmetic differences. This patch replaces all the prerequisites with just Docker Compose, and allows to regenerate files with the same versions for everyone. It stores Bash history and Maven cache in local files for convenience. It refers to MB Solr for making it available through Maven locally, as we don’t publish this binding in Maven central repository anyway.
1 parent 4f57616 commit 935ee30

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/docker/brainz-mmd2-jaxb/bash_history
2+
/docker/brainz-mmd2-jaxb/maven_cache

brainz-mmd2-jaxb/README

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
These are the instructions for recreating JAXB classes whenever the MMD RelaxNG definition is modified. Its a semi-automated process, there is no coding required
2-
but there are a couple of manual steps.
1+
The MusicBrainz XML Metadata Schema Java Binding
2+
------------------------------------------------
33

4-
1. Ensure Trang installed (linux ubuntu apt-get install trang, or available from http://www.thaiopensource.com/relaxng/trang.html)
4+
This directory contains the official Java binding (JAXB)
5+
for the MusicBrainz XML Metadata (MMD) schema version 2.
56

6-
2. Convert rng to xsd
7-
3. Amend the XSD schema
8-
4. Generate java classes from xsd
9-
5. Amend the Java classes
10-
Ignore files with timestamp change only
11-
../utils/regenerate-jaxb-files
7+
Most of the files are generated by a script.
128

13-
6. Build package and then install locally so visible to search server project
14-
mvn install
9+
The files can be bundled as a Maven package.
10+
11+
== Regenerate files ==
12+
13+
Whenever the MMD RELAX NG definition is modified,
14+
regenerate the XSD schema and the Java classes with:
15+
16+
```sh
17+
docker-compose --project-directory=docker/brainz-mmd2-jaxb run --rm builder
18+
```
19+
20+
== Maven artifact ==
21+
22+
See instructions for the repository [`mb-solr`](https://github.com/metabrainz/mb-solr/)
23+
from which this binding is made accessible through Maven locally for building MB Solr.

docker/brainz-mmd2-jaxb/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG MAVEN_TAG=3.9.6-eclipse-temurin-8
2+
3+
FROM maven:${MAVEN_TAG}
4+
5+
RUN apt-get update \
6+
&& apt-get install -y --no-install-recommends \
7+
trang \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
RUN ln -s /root/.bash_history.d/bash_history ~/.bash_history && \
11+
cat <<EOF >> ~/.gitconfig
12+
[safe]
13+
directory = /code
14+
EOF
15+
16+
WORKDIR /code/brainz-mmd2-jaxb
17+
CMD ../utils/regenerate-jaxb-files

docker/brainz-mmd2-jaxb/compose.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
3+
builder:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
volumes:
8+
- ./bash_history/:/root/.bash_history.d:z
9+
- ./maven_cache/:/root/.m2/repository:z
10+
- ../../:/code:z

0 commit comments

Comments
 (0)