Request some gradle help

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Request some gradle help

Julien Gribonvald
Hi everybody

I'm looking for some help on gradle:

Inside this part :
https://github.com/Jasig/uPortal-start/blob/master/overlays/uPortal/build.gradle#L111..L155
I would like to apply the skin aggregation like it's done here:
https://github.com/Jasig/uPortal/blob/master/uPortal-webapp/build.gradle#L119..L150

Sorry I'm really new to gradle and I don't understand how the successing
steps in generation are done... Who can provide some help ?

It's to enable static skins feature on custom skins.


Thanks.

--
Julien Gribonvald

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Request some gradle help

Julien Gribonvald
To continue the change (maybe working) are in the following lines, but
I'm getting this error :

Caused by: java.lang.NoSuchMethodError:
org.apache.commons.io.FileUtils.deleteQuietly(Ljava/io/File;)Z
         at
org.jasig.resource.aggr.ResourcesAggregatorImpl.aggregateList(ResourcesAggregatorImpl.java:416)
         at
org.jasig.resource.aggr.ResourcesAggregatorImpl$JsCallback.aggregate(ResourcesAggregatorImpl.java:574)
         at
org.jasig.resource.aggr.ResourcesAggregatorImpl$JsCallback.aggregate(ResourcesAggregatorImpl.java:533)
         at
org.jasig.resource.aggr.ResourcesAggregatorImpl.aggregateBasicIncludes(ResourcesAggregatorImpl.java:293)
         at
org.jasig.resource.aggr.ResourcesAggregatorImpl.aggregate(ResourcesAggregatorImpl.java:230)
         at
org.jasig.resource.aggr.ResourcesAggregator$aggregate.call(Unknown Source)

Is there someone who understand the problem ?


Gradles change into uPortal-start :

diff --git a/overlays/build.gradle b/overlays/build.gradle
index 3e2c6bcaf..3958c4cb5 100644
--- a/overlays/build.gradle
+++ b/overlays/build.gradle
@@ -4,6 +4,7 @@ buildscript {
      }
      dependencies {
          classpath
"org.scaldingspoon.gradle:gradle-waroverlay-plugin:${waroverlayPluginVersion}"
+        classpath
"org.jasig.resourceserver:resource-server-core:${resourceServerVersion}"
      }
  }

diff --git a/overlays/uPortal/build.gradle b/overlays/uPortal/build.gradle
index 1c537f02c..3b5259167 100644
--- a/overlays/uPortal/build.gradle
+++ b/overlays/uPortal/build.gradle
@@ -1,3 +1,5 @@
+import java.util.regex.Pattern
+
  import org.apereo.portal.start.gradle.plugins.GradleImportExportPlugin
  import org.apereo.portal.start.gradle.plugins.GradlePlutoPlugin

@@ -60,7 +62,12 @@ war {
  /*
   * Skinning Support
   */
-import java.util.regex.Pattern
+
+import org.apereo.portal.start.shell.PortalShellInvoker
+import org.jasig.resource.aggr.AggregationRequest
+import org.jasig.resource.aggr.ResourcesAggregator
+import org.jasig.resource.aggr.ResourcesAggregatorImpl
+
  File skinsDir = new File
("${projectDir}/src/main/webapp/media/skins/respondr")
  task skinGenerate() {
      group 'Skin'
@@ -168,17 +175,58 @@ else {
          }
      }

-    war.dependsOn {
-        tasks.findAll { task -> task.name.startsWith('compileLess') }
+    task aggregateRespondrSkins(dependsOn: tasks.findAll { task ->
task.name.startsWith('compileLess') }) {
+
+        String workDir = "${buildDir}/tmp/skin/uPortal"
+        logger.lifecycle " =====>   test ${workDir}"
+        doLast {
+            final ResourcesAggregator aggr = new ResourcesAggregatorImpl();
+            aggr.setDisplayJsWarnings(false);
+
+            File  currentDir = new File(workDir)
+            final String expectedFilePattern = /.*skin\.xml/
+            def skins = []
+
+            currentDir.eachFileRecurse(groovy.io.FileType.FILES) {
+                if (it.name ==~ expectedFilePattern && it.name !=
"common_skin.xml") {
+                    skins << it
+                }
+            }
+
+            logger.lifecycle "skins  ${currentDir} ${skins} "
+
+            skins.each {
+                logger.lifecycle "aggregating  ${it.absolutePath} "
+                String skinDir = it.absolutePath.substring(0,
it.absolutePath.lastIndexOf(File.separator) + 1)
+                logger.debug(" skinDir  -> ${skinDir}")
+
+                final File resourcesXmlFile = new File(it.absolutePath);
+                final File fullOutputDirectory = new File(skinDir);
+                final File sharedJavaScriptDirectory = new
File(workDir, '/media/skins/respondr');
+
+                // Provide the paths we evaluated in DEBUG logging
+ logger.lifecycle("resourcesXmlFile=${resourcesXmlFile}");
+ logger.lifecycle("fullOutputDirectory=${fullOutputDirectory}");
+
logger.lifecycle("sharedJavaScriptDirectory=${sharedJavaScriptDirectory}");
+
+                final AggregationRequest aggregationRequest = new
AggregationRequest();
+                aggregationRequest
+                        .setResourcesXml(resourcesXmlFile)
+ .setOutputBaseDirectory(fullOutputDirectory)
+ .addAdditionalSourceDirectory(fullOutputDirectory)
+ .setSharedJavaScriptDirectory(sharedJavaScriptDirectory);
+                aggr.aggregate(aggregationRequest);
+            }
+
+        }
      }
+
+    war.dependsOn(aggregateRespondrSkins)
  }

  /*
   * Import/Export Support
   */
-
-import org.apereo.portal.start.shell.PortalShellInvoker
-
  ext {
      shellDir = new File("${buildDir}/shell")
  }


Le 10/12/2018 à 17:58, Julien Gribonvald a écrit :

> Hi everybody
>
> I'm looking for some help on gradle:
>
> Inside this part :
> https://github.com/Jasig/uPortal-start/blob/master/overlays/uPortal/build.gradle#L111..L155
> I would like to apply the skin aggregation like it's done here:
> https://github.com/Jasig/uPortal/blob/master/uPortal-webapp/build.gradle#L119..L150
>
> Sorry I'm really new to gradle and I don't understand how the
> successing steps in generation are done... Who can provide some help ?
>
> It's to enable static skins feature on custom skins.
>
>
> Thanks.
>
--
Julien Gribonvald

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.