Skip to content

Commit

Permalink
Set up correct project name and package. Fixed kernel banner to be mo…
Browse files Browse the repository at this point in the history
…re helpful in displaying kernel info
  • Loading branch information
SpencerPark committed Oct 7, 2017
1 parent f8916a1 commit fe4520a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
}
Expand All @@ -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')
}
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'jupyter-java-kernel'
rootProject.name = 'ijava'
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand Down Expand Up @@ -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")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/kernel-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "@version@",
"project": "@project@"
}

0 comments on commit fe4520a

Please sign in to comment.