You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2019/05/22 17:35:32 UTC

[lucene-solr] branch jira/SOLR-13452_gradle updated: SOLR-13452: Hack around the buildTest a bit so that it can run from gradle.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/SOLR-13452_gradle by this push:
     new a20923d  SOLR-13452: Hack around the buildTest a bit so that it can run from gradle.
a20923d is described below

commit a20923ddfb1dd598df5777713bca5c5ab09724bf
Author: markrmiller <ma...@apache.org>
AuthorDate: Wed May 22 12:35:15 2019 -0500

    SOLR-13452: Hack around the buildTest a bit so that it can run from gradle.
---
 buildSrc/build.gradle                     |  3 +++
 buildSrc/test-build-wdocker/Dockerfile    | 15 +++++++++------
 buildSrc/test-build-wdocker/start.sh      |  4 +---
 buildSrc/test-build-wdocker/test-build.sh | 17 ++++++++++-------
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 3d05d70..704a820 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -18,6 +18,8 @@
 apply plugin: 'groovy'
 apply plugin: 'java-gradle-plugin'
 
+buildDir = new File("build")
+
 group = 'org.apache.lucene.gradle'
 
 repositories {
@@ -85,6 +87,7 @@ task buildTest(type: Test) {
 
   outputs.upToDateWhen { false }
   mustRunAfter tasks.test
+  dependsOn project.rootProject.clean
 }
 
 
diff --git a/buildSrc/test-build-wdocker/Dockerfile b/buildSrc/test-build-wdocker/Dockerfile
index d0cf75f..ee93150 100644
--- a/buildSrc/test-build-wdocker/Dockerfile
+++ b/buildSrc/test-build-wdocker/Dockerfile
@@ -16,14 +16,9 @@
 # Pull base image.
 FROM ubuntu:18.10
 
-# Define working directory.
-WORKDIR /home/lucene
-
 # Define default command.
 CMD ["bash"]
 
-# We actually pre install some stuff the script would install for you
-# We count on end-to-end-test-mode to test that
 RUN \
   apt-get update && \
   apt-get install -y openjdk-11-jdk && \
@@ -33,4 +28,12 @@ RUN \
 ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
 
 RUN export JAVA_HOME
-  
\ No newline at end of file
+
+RUN useradd -ms /bin/bash lucene
+
+# Define working directory.
+WORKDIR /home/lucene
+
+RUN chown -R lucene:lucene /home/lucene
+
+USER lucene
diff --git a/buildSrc/test-build-wdocker/start.sh b/buildSrc/test-build-wdocker/start.sh
index b42135e..3503b96 100644
--- a/buildSrc/test-build-wdocker/start.sh
+++ b/buildSrc/test-build-wdocker/start.sh
@@ -58,6 +58,4 @@ if [ ! "${skip_build_image}" = "true" ]; then
 fi
 
 
-docker run -itd --user ${UID} --name=${CONTAINER_NAME} -v "${script_dir}/../..":/home/lucene/project:delegated -h ${CONTAINER_NAME} ${CONTAINER_NAME} || { exit 1; }
-
-
+docker run -itd --user ${UID} --name=${CONTAINER_NAME} -v "${script_dir}/../..":/home/lucene/project:cached -h ${CONTAINER_NAME} ${CONTAINER_NAME} || { exit 1; }
diff --git a/buildSrc/test-build-wdocker/test-build.sh b/buildSrc/test-build-wdocker/test-build.sh
index d8d85ad..f3456b9 100644
--- a/buildSrc/test-build-wdocker/test-build.sh
+++ b/buildSrc/test-build-wdocker/test-build.sh
@@ -40,13 +40,19 @@ if [ -z ${CONTAINER_NAME} ]; then
 fi
 
 exec() {
-  docker exec $2 -t ${CONTAINER_NAME} bash -c "$1"
+  docker exec --user ${UID} $2 -t ${CONTAINER_NAME} bash -c "$1"
 }
 
 set -x
 
-# clean and build without unit tests
-cmd="cd /home/lucene/project;./gradlew clean build -x test"
+# NOTE: we don't clean right now, as it would wipe out buildSrc/build on us for the host
+
+# hack to allows us to run gradle in the host and then in docker on the same project files
+cmd="rm -rf /home/lucene/project/.gradle"
+exec "${cmd}" "${exec_args}" || { exit 1; }
+
+# build without unit tests
+cmd="cd /home/lucene/project;rm -rf /home/lucene/project/.gradle;./gradlew build -x test"
 exec "${cmd}" "${exec_args}" || { exit 1; }
 
 # test regenerate task
@@ -58,9 +64,6 @@ cmd="cd /home/lucene/project;./gradlew forbiddenApis"
 exec "${cmd}" "${exec_args}" || { exit 1; }
 
 # test eclipse tasks
-cmd="cd /home/lucene/project;./gradlew cleanEclipse eclipse"
+cmd="cd /home/lucene/project;./gradlew eclipse"
 exec "${cmd}" "${exec_args}" || { exit 1; }
 
-# clean up build folders
-cmd="cd /home/lucene/project;./gradlew clean"
-exec "${cmd}" "${exec_args}" || { exit 1; }