Add the first test and upgrade build.gradle to modern standards

1. gradle wrapper
2. ./gradlew run
3. manifest will look like
    Manifest-Version: 1.0
    Main-Class: me.topchetoeu.jscript.runtime.SimpleRepl
    Build-Timestamp: 2024-09-04T10:44:35.990+0200
    Build-Branch: ma/add-first-tests
    Build-Revision: 412edc0ebc
    Build-Jdk: 21.0.3 (Oracle Corporation 21.0.3+7-LTS-152)
    Build-Author: TopchetoEU
4. build/distributions contains a zip and a jar which contain jscript-0.9.41-beta.jar
5. unnecessary libs have been removed
6. gradle has been updated to 8.10
7. first test has been added
This commit is contained in:
marregui 2024-09-04 10:50:06 +02:00
parent 412edc0ebc
commit 6bfe50220d
114 changed files with 67 additions and 24 deletions

View File

@ -1,44 +1,69 @@
import java.text.SimpleDateFormat
plugins { plugins {
id "application" id 'application'
// these idiots don't optimize in the compile-time, but in the runtime id 'net.nemerosa.versioning' version '2.15.0'
// who let these knuckleheads make a language id 'org.ajoberstar.grgit' version '5.0.0-rc.3' // required by gradle
// TODO: figure out how to integrate proguard // TODO: figure out how to integrate proguard
// id "com.github.xaverkapeller.proguard-annotations" // id "com.github.xaverkapeller.proguard-annotations"
} }
base.archivesName = project.project_name
version = project.project_version
group = project.project_group
description = 'ES5-compliant JavaScript interpreter'
repositories { repositories {
mavenCentral() mavenCentral()
gradlePluginPortal()
} }
dependencies { dependencies {
// Genuinely fuck Java testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
compileOnly 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2'
} }
java { java {
toolchain.languageVersion = JavaLanguageVersion.of(17) sourceCompatibility = JavaVersion.VERSION_17
} targetCompatibility = JavaVersion.VERSION_17
configure([tasks.compileJava]) { toolchain {
sourceCompatibility = 17 // for the IDE support
options.release = 11
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17) languageVersion = JavaLanguageVersion.of(17)
} }
} }
jar { jar {
manifest.attributes["Main-class"] = project.main_class manifest {
attributes(
'Main-Class': project.main_class,
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Build-Branch': versioning.info.branch,
'Build-Revision': versioning.info.commit,
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-Author': 'TopchetoEU'
)
}
} }
sourceSets { application {
main.java.srcDirs = [ "src/java" ] mainClass = project.main_class
main.resources.srcDirs = [ "src/assets" ] applicationDefaultJvmArgs = ['-Xmx2G', '-Xms2G', '-server', '-Dfile.encoding=UTF-8']
}
distZip {
eachFile { file ->
if (file.path.contains('bin')) {
file.exclude()
}
}
}
distTar {
eachFile { file ->
if (file.path.contains('bin')) {
file.exclude()
}
}
} }
processResources { processResources {
@ -50,6 +75,10 @@ processResources {
} }
} }
base.archivesName = project.project_name test {
version = project.project_version useJUnitPlatform()
group = project.project_group }
wrapper {
gradleVersion = '8.10'
}

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

Some files were not shown because too many files have changed in this diff Show More