Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup Experiments #232

Draft
wants to merge 56 commits into
base: 7.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c432c30
Work
shartte Jul 6, 2024
056c948
WIP
shartte Dec 24, 2024
2643be7
Removed PowerMock and adjusted ML tests
shartte Dec 24, 2024
e11d4b7
Working on fixing all tests.
shartte Dec 24, 2024
d823721
Fix all tests
shartte Dec 24, 2024
523209c
Fix all tests
shartte Dec 25, 2024
060cd06
Fix all tests
shartte Dec 25, 2024
f7e5349
Fix all tests
shartte Dec 25, 2024
7e8fadf
Run jmh in subproject.
shartte Dec 25, 2024
1510853
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
4d4a76f
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
decfd1b
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
01e0eb5
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
cb1e1ec
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
cdcd888
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
0d9b3c6
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
f59a8e1
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
6ad3f33
Reduce tested JVMs, add actual tests
shartte Dec 25, 2024
fc78cee
8.12 breaks gradleutils in FML
shartte Dec 25, 2024
11e475e
Fix startup
shartte Dec 25, 2024
ed12171
Fix startup (and self-attach)
shartte Dec 25, 2024
0fdfe41
Remove unused startup code and consolidate it into loader project.
shartte Dec 26, 2024
9c2d583
Fixed annoying Gradle issues
shartte Dec 28, 2024
0ba407f
Merged ctor with start for DisplayWindow
shartte Dec 28, 2024
3e98dc7
More cleanup. Reintroduced early service loading.
shartte Dec 29, 2024
4a9f1d9
Fixed test
shartte Dec 29, 2024
3c91e55
Formatting
shartte Dec 29, 2024
0750e16
Add datagen entrypoints.
shartte Dec 29, 2024
bd6839f
Formatting+Licenses
shartte Dec 29, 2024
cd16a2b
Rework how arguments are parsed
shartte Dec 30, 2024
b55e2af
Rework how production mode is detected
shartte Dec 30, 2024
bff9660
Refactoring FMLLoader and consolidating code.
shartte Dec 31, 2024
8657b28
Improve debug log for loaders
shartte Dec 31, 2024
5bc8bf3
Fixed tests
shartte Dec 31, 2024
42b0b7a
Fixed tests
shartte Dec 31, 2024
cde4bda
Remove local additions
shartte Dec 31, 2024
3868a20
Work on FML JUnit
shartte Dec 31, 2024
4b86992
Work on FML JUnit
shartte Dec 31, 2024
fa932f4
Added JUnitGameBootstrapper to replace JUnitMain
shartte Dec 31, 2024
3f774ed
Added JUnitGameBootstrapper to replace JUnitMain
shartte Dec 31, 2024
a609367
Move to loader to make accessible to NeoForge
shartte Dec 31, 2024
3bd7fd9
recursively delete game directory
shartte Jan 1, 2025
8bba47e
recursively delete game directory
shartte Jan 1, 2025
a0bb2e1
Normalize target class names
shartte Jan 1, 2025
fb3ad8e
Add missing jar attributes to make FML jar work as javaagent
shartte Jan 1, 2025
a16761a
Change how versions are embedded in FML
shartte Jan 3, 2025
489fee7
Fix versioning test
shartte Jan 3, 2025
e484cf0
Fix versioning test
shartte Jan 3, 2025
3c7878d
Fix publication
shartte Jan 3, 2025
5710946
Fix mod jar loading in userdev
shartte Jan 4, 2025
058f90e
Add rudimentary JFR event for class transformations
shartte Jan 4, 2025
332e48b
Add rudimentary JFR event for class transformations
shartte Jan 4, 2025
4072d7e
Add masking of classpath resources for in-dev
shartte Jan 5, 2025
cec35a1
Broken WIP (le grand refacteur)
shartte Jan 6, 2025
b415fca
remove local copy of jarselector
shartte Jan 6, 2025
15a1ee6
Fix some tests
shartte Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .github/workflows/collect_jmh_results.groovy

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/test-jvms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test Java Versions and Vendors

on:
push:
branches:
- main
- 7.x
workflow_dispatch:
pull_request:
types: [opened, synchronize]

