diff --git a/.gitignore b/.gitignore index 897f432..b2339c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -.gradle/ .idea/ -build/ -out/ \ No newline at end of file +target/ +.classpath +.project +.settings +*.iml diff --git a/buildSrc/src/main/resources/install.py b/assembly/zip/install.py similarity index 100% rename from buildSrc/src/main/resources/install.py rename to assembly/zip/install.py diff --git a/buildSrc/src/main/resources/kernel.json b/assembly/zip/kernel.json similarity index 80% rename from buildSrc/src/main/resources/kernel.json rename to assembly/zip/kernel.json index 14b11df..c3de95c 100644 --- a/buildSrc/src/main/resources/kernel.json +++ b/assembly/zip/kernel.json @@ -4,7 +4,7 @@ "--add-opens", "jdk.jshell/jdk.jshell=ALL-UNNAMED", "-jar", - "@KERNEL_INSTALL_DIRECTORY@/@JAR_FILE@", + "@KERNEL_INSTALL_DIRECTORY@/${project.build.finalName}.jar", "{connection_file}" ], "display_name": "Java", diff --git a/assembly/zip/zip.xml b/assembly/zip/zip.xml new file mode 100644 index 0000000..460bca6 --- /dev/null +++ b/assembly/zip/zip.xml @@ -0,0 +1,24 @@ + + zip + + zip + + false + + + ${project.build.directory}/${project.build.finalName}.jar + java + + + assembly/zip/kernel.json + java + true + + + assembly/zip/install.py + / + + + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 7d43a13..0000000 --- a/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id 'java' - id 'maven-publish' - id('com.github.hierynomus.license') version '0.16.1' - id('com.github.jk1.dependency-license-report') -} - -import org.apache.tools.ant.filters.ReplaceTokens -import com.github.jk1.license.render.* -import com.github.jk1.license.filter.* -import io.github.spencerpark.gradle.* - -group = 'io.github.spencerpark' -version = '1.0-M2' - -wrapper { - gradleVersion = '8.5' - distributionType = Wrapper.DistributionType.ALL -} - -// Add the license header to source files -license { - header = file('LICENSE') - exclude '**/*.json' - mapping { - // Use a regular multiline comment rather than a javadoc comment - java = 'SLASHSTAR_STYLE' - } -} -build.dependsOn 'licenseFormat' - -// Configures the license report generated for the dependencies. -licenseReport { - excludeGroups = [] - renderers = [ - // Generate a pretty HTML report that groups dependencies by their license. - new NewInventoryHtmlReportRenderer('dependencies.html'), - // TODO make sure ci verifies that all licenses are know to be allowed to redistribute before publishing - new JsonReportRenderer('dependencies.json') - ] - - // Group same licenses despite names being slightly different (ex. Apache 2.0 vs Apache version 2) - filters = [new LicenseBundleNormalizer()] - - configurations = ['compile'] -} - -compileJava { - sourceCompatibility = 11 - targetCompatibility = 11 -} - -configurations { - shade - // transitive true to make sure that the dependencies of shade dependencies also get shaded into the jar - shade.transitive = true - implementation.extendsFrom(shade) -} - -repositories { - mavenCentral() - maven { - url = 'https://oss.sonatype.org/content/repositories/snapshots/' - } - mavenLocal() -} - -dependencies { - shade group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '2.3.0' - - shade group: 'org.apache.ivy', name: 'ivy', version: '2.5.2' - //shade group: 'org.apache.maven', name: 'maven-settings-builder', version: '3.6.0' - shade group: 'org.apache.maven', name: 'maven-model-builder', version: '3.6.0' - - testImplementation group: 'junit', name: 'junit', version: '4.13.1' -} - -jar { - //Include all shaded dependencies in the jar - from configurations.shade - .collect { it.isDirectory() ? it : zipTree(it) } - - manifest { - attributes('Main-class': 'io.github.spencerpark.ijava.IJava') - } - - duplicatesStrategy = 'include' -} - -processResources { - def tokens = [ - 'version': project.version, - 'project': project.name - ] - inputs.properties(tokens) - filter ReplaceTokens, tokens: tokens -} - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } -} - -tasks.register('zipKernel', Zip) { - group = 'distribution' - description = 'Zips jupyter kernel jar with its installation script.' - - into(".", { - // copy as is install script - from(file('buildSrc/src/main/resources/install.py')) - }) - - into("java", { - // copy jar - from(jar.archiveFile) - - // preprocess kernel.json - def kernelSpecTemplate = file('buildSrc/src/main/resources/kernel.json') - from(kernelSpecTemplate) { - include kernelSpecTemplate.name - filter { line -> line.replaceAll('@JAR_FILE@', "${project.name}-${project.version}.jar") } - } - }) -} - -zipKernel.dependsOn 'jar', 'generateLicenseReport' \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 2891fa9..0000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -plugins { - id 'groovy' -} - -repositories { - maven { - url = 'https://plugins.gradle.org/m2/' - } -} - -dependencies { - implementation group: 'com.github.jk1.dependency-license-report', name: 'com.github.jk1.dependency-license-report.gradle.plugin', version: '1.1' -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/DeclaredModuleInfo.groovy b/buildSrc/src/main/groovy/io/github/spencerpark/gradle/DeclaredModuleInfo.groovy deleted file mode 100644 index 4216c1a..0000000 --- a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/DeclaredModuleInfo.groovy +++ /dev/null @@ -1,7 +0,0 @@ -package io.github.spencerpark.gradle - -class DeclaredModuleInfo { - String projectUrl - String license - String licenseUrl -} diff --git a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/InventoryReportRenderer.groovy b/buildSrc/src/main/groovy/io/github/spencerpark/gradle/InventoryReportRenderer.groovy deleted file mode 100644 index a15d2bb..0000000 --- a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/InventoryReportRenderer.groovy +++ /dev/null @@ -1,91 +0,0 @@ -package io.github.spencerpark.gradle - -import com.github.jk1.license.* -import groovy.json.JsonParserType -import groovy.json.JsonSlurper - -abstract class InventoryReportRenderer { - /** - * Collect declared from a JSON object with maven coordinates as keys and {@link DeclaredModuleInfo} - * as values - * @param declarations the stream to parse the json object from - * @return the collected declarations - */ - static Map parseDeclarations(InputStream declarations) { - def rawDeclarations = new JsonSlurper() - .setType(JsonParserType.LAX) - .parse(declarations) - - assert rawDeclarations instanceof Map: "Declaration spec must be a json object" - - return rawDeclarations.collectEntries([:]) { coords, spec -> - assert spec instanceof Map: "Declaration spec for $coords is not an object" - - DeclaredModuleInfo info = new DeclaredModuleInfo() - spec.forEach { String key, val -> - assert val instanceof String: "Declaration spec for $coords::$key must be a string" - assert info.hasProperty(key), "Declaration spec for $coords has unknown key $key" - - info[key] = val - } - assert info.projectUrl: "Declaration missing required key: projectUrl" - assert info.license: "Declaration missing required key: license" - assert info.licenseUrl: "Declaration missing required key: licenseUrl" - - return [(coords): info] - } - } - - static Map> collectModulesByLicenseName(ProjectData data, Map declared) { - Map> modulesByLicense = [:] - - def addModule = { String licenseName, ModuleData module -> - String coords = module.with { "$group:$name:$version" } - - if (licenseName == "Unknown" && declared.containsKey(coords)) - licenseName = declared[coords].license - - modulesByLicense.compute(licenseName) { k, modules -> - return (modules ?: []) << module - } - } - - data.allDependencies.each { module -> - if (module.poms.isEmpty()) { - addModule(module.licenseFiles.isEmpty() ? "Unknown" : "Embedded", module) - return - } - - PomData pom = module.poms.first() - if (pom.licenses.isEmpty()) { - addModule(module.licenseFiles.isEmpty() ? "Unknown" : "Embedded", module) - } else { - pom.licenses.each { License license -> - addModule(license.name, module) - } - } - } - - return modulesByLicense - } - - // imported modules are things declared as dependencies but not actually included via gradle means. For - // example a javascript dependency. - static Map>> collectModulesByLicenseFromImported(ProjectData data) { - Map>> externalByModulesByLicense = [:] - - data.importedModules.each { ImportedModuleBundle module -> - Map> modulesByLicense = [:] - - module.modules.each { ImportedModuleData moduleData -> - modulesByLicense.compute(moduleData.license) { k, modules -> - return (modules ?: []) << moduleData - } - } - - externalByModulesByLicense[module.name] = modulesByLicense - } - - return externalByModulesByLicense - } -} diff --git a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy b/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy deleted file mode 100644 index 5182943..0000000 --- a/buildSrc/src/main/groovy/io/github/spencerpark/gradle/NewInventoryHtmlReportRenderer.groovy +++ /dev/null @@ -1,267 +0,0 @@ -package io.github.spencerpark.gradle - -import com.github.jk1.license.* -import com.github.jk1.license.render.ReportRenderer -import groovy.text.SimpleTemplateEngine -import groovy.text.StreamingTemplateEngine - -class NewInventoryHtmlReportRenderer implements ReportRenderer { - private final String name - private final String fileName - private final Map declared - private final Map colors = [ - accent : '#F37726', - primary : 'white', - accentBg : '#616262', - primaryBg: '#989798', - darkText : '#4E4E4E', - lightText: '#e8e5e5', - ] - - private Writer output - private int counter - - NewInventoryHtmlReportRenderer(String fileName = 'index.html', String name = null, File declarationsFileName = null, Map colors = [:]) { - this.name = name - this.fileName = fileName - - if (declarationsFileName) - declared = InventoryReportRenderer.parseDeclarations(declarationsFileName.newInputStream()) - else - declared = [:] - - this.colors.putAll(colors) - } - - @Override - void render(ProjectData data) { - this.counter = 0 - - def project = data.project - def name = project.name - LicenseReportExtension config = project.licenseReport - def outFile = new File(config.outputDir, fileName) - - def stylesheet = NewInventoryHtmlReportRenderer.class.getResourceAsStream("/license-report.template.css").withReader { - new SimpleTemplateEngine() - .createTemplate(it) - .make(this.colors) - .writeTo(new StringWriter()) - .toString() - } - def template = NewInventoryHtmlReportRenderer.class.getResourceAsStream("/license-report.template.html").withReader { - new StreamingTemplateEngine().createTemplate(it) - } - - def binding = [ - stylesheet : stylesheet, - name : name, - project : project, - inventory : InventoryReportRenderer.collectModulesByLicenseName(data, declared), - externalInventories : InventoryReportRenderer.collectModulesByLicenseFromImported(data), - serializeHref : { String... values -> - values.findAll { it != null }.collect { it.replaceAll(/\s/, '_') }.join('_') - }, - printDependency : this.&printDependency, - printImportedDependency: this.&printImportedDependency, - ] - - outFile.withWriter { - template.make(binding).writeTo(it) - } - } - - void tag(Map attrs = [:], String name, def children) { - output << "<$name ${attrs.collect { k, v -> "$k=\"$v\"" }.join(" ")}>\n" - if (children.respondsTo("call")) - children.call() - else - text(children) - output << "\n" - } - - void div(Map attrs = [:], def children) { - tag(attrs, "div", children) - } - - void p(Map attrs = [:], def children) { - tag(attrs, "p", children) - } - - void a(Map attrs = [:], def children) { - tag(attrs, "a", children) - } - - void strong(Map attrs = [:], def children) { - tag(attrs, "strong", children) - } - - void ul(Map attrs = [:], def children) { - tag(attrs, "ul", children) - } - - void li(Map attrs = [:], def children) { - tag(attrs, "li", children) - } - - void text(def contents) { - if (contents != null) - output << String.valueOf(contents) - } - - void renderDependencyProperty(String label, def children) { - div(class: "dependency-prop") { - tag("label") { text(label) } - div(class: "dependency-value", children) - } - } - - void renderDependencyTitle(ModuleData data) { - p(class: "title") { - strong(class: "index", "${++counter}.") - - if (data.group) { - strong("Group: ") - text(data.group) - } - - if (data.name) { - strong("Name: ") - text(data.name) - } - - if (data.version) { - strong("Version: ") - text(data.version) - } - } - } - - void renderDependencyTitle(ImportedModuleData data) { - p(class: "title") { - strong(class: "index", ++counter) - - if (data.name) { - strong("Name: ") - text(data.name) - } - - if (data.version) { - strong("Version: ") - text(data.version) - } - } - } - - void renderDependencyProjectUrl(ModuleData data) { - String coords = data.with { "$group:$name:$version" } - - ManifestData manifest = data.manifests.isEmpty() ? null : data.manifests.first() - PomData pomData = data.poms.isEmpty() ? null : data.poms.first() - - if (manifest?.url && pomData?.projectUrl && manifest.url == pomData.projectUrl) { - renderDependencyProperty("Project URL") { - a(href: manifest.url, { text(manifest.url) }) - } - } else if (manifest?.url || pomData?.projectUrl) { - if (manifest?.url) { - renderDependencyProperty("Manifest Project URL") { - a(href: manifest.url, { text(manifest.url) }) - } - } - - if (pomData?.projectUrl) { - renderDependencyProperty("POM Project URL") { - a(href: pomData.projectUrl, { text(pomData.projectUrl) }) - } - } - } else if (declared.containsKey(coords)) { - renderDependencyProperty("Project URL") { - a(href: declared[coords].projectUrl, { text(declared[coords].projectUrl) }) - } - } - } - - void renderReferencedLicenses(ModuleData data) { - String coords = data.with { "$group:$name:$version" } - - ManifestData manifest = data.manifests.isEmpty() ? null : data.manifests.first() - PomData pomData = data.poms.isEmpty() ? null : data.poms.first() - - if (manifest?.license || pomData?.licenses) { - if (manifest?.license) { - if (manifest.license.startsWith("http")) { - renderDependencyProperty("Manifest license URL") { - a(href: manifest.license, { text(manifest.license) }) - } - } else if (manifest.hasPackagedLicense) { - renderDependencyProperty("Packaged License File") { - a(href: manifest.license, { text(manifest.url) }) - } - } else { - renderDependencyProperty("Manifest License") { - text("${manifest.license} (Not Packaged)") - } - } - } - - if (pomData?.licenses) { - pomData.licenses.each { License license -> - if (license.url) { - renderDependencyProperty("POM License") { - text("${license.name} - ") - if (license.url.startsWith("http")) - a(href: license.url, { text(license.url) }) - else - text(license.url) - } - } else { - renderDependencyProperty("POM License", { text(license.name) }) - } - } - } - } else if (declared.containsKey(coords)) { - renderDependencyProperty("License URL") { - a(href: declared[coords].licenseUrl, { text(declared[coords].license) }) - } - } - } - - void renderIncludedLicenses(ModuleData data) { - if (!data.licenseFiles.isEmpty() && !data.licenseFiles.first().fileDetails.isEmpty()) { - renderDependencyProperty("Embedded license files") { - ul { - data.licenseFiles.first().fileDetails.each { - def file = it.file - li { - a(href: file, { text(file) }) - } - } - } - } - } - } - - private void printDependency(Writer out, ModuleData data) { - this.output = out - div(class: "dependency") { - renderDependencyTitle(data) - renderDependencyProjectUrl(data) - renderReferencedLicenses(data) - renderIncludedLicenses(data) - } - } - - private printImportedDependency(Writer out, ImportedModuleData data) { - this.output = out - div(class: "dependency") { - renderDependencyTitle(data) - renderDependencyProperty("Project URL") { - a(href: data.projectUrl, { text(data.projectUrl) }) - } - renderDependencyProperty("License URL") { - a(href: data.licenseUrl, { text(data.license) }) - } - } - } -} diff --git a/buildSrc/src/main/resources/license-report.template.css b/buildSrc/src/main/resources/license-report.template.css deleted file mode 100644 index d6bbcdb..0000000 --- a/buildSrc/src/main/resources/license-report.template.css +++ /dev/null @@ -1,151 +0,0 @@ -@media print { - .inventory { - display: none; - } - - .content { - position: static !important; - } -} - -html, body, section { - height: 100%; -} - -body { - font-family: sans-serif; - line-height: 125%; - margin: 0; - background: $primaryBg; -} - -.header { - /* #22aa44 */ - background: $accent; - color: $darkText; - padding: 2em 1em 1em 1em; -} - -.header h1 { - font-size: 16pt; - margin: 0.5em 0; -} - -.header h2 { - font-size: 10pt; - margin: 0; -} - -.container { -} - -.inventory { - background: $accentBg; - color: $lightText; - padding: 0; - position: fixed; - left: 0; - top: 0; - height: 100%; - width: 25%; - overflow: auto; -} - -.inventory ul { - margin: 0; - padding: 0; -} - -.inventory li { - list-style: none; - padding: 0; - margin: 0; -} - -.inventory li a { - width: 100%; - box-sizing: border-box; - color: $lightText; - text-decoration: none; - display: flex; - flex-direction: row; - padding: 0.938em 0.750em; -} - -.inventory li a:hover { - background: rgba(50, 50, 50, 0.5); - color: white; -} - -.inventory .section-heading { - background: rgba(50, 50, 50, 0.25); - padding-left: 0.5em; - margin: 0; - padding-top: 1em; - padding-bottom: 1em; -} - -.license .license-name { - flex-grow: 1; -} - -.license .badge { - background: $accent; - padding: 0.625em 0.938em; - border-radius: 1.250em; - color: $darkText; - display: inline-table; -} - -.content { - padding: 0 1rem; - position: absolute; - top: 0; - bottom: 0; - left: 25%; - width: 75%; - box-sizing: border-box; -} - -.content h1 { - color: $darkText; - background-color: $accent; - padding: 0.67em; - margin: 0 -1rem; -} - -.dependency { - background: white; - padding: 1em; - margin-bottom: 1em; -} - -.dependency:hover { - box-shadow: dimgrey 0.2em 0.2em 0.2em 0em; -} - -.dependency .index { - font-size: larger; - font-weight: lighter; -} - -.dependency-prop { - padding: 0.3em; -} - -.dependency-prop:hover { - background: rgba(50, 50, 50, 0.25); -} - -.dependency-prop label { - font-weight: bold; -} - -.dependency-value { - padding-left: 1em; -} - -.dependency-value ul { - margin-top: 0; - margin-bottom: 0; -} diff --git a/buildSrc/src/main/resources/license-report.template.html b/buildSrc/src/main/resources/license-report.template.html deleted file mode 100644 index 1a714d2..0000000 --- a/buildSrc/src/main/resources/license-report.template.html +++ /dev/null @@ -1,71 +0,0 @@ - - - Dependency License Report for $name - - - -
- - -
-
-

