{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "# How to build the Jupyter PowerShell Kernel\n", "\n", "Start in the Jupyter-PowerShell folder, and make sure there's no output from the last run" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "$ProjectDirectory = $Pwd.Path\n", "if($ProjectDirectory -match \"Jupyter-PowerShell$\") {\n", " @\"\n", "# How to build the Jupyter PowerShell Kernel\n", "\n", "Start in the Jupyter-PowerShell folder, and make sure there's no output from the last run\n", "\"@ | Write-Jupyter -Mimetype markdown\n", "} else {\n", " \"# This notebook only works in the Jupyter-PowerShell project folder\" | \n", " Write-Jupyter -Mimetype markdown\n", " Write-Error \"You cannot build Jupyter from here\"\n", " $ProjectDirectory = $Env:Temp\n", "}" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "rm (Join-Path $ProjectDirectory Output\\Release) -recurse" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## To build the project\n", "\n", "We really just need to `dotnet restore` and `dotnet build` --although currently, we require a very specific version (2.0.0-preview2-006502) of the dotnet CLI tools because we depend on the latest PowerShell Core bits, and they're _utterly_ incompatible with anything else.\n", "\n", "### Increment the version\n", "\n", "The project files to use the new `--version-suffix` feature. To make sure your build isn't confused with an official one, you need to specify a suffix, like \"-local-preview\".\n", "\n", "## To package the project\n", "\n", "In order to ship something, we need to `publish` it -- this includes the `build` step, so we can just call it directly.\n", "\n", "Once we've published, we need to package it with Chocolatey." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Restoring packages for C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Jupyter\\Jupyter.csproj...\r\n", " Restoring packages for C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\PowerShell-Kernel\\PowerShell-Kernel.csproj...\r\n", " Restore completed in 715.68 ms for C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Jupyter\\Jupyter.csproj.\r\n", " Restore completed in 1.26 sec for C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\PowerShell-Kernel\\PowerShell-Kernel.csproj." ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dotnet restore" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Microsoft (R) Build Engine version 15.3.388.41745 for .NET Core\r\n", "Copyright (C) Microsoft Corporation. All rights reserved.\r\n", "\r\n", " Jupyter -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\netcoreapp2.0\\Jupyter.dll\r\n", " Jupyter -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\netcoreapp2.0\\publish\\\r\n", " PowerShell-Kernel -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\netcoreapp2.0\\PowerShell-Kernel.dll\r\n", " PowerShell-Kernel -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\netcoreapp2.0\\publish\\" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dotnet publish -f netcoreapp2.0 -c Release --version-suffix \"-beta-5\"" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Microsoft (R) Build Engine version 15.3.388.41745 for .NET Core\r\n", "Copyright (C) Microsoft Corporation. All rights reserved.\r\n", "\r\n", " Jupyter -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\net462\\Jupyter.dll\r\n", " Jupyter -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\net462\\publish\\\r\n", " PowerShell-Kernel -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\net462\\PowerShell-Kernel.exe\r\n", " PowerShell-Kernel -> C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\net462\\publish\\" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dotnet publish -f net462 -c Release --version-suffix \"-beta-5\"" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# We're just trying to rename the folders so that we can hash them:\n", "Move-Item Output\\Release\\net462\\publish Output\\Release\\PowerShell-Full\n", "Move-Item Output\\Release\\netcoreapp2.0\\publish Output\\Release\\PowerShell-Core\n", "Copy-Item tools Output\\Release -Recurse\n", "Remove-Item Output\\Release\\net462 -Recurse\n", "Remove-Item Output\\Release\\netcoreapp2.0 -Recurse" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Mode LastWriteTime Length Name \r\n", "---- ------------- ------ ---- \r\n", "-a---- 7/17/2017 12:53 AM 103522 Jupyter-PowerShell.cat" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Now generate the file catalog\n", "New-FileCatalog -CatalogFilePath Output\\Release\\tools\\Jupyter-PowerShell.cat -Path Output\\Release\\" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Directory: C:\\Users\\Joel\\Projects\\Jupyter\\Jupyter-PowerShell\\Output\\Release\\tools\r\n", "\r\n", "\r\n", "SignerCertificate Status Path \r\n", "----------------- ------ ---- \r\n", "DC8A5C5FAFFBCFFE7F60552B49ED1A0DDC145482 Valid Jupyter-PowerShell.cat" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Maybe sign the catalog\n", "if(Get-Module Authenticode -List) {\n", " Authenticode\\Set-AuthenticodeSignature Output\\Release\\tools\\Jupyter-PowerShell.cat\n", "}" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Chocolatey v0.10.7\r\n", "Attempting to build package from 'jupyter-powershell.nuspec'.\r\n", "Successfully created package 'Output\\Release\\jupyter-powershell.1.0.0-beta-5.nupkg'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "C:\\ProgramData\\chocolatey\\choco.exe pack --outputdirectory Output\\Release" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "PowerShell (Full)", "language": "PowerShell", "name": "powershell-full" }, "language_info": { "codemirror_mode": "powershell", "file_extension": ".ps1", "mimetype": "text/powershell", "name": "PowerShell", "nbconvert_exporter": null, "pygments_lexer": "powershell", "version": "5.0" } }, "nbformat": 4, "nbformat_minor": 1 }