forked from SpencerPark/IJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
398 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,153 +1,96 @@ | ||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
id('com.github.hierynomus.license') version '0.14.0' | ||
id('io.github.spencerpark.jupyter-kernel-installer') version '2.1.0' | ||
id('com.github.jk1.dependency-license-report') | ||
} | ||
|
||
import com.github.jk1.license.filter.LicenseBundleNormalizer | ||
import com.github.jk1.license.render.InventoryHtmlReportRenderer | ||
import com.github.jk1.license.render.JsonReportRenderer | ||
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.3.0' | ||
|
||
wrapper { | ||
gradleVersion = '4.8.1' | ||
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 = 1.9 | ||
targetCompatibility = 1.9 | ||
plugins { | ||
id 'java' | ||
// id 'maven-publish' // use johnrengelman.shadow instead | ||
id 'com.github.hierynomus.license' version '0.16.1' | ||
id "com.github.jk1.dependency-license-report" version "2.1" | ||
id 'com.github.johnrengelman.shadow' version '7.1.2' | ||
// id 'io.github.spencerpark.jupyter-kernel-installer' version '2.1.0' | ||
} | ||
|
||
configurations { | ||
shade | ||
// transitive true to make sure that the dependencies of shade dependencies also get shaded | ||
// into the jar | ||
shade.transitive = true | ||
compile.extendsFrom(shade) | ||
} | ||
group = 'io.github.spencerpark' | ||
version = '1.3.1' | ||
|
||
repositories { | ||
mavenLocal() | ||
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.0-rc1' | ||
//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' | ||
implementation group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '2.3.0' | ||
implementation group: 'org.apache.ivy', name: 'ivy', version: '2.5.0' | ||
implementation group: 'org.apache.maven', name: 'maven-model-builder', version: '3.8.5' | ||
|
||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
testImplementation group: 'junit', name: 'junit', version: '4.13.2' | ||
} | ||
|
||
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') | ||
} | ||
// Add the license header to source files | ||
license { | ||
header = file('LICENSE') | ||
include "**/*.java" | ||
exclude "**/Test*.java" | ||
mapping java: 'SLASHSTAR_STYLE' | ||
ext.year = Calendar.getInstance().get(Calendar.YEAR) | ||
} | ||
licenseMain.dependsOn 'licenseFormat' | ||
|
||
// replace @symbol@ in properties | ||
processResources { | ||
def tokens = [ | ||
'version': project.version, | ||
'project': project.name | ||
] | ||
inputs.properties(tokens) | ||
filter ReplaceTokens, tokens: tokens | ||
filter tokens: tokens, ReplaceTokens | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
jar { | ||
manifest { | ||
attributes 'Main-class': 'io.github.spencerpark.ijava.IJava' | ||
} | ||
} | ||
|
||
jupyter { | ||
kernelName = 'java' | ||
kernelDisplayName = 'Java' | ||
kernelLanguage = 'java' | ||
kernelInterruptMode = 'message' | ||
// shadow Jar config | ||
shadowJar { | ||
// inherit from the manifest of the standard jar task | ||
// manifest { | ||
// attributes 'Main-class': 'io.github.spencerpark.ijava.IJava' | ||
// } | ||
|
||
kernelParameters { | ||
list('classpath', 'IJAVA_CLASSPATH') { | ||
separator = PATH_SEPARATOR | ||
description = '''A file path separator delimited list of classpath entries that should be available to the user code. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.''' | ||
} | ||
|
||
list('comp-opts', 'IJAVA_COMPILER_OPTS') { | ||
separator = ' ' | ||
description = '''A space delimited list of command line options that would be passed to the `javac` command when compiling a project. For example `-parameters` to enable retaining parameter names for reflection.''' | ||
} | ||
|
||
list('startup-scripts-path', 'IJAVA_STARTUP_SCRIPTS_PATH') { | ||
separator = PATH_SEPARATOR | ||
description = '''A file path seperator delimited list of `.jshell` scripts to run on startup. This includes ijava-jshell-init.jshell and ijava-display-init.jshell. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.''' | ||
} | ||
|
||
string('startup-script', 'IJAVA_STARTUP_SCRIPT') { | ||
description = '''A block of java code to run when the kernel starts up. This may be something like `import my.utils;` to setup some default imports or even `void sleep(long time) { try {Thread.sleep(time); } catch (InterruptedException e) { throw new RuntimeException(e); }}` to declare a default utility method to use in the notebook.''' | ||
} | ||
|
||
string('timeout', 'IJAVA_TIMEOUT') { | ||
aliases NO_TIMEOUT: '-1' | ||
description = '''A duration specifying a timeout (in milliseconds by default) for a _single top level statement_. If less than `1` then there is no timeout. If desired a time may be specified with a `TimeUnit` may be given following the duration number (ex `"30 SECONDS"`).''' | ||
} | ||
// copy build.gradle to shadowed jar | ||
from("./") { | ||
include 'build.gradle' | ||
} | ||
} | ||
|
||
installKernel { | ||
kernelInstallPath = commandLineSpecifiedPath(userInstallPath) | ||
} | ||
|
||
zipKernel { | ||
installers { | ||
with 'python' | ||
} | ||
// publish | ||
//publishing { | ||
// publications { | ||
// shadow(MavenPublication) { publication -> | ||
// project.shadow.component(publication) | ||
// } | ||
// } | ||
// repositories { | ||
// maven { | ||
// url "http://repo.myorg.com" | ||
// } | ||
// } | ||
//} | ||
|
||
// create license report | ||
licenseReport { | ||
renderers = [ | ||
new InventoryHtmlReportRenderer('license-report.html'), | ||
new JsonReportRenderer('license-report.json') | ||
] | ||
|
||
from(generateLicenseReport.outputFolder) { | ||
into 'dependency-licenses' | ||
} | ||
filters = [new LicenseBundleNormalizer()] | ||
} | ||
zipKernel.dependsOn 'generateLicenseReport' |
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
buildSrc/src/main/groovy/io/github/spencerpark/gradle/DeclaredModuleInfo.groovy
This file was deleted.
Oops, something went wrong.
91 changes: 0 additions & 91 deletions
91
buildSrc/src/main/groovy/io/github/spencerpark/gradle/InventoryReportRenderer.groovy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.