Skip to content
Permalink
Browse files

Set up correct project name and package. Fixed kernel banner to be mo…

…re helpful in displaying kernel info
  • Loading branch information...
SpencerPark committed Oct 7, 2017
1 parent f8916a1 commit fe4520a1d4b73f265d937b8c912256804f01f3cd
@@ -26,6 +26,7 @@ task wrapper(type: Wrapper) {

license {
header = file('LICENSE')
exclude '**/*.json'
mapping {
// Use a regular multiline comment rather than a javadoc comment
java = 'SLASHSTAR_STYLE'
@@ -50,7 +51,7 @@ repositories {
}

dependencies {
shade group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '1.0.5-SNAPSHOT'
shade group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '1.0.6-SNAPSHOT'

testCompile group: 'junit', name: 'junit', version: '4.12'
}
@@ -61,7 +62,7 @@ jar {
.collect {it.isDirectory() ? it : zipTree(it)}

manifest {
attributes('Main-class': 'io.github.spencerpark.IJava')
attributes('Main-class': 'io.github.spencerpark.ijava.IJava')
}
}

@@ -1 +1 @@
rootProject.name = 'jupyter-java-kernel'
rootProject.name = 'ijava'
@@ -21,18 +21,41 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.spencerpark;
package io.github.spencerpark.ijava;

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import io.github.spencerpark.jupyter.channels.JupyterConnection;
import io.github.spencerpark.jupyter.channels.JupyterSocket;
import io.github.spencerpark.jupyter.kernel.KernelConnectionProperties;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;

public class IJava {
public static final String VERSION;

static {
InputStream metaStream = IJava.class.getClassLoader().getResourceAsStream("kernel-metadata.json");
Reader metaReader = new InputStreamReader(metaStream);
try {
JsonElement meta = new JsonParser().parse(metaReader);
VERSION = meta.getAsJsonObject().get("version").getAsString();
} finally {
try {
metaReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

public static void main(String[] args) throws Exception {
if (args.length < 1)
throw new IllegalArgumentException("Missing connection file argument");
@@ -21,12 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.spencerpark;
package io.github.spencerpark.ijava;

import io.github.spencerpark.jupyter.kernel.BaseKernel;
import io.github.spencerpark.jupyter.kernel.LanguageInfo;
import io.github.spencerpark.jupyter.kernel.ReplacementOptions;
import io.github.spencerpark.jupyter.kernel.util.CharPredicate;
import io.github.spencerpark.jupyter.messages.Header;
import io.github.spencerpark.jupyter.messages.MIMEBundle;
import jdk.jshell.*;

@@ -67,9 +68,16 @@ public JavaKernel() {
.pygments("java")
.codemirror("java")
.build();
this.banner = String.format("Java %s", Runtime.version());
this.banner = String.format("Java %s :: IJava kernel %s \nProtocol v%s implementation by %s %s",
Runtime.version().toString(),
IJava.VERSION,
Header.PROTOCOL_VERISON,
KERNEL_META.getOrDefault("project", "UNKNOWN"),
KERNEL_META.getOrDefault("version", "UNKNOWN")
);
this.helpLinks = List.of(
new LanguageInfo.Help("Java", "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html")
new LanguageInfo.Help("Java tutorial", "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html"),
new LanguageInfo.Help("IJava homepage", "https://github.com/SpencerPark/IJava")
);
}

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.spencerpark;
package io.github.spencerpark.ijava;

import java.io.IOException;
import java.io.OutputStream;
@@ -0,0 +1,4 @@
{
"version": "@version@",
"project": "@project@"
}

0 comments on commit fe4520a

Please sign in to comment.
You can’t perform that action at this time.