Skip to content

Commit

Permalink
Javenode v0.8.0 (#9)
Browse files Browse the repository at this point in the history
* Upgraded Javet to v3.1.8
* Added JavetBuddy v0.2.0
  • Loading branch information
caoccao authored Oct 2, 2024
1 parent 7edf3dc commit 2615fe2
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 414 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ _build
pom.xml.releaseBackup
release.properties
target

# ------------------------------------------------------------------------------
# Deno

deno.lock
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javenode</artifactId>
<version>0.7.0</version>
<version>0.8.0</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

.. code-block:: kotlin
implementation("com.caoccao.javet:javenode:0.7.0")
implementation("com.caoccao.javet:javenode:0.8.0")
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
implementation 'com.caoccao.javet:javenode:0.7.0'
implementation 'com.caoccao.javet:javenode:0.8.0'
Hello Javenode (Static Import)
------------------------------
Expand Down
22 changes: 13 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ object Config {
}

object Projects {
// https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy
const val BYTE_BUDDY = "net.bytebuddy:byte-buddy:${Versions.BYTE_BUDDY}"

const val JAVET = "com.caoccao.javet:javet:${Versions.JAVET}"
const val JAVET_LINUX_ARM64 = "com.caoccao.javet:javet-linux-arm64:${Versions.JAVET}"
const val JAVET_MACOS = "com.caoccao.javet:javet-macos:${Versions.JAVET}"

// https://mvnrepository.com/artifact/com.caoccao.javet.buddy/javet-buddy
const val JAVET_BUDDY = "com.caoccao.javet.buddy:javet-buddy:${Versions.JAVET_BUDDY}"

// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
const val JUNIT_JUPITER_API = "org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}"

Expand All @@ -67,8 +67,9 @@ object Config {
object Versions {
const val BYTE_BUDDY = "1.14.10"
const val JAVA_VERSION = "1.8"
const val JAVET = "3.1.2"
const val JAVENODE = "0.7.0"
const val JAVET = "3.1.8"
const val JAVET_BUDDY = "0.2.0"
const val JAVENODE = "0.8.0"
const val JUNIT = "5.10.1"
const val VERTX = "4.4.6"
}
Expand Down Expand Up @@ -104,13 +105,16 @@ dependencies {
val os = OperatingSystem.current()
val cpuArch = System.getProperty("os.arch")
if (os.isMacOsX) {
implementation(Config.Projects.JAVET_MACOS)
compileOnly(Config.Projects.JAVET_MACOS)
testImplementation(Config.Projects.JAVET_MACOS)
} else if (os.isLinux && (cpuArch == "aarch64" || cpuArch == "arm64")) {
implementation(Config.Projects.JAVET_LINUX_ARM64)
compileOnly(Config.Projects.JAVET_LINUX_ARM64)
testImplementation(Config.Projects.JAVET_LINUX_ARM64)
} else {
implementation(Config.Projects.JAVET)
compileOnly(Config.Projects.JAVET)
testImplementation(Config.Projects.JAVET)
}
implementation(Config.Projects.BYTE_BUDDY)
implementation(Config.Projects.JAVET_BUDDY)
implementation(Config.Projects.VERTX)
testImplementation(Config.Projects.JUNIT_JUPITER_API)
testRuntimeOnly(Config.Projects.JUNIT_JUPITER_ENGINE)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Sam Cao'

# The full version, including alpha/beta/rc tags
release = '0.7.0'
release = '0.8.0'


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Release Notes
=============

0.8.0
-----

* Upgraded Javet to v3.1.8
* Added JavetBuddy v0.2.0

0.7.0
-----

Expand Down
90 changes: 0 additions & 90 deletions scripts/python/change_javet_version.py

This file was deleted.

1 change: 0 additions & 1 deletion scripts/python/requirements.txt

This file was deleted.

107 changes: 107 additions & 0 deletions scripts/ts/change-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2024. caoccao.com Sam Cao
* All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as fs from "https://deno.land/std/fs/mod.ts";
import * as path from "https://deno.land/std/path/mod.ts";

class ChangeVersion {
private productionVersion: string;
private rootDirPath: string;
private snapshotVersion: string;

constructor(productionVersion: string, snapshotVersion: string) {
this.productionVersion = productionVersion;
this.snapshotVersion = snapshotVersion;
this.rootDirPath = path.join(
path.dirname(path.fromFileUrl(import.meta.url)),
"../../"
);
}

private _change(
filePath: string,
patterns: Array<RegExp>,
isSnapshot = true
) {
const sourceFilePath = path.join(this.rootDirPath, filePath);
if (fs.existsSync(sourceFilePath)) {
console.info(`Processing ${sourceFilePath}.`);
} else {
console.error(`%c${sourceFilePath} is not found.`, "color: red");
return;
}
const newVersion = isSnapshot
? this.snapshotVersion
: this.productionVersion;
const positionGroups: Array<{ start: number; end: number }> = [];
const currentContent = Deno.readTextFileSync(sourceFilePath);
patterns.map((pattern) => {
[...currentContent.matchAll(pattern)].map((match) => {
const matchedString = match[0];
if (match.groups) {
const currentVersion = match.groups["version"];
if (newVersion === currentVersion) {
console.warn(`%c Ignored ${matchedString}`, "color: yellow");
} else {
console.info(` ${matchedString} => ${newVersion}`);
const start = match.index + matchedString.indexOf(currentVersion);
const end = start + currentVersion.length;
positionGroups.push({ start: start, end: end });
}
}
});
});
if (positionGroups.length > 0) {
let newContent = "";
let lastEnd = 0;
positionGroups.sort((pg1, pg2) => pg1.start - pg2.start);
positionGroups.map((positionGroup) => {
if (positionGroup.start > lastEnd) {
newContent += currentContent.substring(lastEnd, positionGroup.start);
}
newContent += newVersion;
lastEnd = positionGroup.end;
});
if (lastEnd < currentContent.length) {
newContent += currentContent.substring(lastEnd, currentContent.length);
}
if (newContent !== currentContent) {
Deno.writeTextFileSync(sourceFilePath, newContent);
}
}
}

change() {
this._change(
"README.rst",
[
/^\s*<version>(?<version>\d+\.\d+\.\d+)<\/version>/gim,
/javenode:(?<version>\d+\.\d+\.\d+)"/gim,
],
false
);
this._change("build.gradle.kts", [
/^\s*const val JAVENODE = "(?<version>\d+\.\d+\.\d+)"/gim,
]);
this._change("docs/conf.py", [
/^release = "(?<version>\d+\.\d+\.\d+)"/gim,
]);
}
}

const changeVersion = new ChangeVersion("0.8.0", "0.8.0");
changeVersion.change();
Loading

0 comments on commit 2615fe2

Please sign in to comment.