Skip to content
Permalink
Browse files

used tmp directory in build

  • Loading branch information...
maciejmikosik committed Apr 25, 2017
1 parent 624c428 commit 484174bf702ccf5e73b9ae52e619390d25a506e9
Showing with 30 additions and 23 deletions.
  1. +28 −21 run/build
  2. +2 −2 test/java/org/testory/TestBuilding.java
@@ -4,8 +4,9 @@ HERE=`dirname ${0}`
cd "${HERE}/.."
PROJECT=`pwd`
RUN="${PROJECT}/run"
SINK="${PROJECT}/.sink"
DRAFT="${SINK}/draft"
TMP="/tmp"
BUILDING="${TMP}/build_testory"
UNPACKED="${BUILDING}/unpacked"
MAIN="${PROJECT}/main"
JAVA="${MAIN}/java"
JAR="${MAIN}/jar"
@@ -14,54 +15,58 @@ PROJECT=`pwd`
rm \
--recursive \
--force \
${DRAFT}
${BUILDING}

mkdir \
--parents \
${DRAFT}
${BUILDING}

mkdir \
--parents \
${UNPACKED}

########## COMPILE SOURCES ##########
javac \
-classpath "${JAR}/cglib-nodep-2.2.3.jar:${JAR}/objenesis-2.0.jar" \
-sourcepath "${JAVA}" \
-source 1.7 \
-target 1.7 \
-d "${DRAFT}" \
-d "${UNPACKED}" \
"${JAVA}/org/testory/Build.java"

########## COPY SOURCES ##########
cp \
--recursive \
"${JAVA}/." \
"${DRAFT}"
"${UNPACKED}"

########## COPY DEPENDENCIES ##########
unzip \
-q \
"${JAR}/cglib-nodep-2.2.3.jar" \
-d "${DRAFT}" \
-d "${UNPACKED}" \
net/*
unzip \
-q \
"${JAR}/objenesis-2.0.jar" \
-d "${DRAFT}" \
-d "${UNPACKED}" \
org/*

########## COPY LICENSE FILES ##########
cp \
--recursive \
"${RUN}/license/." \
"${DRAFT}"
"${UNPACKED}"

########## RESET TIMESTAMPS ##########
find \
.sink/draft/ \
${UNPACKED} \
| xargs \
touch \
--date=@0

########## ZIP JAR ##########
cd ${DRAFT}
cd ${UNPACKED}
zip \
--quiet \
--recurse-paths \
@@ -73,21 +78,23 @@ cd "${PROJECT}"
java \
-jar "${RUN}/jarjar-1.4.jar" \
process "${RUN}/jarjar-rules.txt" \
"${DRAFT}/testory.jar" \
"${DRAFT}/testory.jar"
"${UNPACKED}/testory.jar" \
"${UNPACKED}/testory.jar"

########## COPY PRODUCED JAR ##########
cp \
"${DRAFT}/testory.jar" \
"${SINK}"

echo ""
echo "BUILD SUCCESSFUL"
echo "created ${SINK}/testory.jar"
echo "sha1sum=`sha1sum ${SINK}/testory.jar | cut -f1 -d' '`"
"${UNPACKED}/testory.jar" \
"${BUILDING}"

########## CLEANUP ##########
rm \
--recursive \
--force \
"${DRAFT}"
"${UNPACKED}"

echo ""
echo "BUILD SUCCESSFUL"
echo "created ${BUILDING}/testory.jar"
echo "sha1sum=`sha1sum ${BUILDING}/testory.jar | cut -f1 -d' '`"


@@ -36,9 +36,9 @@ public void source_code_is_available_at_runtime() throws IOException {
@Test
public void build_is_deterministic() throws Exception {
exec("./run/build");
hashA = sha1(".sink/testory.jar");
hashA = sha1("/tmp/testory.jar");
exec("./run/build");
hashB = sha1(".sink/testory.jar");
hashB = sha1("/tmp/testory.jar");

assertEquals(hashA, hashB);
}

0 comments on commit 484174b

Please sign in to comment.
You can’t perform that action at this time.