From 3ca051131f27ea499fb68d9c28d968a1007ef08a Mon Sep 17 00:00:00 2001
From: SpencerPark <spinnr95@gmail.com>
Date: Sun, 29 Jul 2018 19:27:10 -0400
Subject: [PATCH] Include dependency report in the zip as well as the new
 kernel configuration parameters

---
 build.gradle                                  | 54 ++++++++++++++++---
 .../NewInventoryHtmlReportRenderer.groovy     |  6 ---
 2 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/build.gradle b/build.gradle
index 868c244..6e49504 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ plugins {
     id 'java'
     id 'maven-publish'
     id('com.github.hierynomus.license') version '0.14.0'
-    id('io.github.spencerpark.jupyter-kernel-installer') version '1.1.5'
+    id('io.github.spencerpark.jupyter-kernel-installer') version '1.1.8'
     id('com.github.jk1.dependency-license-report')
 }
 
@@ -35,8 +35,6 @@ licenseReport {
     renderers = [
             // Generate a pretty HTML report that groups dependencies by their license.
             new NewInventoryHtmlReportRenderer('dependencies.html'),
-            new InventoryHtmlReportRenderer('deps.html'),
-            new TextReportRenderer('dependencies.txt'),
             // TODO make sure ci verifies that all licenses are know to be allowed to redistribute before publishing
             new JsonReportRenderer('dependencies.json')
     ]
@@ -44,9 +42,7 @@ licenseReport {
     // Group same licenses despite names being slightly different (ex. Apache 2.0 vs Apache version 2)
     filters = [new LicenseBundleNormalizer()]
 
-    // Include the report for shaded dependencies as these are what will be redistributed
-    // and therefore must go in the report which will also be distributed.
-    configurations = ['shade']
+    configurations = ['compile']
 }
 
 compileJava {
@@ -80,7 +76,7 @@ dependencies {
 jar {
     //Include all shaded dependencies in the jar
     from configurations.shade
-            .collect {it.isDirectory() ? it : zipTree(it)}
+            .collect { it.isDirectory() ? it : zipTree(it) }
 
     manifest {
         attributes('Main-class': 'io.github.spencerpark.ijava.IJava')
@@ -109,4 +105,46 @@ jupyter {
     kernelDisplayName = 'Java'
     kernelLanguage = 'java'
     kernelInterruptMode = 'message'
-}
\ No newline at end of file
+
+    kernelParameters {
+        list('classpath', 'IJAVA_CLASSPATH') {
+            defaultValue = ''
+            separator = PATH_SEPARATOR
+            description = '''A file path separator delimited list of classpath entries that should be available to the user code. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.'''
+        }
+
+        list('comp-opts', 'IJAVA_COMPILER_OPTS') {
+            defaultValue = ''
+            separator = ' '
+            description = '''A space delimited list of command line options that would be passed to the `javac` command when compiling a project. For example `-parameters` to enable retaining parameter names for reflection.'''
+        }
+
+        list('startup-scripts-path', 'IJAVA_STARTUP_SCRIPTS_PATH') {
+            defaultValue = ''
+            separator = PATH_SEPARATOR
+            description = '''A file path seperator delimited list of `.jshell` scripts to run on startup. This includes ijava-jshell-init.jshell and ijava-display-init.jshell. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.'''
+        }
+
+        string('startup-script', 'IJAVA_STARTUP_SCRIPT') {
+            defaultValue = ''
+            description = '''A block of java code to run when the kernel starts up. This may be something like `import my.utils;` to setup some default imports or even `void sleep(long time) { try {Thread.sleep(time); } catch (InterruptedException e) { throw new RuntimeException(e); }}` to declare a default utility method to use in the notebook.'''
+        }
+
+        string('timeout', 'IJAVA_TIMEOUT') {
+            aliases NO_TIMEOUT: '-1'
+            defaultValue = '-1'
+            description = '''A duration specifying a timeout (in milliseconds by default) for a _single top level statement_. If less than `1` then there is no timeout. If desired a time may be specified with a `TimeUnit` may be given following the duration number (ex `"30 SECONDS"`).'''
+        }
+    }
+}
+
+zipKernel {
+    installers {
+        with 'python'
+    }
+
+    from(generateLicenseReport.outputFolder) {
+        into 'dependency-licenses'
+    }
+}
+zipKernel.dependsOn 'generateLicenseReport'
\ No newline at end of file
diff --git a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy b/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy
index a4dfbee..5182943 100644
--- a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy
+++ b/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy
@@ -35,12 +35,6 @@ class NewInventoryHtmlReportRenderer implements ReportRenderer {
 
     @Override
     void render(ProjectData data) {
-        println(
-                data.project.configurations['shade']
-                        .resolvedConfiguration
-                        .resolvedArtifacts
-                .findAll {it.id.displayName.contains("github")}
-        )
         this.counter = 0
 
         def project = data.project