summaryrefslogtreecommitdiffstats
path: root/maven/make-deploy-one.sh
blob: bbc8096dc38c7abc28b8659ca643ee314293a860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh

info()
{
  echo "make-deploy-one: info: $1" 1>&2
}

if [ $# -ne 2 ]
then
  info "usage: name version"
  exit 1
fi

NAME="$1"
shift
VERSION="$1"
shift

if [ -z "${REPOSITORY_URL}" -o -z "${REPOSITORY_ID}" ] ; then
  REPOSITORY_URL="https://oss.sonatype.org/service/local/staging/deploy/maven2/"
  REPOSITORY_ID="sonatype-nexus-staging"
  # REPOSITORY_URL="scpexe://jogamp.org/home/mraynsford/repository/"
  # REPOSITORY_ID="jogamp-test-mirror"
  # REPOSITORY_URL="scpexe://jogamp.org/srv/www/jogamp.org/deployment/maven/"
  # REPOSITORY_ID="jogamp-mirror"
fi

PLATFORMS=`cat make-platforms.txt | awk '{print $1}'` || exit 1
CURRENT_DIR=`pwd` || exit 1

PROJECT_LINE=`./make-list-projects.sh | egrep "^${NAME}\s+"` || exit 1

# Determine whether or not the project has native jars
NATIVES=`echo "${PROJECT_LINE}" | awk -F: '{print $2}'` || exit 1
NATIVES=`echo "${NATIVES}"      | tr -d ' '`            || exit 1

cd "output/${NAME}/${VERSION}" || exit 1

# Deploy jar.
mvn gpg:sign-and-deploy-file        \
  "-DpomFile=pom.xml"               \
  "-Dfile=${NAME}.jar"              \
  "-Durl=${REPOSITORY_URL}"         \
  "-DrepositoryId=${REPOSITORY_ID}"

# Deploy native jars into repository, if necessary.
if [ "${NATIVES}" = "natives" ]
then
  for PLATFORM in ${PLATFORMS}
  do
    mvn gpg:sign-and-deploy-file                          \
      "-DpomFile=pom.xml"                                 \
      "-Dfile=${NAME}-${VERSION}-natives-${PLATFORM}.jar" \
      "-Dclassifier=natives-${PLATFORM}"                  \
      "-Durl=${REPOSITORY_URL}"                           \
      "-DrepositoryId=${REPOSITORY_ID}"
  done
fi

# Deploy empty 'sources' and 'javadoc' jars.
mvn gpg:sign-and-deploy-file              \
  "-DpomFile=pom.xml"                     \
  "-Dfile=${NAME}-${VERSION}-javadoc.jar" \
  "-Dclassifier=javadoc"                  \
  "-Durl=${REPOSITORY_URL}"               \
  "-DrepositoryId=${REPOSITORY_ID}"

mvn gpg:sign-and-deploy-file              \
  "-DpomFile=pom.xml"                     \
  "-Dfile=${NAME}-${VERSION}-sources.jar" \
  "-Dclassifier=sources"                  \
  "-Durl=${REPOSITORY_URL}"               \
  "-DrepositoryId=${REPOSITORY_ID}"