Skip to content

Commit 90ce0be

Browse files
authored
Feature/maven conform artifact names (ContextMapper#90)
* Add additional gradle build for standalone library with maven central conform artifact names * Add gradle wrapper jar to git * Build Eclipse and Standalone in parallel * Use travis stages * build tests * build tests * build tests * build tests * Sign and publish standalone JARs * Sign and publish standalone JARs * Sign and publish standalone JARs * Publish releases and snapshots on master only * Signing only on publication * Publish only releases or snapshots on master * Adjust build section in README.md * small .travis.yml fix
1 parent 2fbcf20 commit 90ce0be

File tree

17 files changed

+733
-21
lines changed

17 files changed

+733
-21
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ plugin.xml_gen
3333
**/src-gen
3434
**/xtend-gen
3535
**/model/generated/
36+
37+
# Build
38+
.gradle/
39+
build/
40+

.travis.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
language: java
2+
23
jdk:
34
- openjdk8
4-
if: NOT commit_message =~ ^\[Tycho\].*$
55

6-
install: /bin/true
7-
script: xvfb-run ./mvnw --settings ./.travis/settings.xml clean verify $(if [[ $TRAVIS_TAG =~ ^v.* ]]; then echo "-Prelease-composite"; fi) -B
6+
if: NOT commit_message =~ ^\[Tycho\].*$
7+
install: "/bin/true"
88

9-
after_success:
10-
- bash <(curl -s https://codecov.io/bash)
9+
jobs:
10+
include:
11+
- script: xvfb-run ./mvnw --settings ./.travis/settings.xml clean verify $(if [[ $TRAVIS_TAG =~ ^v.* ]]; then echo "-Prelease-composite"; fi) -B
12+
after_success:
13+
- bash <(curl -s https://codecov.io/bash)
14+
before_deploy:
15+
- mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
16+
- export project_version=v$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
17+
deploy:
18+
provider: releases
19+
api_key:
20+
secure: 0WeeIEzopmMh5PZnyP7U/O92GrFTSoIzthPA+qVkqEz0or8cDvbwDCtFpBgPMra9rh/FxLFg5qj/SVG2R420g34lzVlW622dt3R0sdwL6C8VNVdDRqEZuTN/aBnMA79DcBK6rjSQ6uzV9KaI0qgIzsP+G6Mg0VxSGRI0PqLdvRU+myyxDKl47k4EX5Z1lCmDmFV3Phd8oCHeiI/GNbQRADLga8Z4cO3Y8eqP6Gez9w0s2Z6cJL09KkLH+m4aEIf7c1m7CSWbAPkUCeV00XWZxmgArPBA1tlxycP6ks01FItV6ghTTykWfnq2AIZTNT9ebK+DxmtJ7GKol/H1MLET0jLcVbzy+5JHV3RNHuu6WEx11qAguWXCYaMAJkdRl5mdVKUY1kaFioOCoS5O7pan0QCjfKk/l4a9jgW2M4nvVTJTiCjpojc/p2NcjFcrT6t5F1u7+u7mG7QlFAZsU1ytbQODSu2SroF16tx8cCaBEyDGwaeEUBXDn9ofcmt+fiZJ14zLxFsuuwlf2Vjgx0uomDSiNc3gGzY8kzTUwvUO9xcVEJZnuRqVJkUejJn9YCjHXhy/V+0eq+IDQsNgsTYSac+aKWeHfNNRU8a6QSZUBrAVaZS/P0g/P5BOGQMrgW4wOg+GjoaU1RvuW897HOwZgCR7Qgc0qMI8XdNv/ifeQR4=
21+
file_glob: true
22+
file:
23+
- "./**/target/*.jar"
24+
- org.contextmapper.dsl.repository/target/org.contextmapper.dsl.repository-*.zip
25+
skip_cleanup: true
26+
on:
27+
tags: true
28+
name: "$project_version"
29+
- script: ./gradlew clean build $(if [[ $TRAVIS_TAG =~ ^v.* || ($TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == 'false') ]]; then echo "publish -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_KEY_PASSPHRASE}"; fi)
1130

12-
before_deploy:
13-
- mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
14-
- export project_version=v$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
31+
before_install:
32+
- openssl aes-256-cbc -K $encrypted_324cf7253e32_key -iv $encrypted_324cf7253e32_iv
33+
-in secret-key.gpg.enc -out secret-key.gpg -d
1534

16-
deploy:
17-
provider: releases
18-
api_key:
19-
secure: 0WeeIEzopmMh5PZnyP7U/O92GrFTSoIzthPA+qVkqEz0or8cDvbwDCtFpBgPMra9rh/FxLFg5qj/SVG2R420g34lzVlW622dt3R0sdwL6C8VNVdDRqEZuTN/aBnMA79DcBK6rjSQ6uzV9KaI0qgIzsP+G6Mg0VxSGRI0PqLdvRU+myyxDKl47k4EX5Z1lCmDmFV3Phd8oCHeiI/GNbQRADLga8Z4cO3Y8eqP6Gez9w0s2Z6cJL09KkLH+m4aEIf7c1m7CSWbAPkUCeV00XWZxmgArPBA1tlxycP6ks01FItV6ghTTykWfnq2AIZTNT9ebK+DxmtJ7GKol/H1MLET0jLcVbzy+5JHV3RNHuu6WEx11qAguWXCYaMAJkdRl5mdVKUY1kaFioOCoS5O7pan0QCjfKk/l4a9jgW2M4nvVTJTiCjpojc/p2NcjFcrT6t5F1u7+u7mG7QlFAZsU1ytbQODSu2SroF16tx8cCaBEyDGwaeEUBXDn9ofcmt+fiZJ14zLxFsuuwlf2Vjgx0uomDSiNc3gGzY8kzTUwvUO9xcVEJZnuRqVJkUejJn9YCjHXhy/V+0eq+IDQsNgsTYSac+aKWeHfNNRU8a6QSZUBrAVaZS/P0g/P5BOGQMrgW4wOg+GjoaU1RvuW897HOwZgCR7Qgc0qMI8XdNv/ifeQR4=
20-
file_glob: true
21-
file:
22-
- ./**/target/*.jar
23-
- org.contextmapper.dsl.repository/target/org.contextmapper.dsl.repository-*.zip
24-
skip_cleanup: true
25-
on:
26-
tags: true
27-
name: $project_version

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ To use the ContextMapper DSL you need the following tools:
4343
If you want to contribute and setup the IDE on your local system follow the following instructions. [Here](./wiki/Development) you get the instructions in more details.
4444

4545
### Building the Project
46+
The project currently has two builds since we have to use Maven for building the Eclipse plugin but prefer Gradle in the standalone case.
47+
With Gradle you can only build the DSL and the IDE (LSP) project. It is further used to deploy these standalone JARs to the Maven central.
48+
49+
#### Eclipse Build (Maven)
4650
The project uses the [Maven Wrapper](https://github.com/takari/maven-wrapper).
4751

4852
After cloning the project it can be built with the following command within the root directory of the project:
@@ -55,6 +59,15 @@ After cloning the project it can be built with the following command within the
5559

5660
Of course they are also executed with a _clean install_.
5761

62+
#### Standalone Build (Gradle)
63+
To build the standalone projects only, you can use the Gradle Wrapper:
64+
65+
`./gradlew clean build`
66+
67+
**Note:** If you want to deploy the libraries into your local Maven repository, you need a GPG key to sign the artifacts:
68+
69+
`./gradlew clean publishToMavenLocal -Psigning.keyId=<your-gpg-key-id> -Psigning.password=<gpg-passphrase> -Psigning.secretKeyRingFile=<path-to-gpg-keyring-file>`
70+
5871
### Setup Eclipse IDE
5972
Since this is an Xtext project you need an Eclipse IDE to work on it. Download the **Eclipse IDE for Java and DSL Developers** from [here](https://www.eclipse.org/downloads/packages/). The latest version of eclipse we worked with is [2018-09](https://www.eclipse.org/downloads/packages/release/2018-09/r/eclipse-ide-java-and-dsl-developers).
6073

build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
jcenter()
5+
}
6+
dependencies {
7+
classpath 'org.xtext:xtext-gradle-plugin:2.0.1'
8+
}
9+
}
10+
11+
def pomXml = new XmlSlurper().parse('pom.xml')
12+
13+
subprojects {
14+
ext.xtextVersion = '2.18.0'
15+
repositories {
16+
jcenter()
17+
maven {
18+
url 'https://clojars.org/repo'
19+
}
20+
}
21+
22+
apply plugin: 'java'
23+
apply plugin: 'maven-publish'
24+
apply plugin: 'org.xtext.xtend'
25+
apply from: "${rootDir}/gradle/source-layout.gradle"
26+
apply from: "${rootDir}/gradle/maven-deployment.gradle"
27+
apply plugin: 'eclipse'
28+
29+
group = 'org.contextmapper'
30+
version = pomXml.version
31+
32+
sourceCompatibility = '1.8'
33+
targetCompatibility = '1.8'
34+
35+
configurations.all {
36+
exclude group: 'asm'
37+
}
38+
39+
if (!project.hasProperty('signing.secretKeyRingFile')) {
40+
project.ext.'signing.secretKeyRingFile' = "${rootDir}/secret-key.gpg"
41+
}
42+
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ossSnapshotRepository=https://oss.sonatype.org/content/repositories/snapshots/
2+
ossReleaseStagingRepository=https://oss.sonatype.org/service/local/staging/deploy/maven2/

gradle/maven-deployment.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//see https://docs.gradle.org/current/userguide/maven_plugin.html
2+
apply plugin: 'maven'
3+
4+
uploadArchives {
5+
repositories {
6+
mavenDeployer {
7+
repository(url: "file://${buildDir}/localRepo")
8+
snapshotRepository(url: "file://${buildDir}/localRepo")
9+
}
10+
}
11+
}

gradle/source-layout.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
if (name.endsWith("-tests")) {
2+
sourceSets {
3+
main {
4+
java.srcDirs = []
5+
resources.srcDirs = []
6+
}
7+
test {
8+
java.srcDirs = ['src', 'src-gen']
9+
resources.srcDirs = ['src', 'src-gen']
10+
xtendOutputDir = 'xtend-gen'
11+
}
12+
}
13+
} else {
14+
sourceSets {
15+
main {
16+
java.srcDirs = ['src', 'src-gen']
17+
resources.srcDirs = ['src', 'src-gen']
18+
xtendOutputDir = 'xtend-gen'
19+
}
20+
test {
21+
java.srcDirs = []
22+
resources.srcDirs = []
23+
}
24+
}
25+
}
26+
27+
sourceSets.all {
28+
resources.exclude '**/*.g', '**/*.mwe2', '**/*.xtend', '**/*._trace'
29+
}
30+
31+
jar {
32+
from('model') {
33+
into('model')
34+
}
35+
manifest {
36+
attributes 'Bundle-SymbolicName': project.name
37+
}
38+
}
39+
40+
plugins.withId('war') {
41+
webAppDirName = "WebRoot"
42+
}

gradle/wrapper/gradle-wrapper.jar

54.9 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Sep 30 23:33:31 CEST 2019
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip

gradlew

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#!/usr/bin/env sh
2+
3+
##############################################################################
4+
##
5+
## Gradle start up script for UN*X
6+
##
7+
##############################################################################
8+
9+
# Attempt to set APP_HOME
10+
# Resolve links: $0 may be a link
11+
PRG="$0"
12+
# Need this for relative symlinks.
13+
while [ -h "$PRG" ] ; do
14+
ls=`ls -ld "$PRG"`
15+
link=`expr "$ls" : '.*-> \(.*\)$'`
16+
if expr "$link" : '/.*' > /dev/null; then
17+
PRG="$link"
18+
else
19+
PRG=`dirname "$PRG"`"/$link"
20+
fi
21+
done
22+
SAVED="`pwd`"
23+
cd "`dirname \"$PRG\"`/" >/dev/null
24+
APP_HOME="`pwd -P`"
25+
cd "$SAVED" >/dev/null
26+
27+
APP_NAME="Gradle"
28+
APP_BASE_NAME=`basename "$0"`
29+
30+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31+
DEFAULT_JVM_OPTS=""
32+
33+
# Use the maximum available, or set MAX_FD != -1 to use that value.
34+
MAX_FD="maximum"
35+
36+
warn () {
37+
echo "$*"
38+
}
39+
40+
die () {
41+
echo
42+
echo "$*"
43+
echo
44+
exit 1
45+
}
46+
47+
# OS specific support (must be 'true' or 'false').
48+
cygwin=false
49+
msys=false
50+
darwin=false
51+
nonstop=false
52+
case "`uname`" in
53+
CYGWIN* )
54+
cygwin=true
55+
;;
56+
Darwin* )
57+
darwin=true
58+
;;
59+
MINGW* )
60+
msys=true
61+
;;
62+
NONSTOP* )
63+
nonstop=true
64+
;;
65+
esac
66+
67+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68+
69+
# Determine the Java command to use to start the JVM.
70+
if [ -n "$JAVA_HOME" ] ; then
71+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72+
# IBM's JDK on AIX uses strange locations for the executables
73+
JAVACMD="$JAVA_HOME/jre/sh/java"
74+
else
75+
JAVACMD="$JAVA_HOME/bin/java"
76+
fi
77+
if [ ! -x "$JAVACMD" ] ; then
78+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79+
80+
Please set the JAVA_HOME variable in your environment to match the
81+
location of your Java installation."
82+
fi
83+
else
84+
JAVACMD="java"
85+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86+
87+
Please set the JAVA_HOME variable in your environment to match the
88+
location of your Java installation."
89+
fi
90+
91+
# Increase the maximum file descriptors if we can.
92+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93+
MAX_FD_LIMIT=`ulimit -H -n`
94+
if [ $? -eq 0 ] ; then
95+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96+
MAX_FD="$MAX_FD_LIMIT"
97+
fi
98+
ulimit -n $MAX_FD
99+
if [ $? -ne 0 ] ; then
100+
warn "Could not set maximum file descriptor limit: $MAX_FD"
101+
fi
102+
else
103+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104+
fi
105+
fi
106+
107+
# For Darwin, add options to specify how the application appears in the dock
108+
if $darwin; then
109+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110+
fi
111+
112+
# For Cygwin, switch paths to Windows format before running java
113+
if $cygwin ; then
114+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116+
JAVACMD=`cygpath --unix "$JAVACMD"`
117+
118+
# We build the pattern for arguments to be converted via cygpath
119+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120+
SEP=""
121+
for dir in $ROOTDIRSRAW ; do
122+
ROOTDIRS="$ROOTDIRS$SEP$dir"
123+
SEP="|"
124+
done
125+
OURCYGPATTERN="(^($ROOTDIRS))"
126+
# Add a user-defined pattern to the cygpath arguments
127+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129+
fi
130+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
131+
i=0
132+
for arg in "$@" ; do
133+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135+
136+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138+
else
139+
eval `echo args$i`="\"$arg\""
140+
fi
141+
i=$((i+1))
142+
done
143+
case $i in
144+
(0) set -- ;;
145+
(1) set -- "$args0" ;;
146+
(2) set -- "$args0" "$args1" ;;
147+
(3) set -- "$args0" "$args1" "$args2" ;;
148+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154+
esac
155+
fi
156+
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
161+
}
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166+
167+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169+
cd "$(dirname "$0")"
170+
fi
171+
172+
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)