Skip to content

Commit

Permalink
Rename the main module and all-in-one JAR
Browse files Browse the repository at this point in the history
The main module is now named "rhino", and exports the
"org.mozilla.rhino" package.

The "rhino-all" module builds the "rhino-all.jar", which contains all
the modules except the ScriptEngine (like the old "rhino.jar") and is
sufficient to run Rhino using "java -jar".
  • Loading branch information
gbrail committed Jun 17, 2024
1 parent 39aad21 commit 01a7b20
Show file tree
Hide file tree
Showing 402 changed files with 48 additions and 45 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Rhino 1.7.15 and before were primarily used in a single JAR called "rhino.jar".

Newer releases now organize the code using Java modules. There are four primary modules:

* **rhino-runtime**: The primary codebase necessary and sufficient to run JavaScript code. Required by everything that uses Rhino.
* **rhino-tools**: Contains the shell, debugger, and the "Global" object, which many tests and other Rhino-based tools sometimes use. Note that adding Global gives Rhino the ability to print to stdout, open files, and do other things that may be considered dangerous in a shared environment.
* **rhino**: The primary codebase necessary and sufficient to run JavaScript code. Required by everything that uses Rhino. In releases *after* 1.7.15, this module does not contain the "tools" or the XML implementation.
* **rhino-tools**: Contains the shell, debugger, and the "Global" object, which many tests and other Rhino-based tools use. Note that adding Global gives Rhino the ability to print to stdout, open files, and do other things that may be considered dangerous in a sensitive environment, so it only makes sense to include if you will use it.
* **rhino-xml**: Adds the implementation of the E4X XML standard. Only required if you are using that.
* **rhino-engine**: Adds the Rhino implementation of the standard Java *ScriptEngine* interface. Some projects use this to be able to switch between script execution engines, but for anything even moderately complex it is almost always easier and always more flexible to use Rhino's API directly.

The release contains the following other modules, which are used while building and
testing but which are not published to Maven Central:

* **rhino**: This creates an "all-in-one" JAR that includes *rhino-runtime*, *rhino-tools*, and *rhino-xml*. This is what's used if you want to run Rhino using "java jar".
* **rhino-all**: This creates an "all-in-one" JAR that includes *rhino-runtime*, *rhino-tools*, and *rhino-xml*. This is what's used if you want to run Rhino using "java jar".
* **tests**: The tests that depend on all of Rhino and also the external tests, including the Mozilla legacy test scripts and the test262 tests.
* **benchmarks**: Runs benchmarks using JMH.
* **examples**: Surprisingly, this contains example code.
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino')
implementation project(':rhino-tools')
}

Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino')
implementation project(':rhino-tools')
implementation project(':rhino-xml')
}
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ version=1.7.16-SNAPSHOT
mavenSnapshotRepo=https://oss.sonatype.org/content/repositories/snapshots
mavenReleaseRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2/
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
org.gradle.parallel=true
30 changes: 27 additions & 3 deletions rhino-runtime/build.gradle → rhino-all/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
plugins {
id 'rhino.library-conventions'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'application'
}

application {
mainClass = 'org.mozilla.javascript.tools.shell.Main'
}

run {
standardInput = System.in
}

dependencies {
implementation project(':rhino')
implementation project(':rhino-tools')
implementation project(':rhino-xml')
}

shadowJar {
// Ensure that the "jar" from this step is the shadowed one that we want to
// publish in Maven.
archiveClassifier.set('')
manifest {
inheritFrom(project.tasks.jar.manifest)
}
}

publishing {
publications {
rhinoruntime(MavenPublication) {
rhinoall(MavenPublication) {
from components.java
artifacts = [jar, sourceJar, javadocJar]
artifacts = [jar]
pom {
description = "Rhino JavaScript runtime jar, excludes XML, tools ScriptEngine wrapper"
description = "Rhino JavaScript all-in-one JAR, not for use with modular Java projects"
url = "https://mozilla.github.io/rhino/"
licenses {
license {
Expand Down
2 changes: 1 addition & 1 deletion rhino-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino')
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion rhino-engine/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module org.mozilla.rhino.engine {
exports org.mozilla.javascript.engine;

requires org.mozilla.rhino.runtime;
requires org.mozilla.rhino;
requires java.scripting;
}
2 changes: 1 addition & 1 deletion rhino-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino')
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion rhino-tools/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module org.mozilla.rhino.tools {
requires org.mozilla.rhino.runtime;
requires org.mozilla.rhino;
requires java.desktop;

exports org.mozilla.javascript.tools.debugger;
Expand Down
2 changes: 1 addition & 1 deletion rhino-xml/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino')
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion rhino-xml/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module org.mozilla.javascript.xml {
exports org.mozilla.javascript.xmlimpl;

requires org.mozilla.rhino.runtime;
requires org.mozilla.rhino;
requires java.xml;
}
28 changes: 2 additions & 26 deletions rhino/build.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
plugins {
id 'rhino.library-conventions'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'application'
}

application {
mainClass = 'org.mozilla.javascript.tools.shell.Main'
}

run {
standardInput = System.in
}

dependencies {
implementation project(':rhino-runtime')
implementation project(':rhino-tools')
implementation project(':rhino-xml')
}

shadowJar {
// Ensure that the "jar" from this step is the shadowed one that we want to
// publish in Maven.
archiveClassifier.set('')
manifest {
inheritFrom(project.tasks.jar.manifest)
}
}

publishing {
publications {
rhino(MavenPublication) {
from components.java
artifacts = [jar]
artifacts = [jar, sourceJar, javadocJar]
pom {
description = "Rhino JavaScript all-in-one JAR, not for use with modular Java projects"
description = "Rhino JavaScript runtime jar, excludes XML, tools ScriptEngine wrapper"
url = "https://mozilla.github.io/rhino/"
licenses {
license {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module org.mozilla.rhino.runtime {
module org.mozilla.rhino {
exports org.mozilla.classfile;
exports org.mozilla.javascript;
exports org.mozilla.javascript.annotations;
Expand Down
Loading

0 comments on commit 01a7b20

Please sign in to comment.