about summary refs log tree commit diff
path: root/third_party/apereo-cas
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/apereo-cas')
-rw-r--r--third_party/apereo-cas/default.nix63
-rw-r--r--third_party/apereo-cas/overlay/build.gradle84
-rw-r--r--third_party/apereo-cas/overlay/gradle/tasks.gradle17
3 files changed, 121 insertions, 43 deletions
diff --git a/third_party/apereo-cas/default.nix b/third_party/apereo-cas/default.nix
new file mode 100644
index 000000000000..5f628ce8e709
--- /dev/null
+++ b/third_party/apereo-cas/default.nix
@@ -0,0 +1,63 @@
+{ pkgs, ... }:
+
+let
+  name = "apereo-cas-${version}";
+  version = "6.2.0";
+  overlay = ./overlay;
+
+  jdk = pkgs.jdk11;
+  gradle = pkgs.gradle_6;
+
+  meta = with pkgs.stdenvNoCC.lib; {
+    homepage = "https://www.apereo.org/projects/cas";
+    description = "CAS provides enterprise single sign-on for the Web";
+    platforms = platforms.linux;
+    licenses = licenses.asl20;
+  };
+
+  deps = pkgs.stdenvNoCC.mkDerivation {
+    inherit meta;
+
+    name = "${name}-deps";
+    src = overlay;
+    nativeBuildInputs = with pkgs; [ gradle perl ];
+
+    buildPhase = ''
+      export GRADLE_USER_HOME="$(mktemp -d)"
+      gradle --no-daemon build -x test downloadShell
+    '';
+
+    # perl code mavenizes paths (see pkgs/servers/ma1sd from nixpkgs)
+    installPhase = ''
+      find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\([wj]ar\|pom\)' \
+        | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# $src = $1; ($x = $2) =~ tr|\.|/|; $dir1 = $3; $dir2 = $4; ($y = $5) =~ s|-jvm||n; "install -Dm444 $src \$out/$x/$dir1/$dir2/$y" #e' \
+        | sh
+      install -m444 build/libs/cas-server-support-shell-* $out/cas-server-shell.jar
+    '';
+
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "0lggx83g0nl5xwxgadgjrz62ch5qkwcyxwrd1zq8y1r7fir3m8pq";
+  };
+in
+pkgs.stdenvNoCC.mkDerivation {
+  inherit name version meta;
+
+  src = overlay;
+  nativeBuildInputs = with pkgs; [ gradle makeWrapper ];
+  buildInputs = with pkgs; [ jdk ];
+
+  buildPhase = ''
+    export GRADLE_USER_HOME="$(mktemp -d)"
+
+    gradle -PcacheLocation="${deps}" --offline --no-daemon build -x test
+  '';
+
+  installPhase = ''
+    install -D build/libs/cas.war $out/lib/cas.war
+    cp ${deps}/cas-server-shell.jar $out/lib/cas-server-shell.jar
+    cp -R etc $out/etc
+    makeWrapper ${jdk}/bin/java $out/bin/cas --add-flags "-Dcas.standalone.configurationDirectory=$out/etc/cas/config -jar $out/lib/cas.war"
+    makeWrapper ${jdk}/bin/java $out/bin/cas-shell --add-flags "-Dcas.standalone.configurationDirectory=$out/etc/cas/config -jar $out/lib/cas-server-shell.jar"
+  '';
+}
diff --git a/third_party/apereo-cas/overlay/build.gradle b/third_party/apereo-cas/overlay/build.gradle
index 79a7e7c1be59..2b04bbc5f0cc 100644
--- a/third_party/apereo-cas/overlay/build.gradle
+++ b/third_party/apereo-cas/overlay/build.gradle
@@ -1,20 +1,25 @@
 buildscript {
     repositories {
-        mavenLocal()
-        gradlePluginPortal()
-        mavenCentral()
-        jcenter()
-        maven { 
-            url "https://repo.spring.io/libs-milestone" 
-            mavenContent { releasesOnly() }
-        }
-        maven { 
-            url "https://repo.spring.io/libs-snapshot" 
-            mavenContent { snapshotsOnly() }
-        }
-        maven { 
-            url "https://plugins.gradle.org/m2/" 
-            mavenContent { releasesOnly() }
+        if (rootProject.hasProperty("cacheLocation")) {
+            mavenLocal()
+            maven { url cacheLocation }
+        } else {
+            mavenLocal()
+            gradlePluginPortal()
+            mavenCentral()
+            jcenter()
+            maven {
+                url "https://repo.spring.io/libs-milestone"
+                mavenContent { releasesOnly() }
+            }
+            maven {
+                url "https://repo.spring.io/libs-snapshot"
+                mavenContent { snapshotsOnly() }
+            }
+            maven {
+                url "https://plugins.gradle.org/m2/"
+                mavenContent { releasesOnly() }
+            }
         }
     }
     dependencies {
@@ -27,28 +32,33 @@ buildscript {
 }
 
 repositories {
-    mavenLocal()
-    mavenCentral()
-    jcenter()
-    maven { 
-        url "https://oss.sonatype.org/content/repositories/snapshots" 
-        mavenContent { snapshotsOnly() }
-    }
-    maven { 
-        mavenContent { releasesOnly() }
-        url "https://build.shibboleth.net/nexus/content/repositories/releases/" 
-    }
-    maven { 
-        mavenContent { releasesOnly() }
-        url "https://repo.spring.io/milestone/" 
-    }
-    maven { 
-        url "https://repo.spring.io/snapshot/" 
-        mavenContent { snapshotsOnly() }
-    }
-    maven { 
-        mavenContent { snapshotsOnly() }
-        url "https://oss.jfrog.org/artifactory/oss-snapshot-local" 
+    if (rootProject.hasProperty("cacheLocation")) {
+        mavenLocal()
+        maven { url cacheLocation }
+    } else {
+        mavenLocal()
+        mavenCentral()
+        jcenter()
+        maven {
+            url "https://oss.sonatype.org/content/repositories/snapshots"
+            mavenContent { snapshotsOnly() }
+        }
+        maven {
+            mavenContent { releasesOnly() }
+            url "https://build.shibboleth.net/nexus/content/repositories/releases/"
+        }
+        maven {
+            mavenContent { releasesOnly() }
+            url "https://repo.spring.io/milestone/"
+        }
+        maven {
+            url "https://repo.spring.io/snapshot/"
+            mavenContent { snapshotsOnly() }
+        }
+        maven {
+            mavenContent { snapshotsOnly() }
+            url "https://oss.jfrog.org/artifactory/oss-snapshot-local"
+        }
     }
 }
 
diff --git a/third_party/apereo-cas/overlay/gradle/tasks.gradle b/third_party/apereo-cas/overlay/gradle/tasks.gradle
index 40fdac0b157c..297555b1e44d 100644
--- a/third_party/apereo-cas/overlay/gradle/tasks.gradle
+++ b/third_party/apereo-cas/overlay/gradle/tasks.gradle
@@ -10,12 +10,17 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
 
 buildscript {
     repositories {
-        mavenLocal()
-        mavenCentral()
-        jcenter()
-        maven {
-            url "https://oss.sonatype.org/content/repositories/snapshots"
-            mavenContent { snapshotsOnly() }
+        if (rootProject.hasProperty("cacheLocation")) {
+            mavenLocal()
+            maven { url cacheLocation }
+        } else {
+            mavenLocal()
+            mavenCentral()
+            jcenter()
+            maven {
+                url "https://oss.sonatype.org/content/repositories/snapshots"
+                mavenContent { snapshotsOnly() }
+            }
         }
     }