mirror of
https://github.com/SpencerPark/IJava.git
synced 2025-04-14 10:26:08 +00:00
Set up correct project name and package. Fixed kernel banner to be more helpful in displaying kernel info
This commit is contained in:
parent
f8916a172f
commit
fe4520a1d4
@ -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 class JavaKernel extends BaseKernel {
|
||||
.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;
|
4
src/main/resources/kernel-metadata.json
Normal file
4
src/main/resources/kernel-metadata.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": "@version@",
|
||||
"project": "@project@"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user