${project.name} ${!"unspecified".equals(project.version) ? project.version : ""}

-

Dependency License Report

-

- ${new Date().format("yyyy-MM-dd HH:mm:ss z")} -

-
- -

${name}

- - - <% externalInventories.each { name, modules -> %> -

${name}

- - <% } %> -
- - -
-

${name}

- <% inventory.keySet().sort().each { license -> %> - -

${license}

- <% inventory[license].sort({ a, b -> a.group <=> b.group }).each { data -> - printDependency.call(out, data) - } %> - <% } %> - - <% externalInventories.keySet().sort().each { String name -> %> -

${name}

- <% externalInventories[name].each { String license, dependencies -> %> - - <% dependencies.each { importedData -> - printImportedDependency.call(out, importedData) - } %> - <% } %> - <% } %> -
-
- - \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index ccebba7..0000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 829e1a5..0000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip -networkTimeout=10000 -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew deleted file mode 100755 index 79a61d4..0000000 --- a/gradlew +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index 93e3f59..0000000 --- a/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bdaac56 --- /dev/null +++ b/pom.xml @@ -0,0 +1,138 @@ + + 4.0.0 + + org.dflib + jjava + 1.0-M2 + Java Jupyter Kernel + + + UTF-8 + UTF-8 + 11 + + 2.3.0 + 2.5.2 + 3.6.0 + 5.10.1 + + + https://github.com/dflib/jjava + + + scm:git:https://github.com/dflib/jjava + scm:git:ssh://git@github.com/dflib/jjava + https://github.com/dflib/jjava + HEAD + + + + + io.github.spencerpark + jupyter-jvm-basekernel + ${jupyter.jvm.basekernel.version} + + + org.apache.ivy + ivy + ${ivy.version} + + + org.apache.maven + maven-model-builder + ${maven.model.builder.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit5.version} + test + + + + + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.2.5 + + + maven-failsafe-plugin + 3.2.5 + + + integration-test + + integration-test + verify + + + + + + maven-shade-plugin + 3.5.3 + + + package + + shade + + + + + + + * + + META-INF/*.MF + META-INF/DEPENDENCIES + + + + false + + + + false + + + + io.github.spencerpark.ijava.IJava + + + + + + + maven-resources-plugin + 3.3.1 + + + maven-assembly-plugin + 3.7.1 + + + assemble-zip + install + + single + + + + assembly/zip/zip.xml + + false + + + + + + + diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index d677ac0..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'jjava' \ No newline at end of file diff --git a/src/main/java/io/github/spencerpark/ijava/execution/IJavaLoaderDelegate.java b/src/main/java/io/github/spencerpark/ijava/execution/IJavaLoaderDelegate.java index 2d36dd6..4858e21 100644 --- a/src/main/java/io/github/spencerpark/ijava/execution/IJavaLoaderDelegate.java +++ b/src/main/java/io/github/spencerpark/ijava/execution/IJavaLoaderDelegate.java @@ -183,7 +183,8 @@ public Enumeration findResources(String name) throws IOException { private URL doFindResource(String name) { if (classFiles.containsKey(name)) { try { - return URL.of(new URI("jshell", null, "/" + name, null), + return new URL(null, + new URI("jshell", null, "/" + name, null).toString(), new RemoteClassLoader.ResourceURLStreamHandler(name)); } catch (MalformedURLException | URISyntaxException ex) { throw new InternalError(ex);