< prev index next >

./build.gradle

Print this page
rev 9898 : 8178275: Ensemble: Upgrade version of Lucene to 7.1.0
Reviewed-by: aghaisas, prr

@@ -1130,24 +1130,10 @@
         }
     }
 }
 
 allprojects {
-    // We want to configure all projects as java projects and use the same compile settings
-    // etc, except for the root project which we just want to ignore (and for now media)
-    if (project == rootProject) {
-       return
-    }
-    if (project.path.startsWith(":apps")) {
-        // Lets handle the apps tree differently, as it is a collection of ant builds,
-        // and the ant importer collides with the 'apply plugin:java'
-        return
-    }
-    // All of our projects are java projects
-    apply plugin: "java"
-    sourceCompatibility = 1.8
-
     // Setup the repositories that we'll download libraries from. Maven Central is
     // just easy for most things. The custom "ivy" repo is for downloading SWT. The way it
     // works is to setup the download URL such that it will resolve to the actual jar file
     // to download. See SWT_FILE_NAME for the name of the jar that will be used as the
     // "artifact" in the pattern below. Note that the closed builds use different repositories

@@ -1163,10 +1149,25 @@
                 }
             }
         }
     }
 
+    // We want to configure all projects as java projects and use the same compile settings
+    // etc, except for the root project which we just want to ignore (and for now media)
+    if (project == rootProject) {
+       return
+    }
+    if (project.path.startsWith(":apps")) {
+        // Lets handle the apps tree differently, as it is a collection of ant builds,
+        // and the ant importer collides with the 'apply plugin:java'
+        return
+    }
+
+    // All of our projects are java projects
+    apply plugin: "java"
+    sourceCompatibility = 1.8
+
     // By default all of our projects require junit for testing so we can just
     // setup this dependency here.
     dependencies {
         testCompile group: "junit", name: "junit", version: "4.8.2"
         if (BUILD_CLOSED && DO_JCOV)  {

@@ -3221,19 +3222,50 @@
     // The apps build is Ant based, and gradle lets us "import" ant build.xml
     // into our configuration.
 
     ant.importBuild 'build.xml'
 
+    // Download the Lucene libraries needed for the Ensemble8 app
+    getConfigurations().create("lucene");
+    dependencies {
+        lucene group: "org.apache.lucene", name: "lucene-core", version: "7.1.0"
+        lucene group: "org.apache.lucene", name: "lucene-grouping", version: "7.1.0"
+        lucene group: "org.apache.lucene", name: "lucene-queryparser", version: "7.1.0"
+    }
+
+    // Copy Lucene libraries into the Ensemble8/lib directory
+    File ensembleLibDir = rootProject.file("apps/samples/Ensemble8/lib");
+    def libNames = [ "lucene-core-7.1.0.jar",
+                     "lucene-grouping-7.1.0.jar",
+                     "lucene-queryparser-7.1.0.jar" ]
+
+
+    task getLucene(type: Copy) {
+        doFirst {
+            ensembleLibDir.mkdirs();
+        }
+        into ensembleLibDir
+        includeEmptyDirs = false
+        configurations.lucene.files.each { f ->
+            libNames.each { name ->
+                if (name == f.getName()) {
+                    from f.getPath()
+                }
+            }
+        }
+    }
+
     compileTargets { t ->
         // The apps build is Ant based, and gradle lets us "import" ant apps/build.xml
         // into our configuration.
 
         // override the apps build.xml with an explicit pointer to our jar.
         def sdkDirName = rootProject.ext[t.upper].sdkDirName
         def jfxrtJar = "${rootProject.buildDir}/${sdkDirName}/rt/lib/ext/jfxrt.jar"
 
         def appsJar = project.task("appsJar${t.capital}") {
+            dependsOn(sdk, getLucene)
             doLast() {
               ant.properties['targetBld'] = "$t.name"
               if (!rootProject.ext[t.upper].compileSwing) {
                 ant.properties['JFX_CORE_ONLY'] = 'true'
               }

@@ -3255,10 +3287,11 @@
               ant.project.executeTarget("sampleAppsClean")
               ant.project.executeTarget("scenebuilderSampleAppsClean")
               if (!t.name.startsWith("arm")) {
                 ant.project.executeTarget("scenebuilderAppClean")
               }
+              delete(ensembleLibDir);
             }
         }
         rootProject.clean.dependsOn(appsClean)
     }
 }
< prev index next >