jobs:
testjdks:
name: Test Java ${{ matrix.jdk }} ${{ matrix.jvm_version }}
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: false
matrix:
# We use the latest LTS available by Microsoft since that is used in Minecraft
# We also test J9 and the latest versions of Graal and Adoptium, since users have
# to explicitly download these, we do not check the LTS versions.
include:
- jdk: Adoptium
jvm_version: 23
- jdk: Graal_VM
jvm_version: 23
- jdk: IBM # J9
jvm_version: 21 # IBM only has 21
- jdk: Microsoft
jvm_version: 21 # MS OpenJDK only has LTS versions (21)
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-disabled: true
add-job-summary: never
- name: Run Tests
run: ./gradlew test -Pjava_vendor=${{ matrix.jdk }} -Pjava_version=${{ matrix.jvm_version }}
- uses: actions/upload-artifact@v4
name: Upload Test Results
if: always()
with:
name: test_${{ matrix.jdk }}-${{ matrix.jvm_version }}
path: "**/build/reports/tests/**/*"
66 changes: 0 additions & 66 deletions .github/workflows/test_jvms.yml

This file was deleted.

48 changes: 40 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'com.diffplug.spotless' version '6.25.0' apply false
id 'net.neoforged.gradleutils' version "${gradleutils_version}"
id 'net.neoforged.gradleutils.spotless' version "${gradleutils_version}" apply false
id 'org.jetbrains.gradle.plugin.idea-ext'
}

changelog {
Expand All @@ -22,6 +23,10 @@ gradleutils.version {

println "Version: ${project.version = gradleutils.version}"

tasks.named('updateDaemonJvm') {
jvmVersion = JavaVersion.VERSION_21
}

allprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
Expand Down Expand Up @@ -51,7 +56,12 @@ allprojects {
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(Integer.valueOf(java_version))
if (java_vendor) {
final actualVendor = java_vendor.endsWith('-J9') ? java_vendor.substring(0, java_vendor.length() - 3) : java_vendor
vendor = JvmVendorSpec."${actualVendor.toUpperCase(Locale.ROOT)}" as JvmVendorSpec
implementation = java_vendor.endsWith('-J9') ? JvmImplementation.J9 : JvmImplementation.VENDOR_SPECIFIC
}
}
}

Expand All @@ -63,17 +73,19 @@ allprojects {
subprojects { subProject ->
subProject.version = rootProject.version

apply plugin: fmlbuild.InDevModulePlugin

jar {
manifest.attributes(
'Git-Commit' : gradleutils.gitInfo.abbreviatedId,
'Git-Commit': gradleutils.gitInfo.abbreviatedId,
'Build-Number': "${subProject.version}",
'Automatic-Module-Name' : "fml_${subProject.name.replace("-", "_")}",
'Specification-Title' : "FML${subProject.name}",
'Specification-Vendor' : 'NeoForged',
'Specification-Version' : "${subProject.version.toString().split('\\.')[0]}",
'Implementation-Title' : "FML $subProject.name",
'Automatic-Module-Name': "fml_${subProject.name.replace("-", "_")}",
'Specification-Title': "FML${subProject.name}",
'Specification-Vendor': 'NeoForged',
'Specification-Version': "${subProject.version.toString().split('\\.')[0]}",
'Implementation-Title': "FML $subProject.name",
'Implementation-Version': "${subProject.version.toString().split('\\.')[0]}.${subProject.version.toString().split('\\.')[1]}",
'Implementation-Vendor' : 'NeoForged'
'Implementation-Vendor': 'NeoForged'
)

if (subProject.name != 'junit') {
Expand Down Expand Up @@ -109,3 +121,23 @@ subprojects { subProject ->
}
}
}

configurations {
testJavaAgents {
description = "Used to resolve java agents attached to all JUnit configurations in IntelliJ"
}
}
dependencies {
// This should actually match the bytebuddy version used by Mockito, but the Mockito BOM sadly does not specify
testJavaAgents files("loader/devagent.jar")
testJavaAgents "net.bytebuddy:byte-buddy-agent:1.15.11"
}

// Make every JUnit test in IntelliJ load the devagent
idea.project.settings {
runConfigurations {
defaults(org.jetbrains.gradle.ext.JUnit) {
vmParameters = configurations.testJavaAgents.collect { "-javaagent:" + it.absolutePath }.join(" ")
}
}
}
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ java {
}

dependencies {
implementation "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.8"
implementation "com.google.code.gson:gson:2.10.1"
}

Expand Down
20 changes: 20 additions & 0 deletions buildSrc/src/main/java/fmlbuild/InDevModulePlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fmlbuild;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer;

public class InDevModulePlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
var sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
var mainSourceSet = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
var generatedVersionDir = project.getLayout().getBuildDirectory().dir("generated/version");
var createVersionProperties = project.getTasks().register("createVersionProperties", WriteVersionPropertiesTask.class, task -> {
task.setDescription("Generates a Module version properties file for use during development and containing more information for production as well.");
task.getOutputDirectory().set(generatedVersionDir);
});
mainSourceSet.getResources().srcDir(createVersionProperties.flatMap(WriteVersionPropertiesTask::getOutputDirectory));
}
}
Loading
Loading