| plugins { | |
| id 'rhino.library-conventions' | |
| id 'biz.aQute.bnd.builder' | |
| id 'application' | |
| } | |
| application { | |
| mainClass = 'org.mozilla.javascript.tools.shell.Main' | |
| } | |
| configurations { | |
| shellOnly | |
| } | |
| dependencies { | |
| implementation project(':rhino') | |
| // Dependencies that ensure that we can compile with the JLine library | |
| compileOnly libs.jline.terminal | |
| compileOnly libs.jline.reader | |
| // Dependencies that add JLine only for the "run" task | |
| shellOnly libs.jline.terminal | |
| shellOnly libs.jline.reader | |
| shellOnly libs.bundles.jline.runtime | |
| testImplementation project(':testutils') | |
| testImplementation libs.jline.terminal | |
| testImplementation libs.jline.reader | |
| } | |
| jar { | |
| bundle { | |
| bnd( | |
| 'Bundle-SymbolicName': 'org.mozilla.rhino.tools', | |
| 'Bundle-Vendor': 'Mozilla Foundation', | |
| 'Bundle-License': 'https://www.mozilla.org/MPL/2.0/', | |
| '-exportcontents': [ | |
| 'org.mozilla.javascript.tools', | |
| 'org.mozilla.javascript.tools.debugger', | |
| 'org.mozilla.javascript.tools.jsc', | |
| 'org.mozilla.javascript.tools.shell', | |
| ].join(','), | |
| 'Import-Package': [ | |
| 'javax.swing*;resolution:=optional', | |
| 'java.awt*;resolution:=optional', | |
| 'org.jline.reader;resolution:=optional', | |
| 'org.jline.reader.impl;resolution:=optional', | |
| 'org.jline.terminal;resolution:=optional', | |
| '*', | |
| ].join(','), | |
| 'Provide-Capability': [ | |
| 'osgi.serviceloader;osgi.serviceloader=org.mozilla.javascript.tools.ConsoleProvider;register:=org.mozilla.javascript.tools.shell.BasicConsoleProvider', | |
| 'osgi.serviceloader;osgi.serviceloader=org.mozilla.javascript.tools.ConsoleProvider;register:=org.mozilla.javascript.tools.shell.JLineConsoleProvider', | |
| ].join(','), | |
| 'Require-Capability': [ | |
| 'osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))"', | |
| 'osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)"', | |
| 'osgi.extender;filter:="(osgi.extender=osgi.serviceloader.registrar)"', | |
| 'osgi.serviceloader;osgi.serviceloader=org.mozilla.javascript.tools.ConsoleProvider;cardinality:=multiple', | |
| ].join(',') | |
| ) | |
| } | |
| } | |
| run { | |
| standardInput = System.in | |
| classpath = sourceSets.main.runtimeClasspath + | |
| configurations.shellOnly | |
| } | |
| // This task makes it easier to write other command-line apps | |
| tasks.register('printClassPath') { | |
| def cp = sourceSets.main.runtimeClasspath + configurations.shellOnly | |
| inputs.files(cp) | |
| doLast { | |
| println cp.asPath | |
| } | |
| } | |
| // Easy way to launch the debugger | |
| tasks.register('runDebugger', JavaExec) { | |
| mainClass = 'org.mozilla.javascript.tools.debugger.Main' | |
| classpath = sourceSets.main.runtimeClasspath | |
| } | |
| // This does the same thing as "gradle run" but adds a bit of usability | |
| // since we also have a "runDebugger" task | |
| tasks.register('runCli', JavaExec) { | |
| mainClass = 'org.mozilla.javascript.tools.shell.Main' | |
| classpath = sourceSets.main.runtimeClasspath + | |
| configurations.shellOnly | |
| standardInput = System.in | |
| } | |
| publishing { | |
| publications { | |
| rhinotools(MavenPublication) { | |
| from components.java | |
| artifacts = [jar, sourceJar, javadocJar] | |
| pom.withXml { | |
| def root = asNode() | |
| root.appendNode('name', 'rhino-tools') | |
| root.appendNode('description', "Rhino tools, including shell and debugger") | |
| root.appendNode("url", "https://mozilla.github.io/rhino/") | |
| def p = root.appendNode("parent") | |
| p.appendNode("groupId", "org.sonatype.oss") | |
| p.appendNode("artifactId", "oss-parent") | |
| p.appendNode("version", "7") | |
| def l = root.appendNode("licenses").appendNode("license") | |
| l.appendNode("name", "Mozilla Public License, Version 2.0") | |
| l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") | |
| def scm = root.appendNode("scm") | |
| scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") | |
| scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") | |
| scm.appendNode("url", "git@github.com:mozilla/rhino.git") | |
| def o = root.appendNode("organization") | |
| o.appendNode("name", "The Mozilla Foundation") | |
| o.appendNode("url", "http://www.mozilla.org") | |
| def d = root.appendNode("developers") | |
| def dd = d.appendNode("developer") | |
| dd.appendNode("name", "Greg Brail") | |
| dd.appendNode("email", "gbrail@users.noreply.github.com") | |
| } | |
| } | |
| } | |
| } |