-
Notifications
You must be signed in to change notification settings - Fork 82
/
multi-release.sh
executable file
·29 lines (24 loc) · 1.1 KB
/
multi-release.sh
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
#!/bin/bash
set -e
rm -rf target/mr
mkdir -p target/mr/java-8-src
mkdir -p target/mr/java-8
mkdir -p target/mr/java-9-src
mkdir -p target/mr/java-9
echo "# Compiling classes for Java 8"
sed 's/VersionDependent8/VersionDependent/g' \
src/main/java/dev/nipafx/demo/java9/runtime/multi_release/VersionDependent8.java \
> target/mr/java-8-src/VersionDependent.java
sed 's/VersionDependent8/VersionDependent/g' \
src/main/java/dev/nipafx/demo/java9/runtime/multi_release/Main.java \
> target/mr/java-8-src/Main.java
javac --release 8 -d target/mr/java-8 target/mr/java-8-src/*.java
echo "# Compiling classes for Java 9"
sed 's/VersionDependent9/VersionDependent/g' \
src/main/java/dev/nipafx/demo/java9/runtime/multi_release/VersionDependent9.java \
> target/mr/java-9-src/VersionDependent.java
javac --release 8 -d target/mr/java-9 target/mr/java-9-src/*.java
echo "# Packaging"
jar --create --file target/mr/mr.jar -C target/mr/java-8 . --release 9 -C target/mr/java-9 .
echo "# Execute the following command with Java 8 and with Java 9+:"
echo "java -cp target/mr/mr.jar dev.nipafx.demo.java9.runtime.multi_release.Main"