Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLimeGlass committed Aug 31, 2024
2 parents 62fbeb7 + c8cd975 commit c54ff14
Show file tree
Hide file tree
Showing 244 changed files with 5,771 additions and 2,502 deletions.
1 change: 0 additions & 1 deletion .github/workflows/archive-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
jobs:
archive-docs:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
needs: release-docs
runs-on: ubuntu-latest
steps:
- name: Configure workflow
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-17-builds.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java 17 CI (MC 1.17-1.20.4)
name: Java 17 CI (MC 1.19.4-1.20.4)

on:
push:
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/java-8-builds.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/junit-17-builds.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JUnit (MC 1.17-1.20.4)
name: JUnit (MC 1.19.4-1.20.4)

on:
push:
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/junit-8-builds.yml

This file was deleted.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Skript requires **Spigot** to work. You heard it right, **CraftBukkit** does *no
**Paper**, which is a fork of Spigot, is recommended; it is required for some
parts of Skript to be available.

Skript supports only the **latest** patch versions of Minecraft 1.9+.
For example, this means that 1.16.5 is supported, but 1.16.4 is *not*.
Skript supports only the **latest** patch versions of Minecraft 1.19 and newer.
For example, this means that 1.19.4 is supported, but 1.19.3 is *not*.
Testing with all old patch versions is not feasible for us.

Minecraft 1.8 and earlier are not, and will not be supported. New Minecraft
Minecraft 1.12 and earlier are not, and will not be supported. New Minecraft
versions will be supported as soon as possible.

## Download
Expand Down Expand Up @@ -77,15 +77,14 @@ Skript has some tests written in Skript. Running them requires a Minecraft
server, but our build script will create one for you. Running the tests is easy:

```
./gradlew (quickTest|skriptTest|skriptTestJava8|skriptTestJava17|skriptTestJava21)
./gradlew (quickTest|skriptTest|skriptTestJava17|skriptTestJava21)
```

<code>quickTest</code> runs the test suite on newest supported server version.
<code>skriptTestJava21</code> (1.20.6+) runs the tests on Java 21 supported versions.
<code>skriptTestJava17</code> (1.17-1.20.4) runs the tests on Java 17 supported versions.
<code>skriptTestJava8</code> (1.13-1.16) runs the tests on Java 8 supported versions.
<code>skriptTestJava17</code> (1.19.4-1.20.4) runs the tests on Java 17 supported versions.
<code>skriptTest</code> runs the tests on all versions.
That is, it runs skriptTestJava8, skriptTestJava17, and skriptTestJava21.
That is, it runs skriptTestJava17, and skriptTestJava21.

By running the tests, you agree to Mojang's End User License Agreement.

Expand Down Expand Up @@ -164,7 +163,7 @@ dependencies {
}
```

An example of the version tag would be ```dev37c```.
An example of the version tag would be ```2.8.5```.

> Note: If Gradle isn't able to resolve Skript's dependencies, just [disable the resolution of transitive dependencies](https://docs.gradle.org/current/userguide/resolution_rules.html#sec:disabling_resolution_transitive_dependencies) for Skript in your project.
Expand Down
19 changes: 8 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
shadow group: 'org.bstats', name: 'bstats-bukkit', version: '3.0.2'
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.3.2'

implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.20.6-R0.1-SNAPSHOT'
implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.21-R0.1-SNAPSHOT'
implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.annotation', version: '2.2.700'
implementation group: 'com.google.code.findbugs', name: 'findbugs', version: '3.0.1'
implementation group: 'com.sk89q.worldguard', name: 'worldguard-legacy', version: '7.0.0-SNAPSHOT'
Expand Down Expand Up @@ -70,7 +70,7 @@ task build(overwrite: true, type: ShadowJar) {
from sourceSets.main.output
}

// Excludes the tests for the build task. Should be using junit, junitJava17, junitJava8, skriptTest, quickTest.
// Excludes the tests for the build task. Should be using junit, junitJava17, skriptTest, quickTest.
// We do not want tests to run for building. That's time consuming and annoying. Especially in development.
test {
exclude '**/*'
Expand Down Expand Up @@ -224,7 +224,7 @@ void createTestTask(String name, String desc, String environments, int javaVersi
if (!gradle.taskGraph.hasTask(":tasks") && !gradle.startParameter.dryRun && modifiers.contains(Modifiers.PROFILE)) {
if (!project.hasProperty('profiler'))
throw new MissingPropertyException('Add parameter -Pprofiler=<path to profiler>', 'profiler', String.class)

args += '-agentpath:' + project.property('profiler') + '=port=8849,nowait'
}
}
Expand All @@ -233,11 +233,10 @@ void createTestTask(String name, String desc, String environments, int javaVersi

def java21 = 21
def java17 = 17
def java8 = 8

def latestEnv = 'java21/paper-1.20.6.json'
def latestEnv = 'java21/paper-1.21.0.json'
def latestJava = java21
def oldestJava = java8
def oldestJava = java17

def latestJUnitEnv = 'java17/paper-1.20.4.json'
def latestJUnitJava = java17
Expand All @@ -260,25 +259,23 @@ int envJava = project.property('testEnvJavaVersion') == null ? latestJava : Inte
createTestTask('quickTest', 'Runs tests on one environment being the latest supported Java and Minecraft.', environments + latestEnv, latestJava, 0)
createTestTask('skriptTestJava21', 'Runs tests on all Java 21 environments.', environments + 'java21', java21, 0)
createTestTask('skriptTestJava17', 'Runs tests on all Java 17 environments.', environments + 'java17', java17, 0)
createTestTask('skriptTestJava8', 'Runs tests on all Java 8 environments.', environments + 'java8', java8, 0)
createTestTask('skriptTestDev', 'Runs testing server and uses \'system.in\' for command input, stop server to finish.', environments + env, envJava, 0, Modifiers.DEV_MODE, Modifiers.DEBUG)
createTestTask('skriptProfile', 'Starts the testing server with JProfiler support.', environments + latestEnv, latestJava, -1, Modifiers.PROFILE)
createTestTask('genNightlyDocs', 'Generates the Skript documentation website html files.', environments + env, envJava, 0, Modifiers.GEN_NIGHTLY_DOCS)
createTestTask('genReleaseDocs', 'Generates the Skript documentation website html files for a release.', environments + env, envJava, 0, Modifiers.GEN_RELEASE_DOCS)
tasks.register('skriptTest') {
description = 'Runs tests on all environments.'
dependsOn skriptTestJava8, skriptTestJava17, skriptTestJava21
dependsOn skriptTestJava17, skriptTestJava21
}

createTestTask('JUnitQuick', 'Runs JUnit tests on one environment being the latest supported Java and Minecraft.', environments + latestJUnitEnv, latestJUnitJava, 0, Modifiers.JUNIT)
// Disabled as EasyMock 5.2.0 is required for Java 21 support
// However, we are currently using 5.0.1 (see https://github.com/SkriptLang/Skript/pull/6204#discussion_r1405302009)
//createTestTask('JUnitJava21', 'Runs JUnit tests on all Java 21 environments.', environments + 'java21', java21, 0, Modifiers.JUNIT)
createTestTask('JUnitJava17', 'Runs JUnit tests on all Java 17 environments.', environments + 'java17', java17, 0, Modifiers.JUNIT)
createTestTask('JUnitJava8', 'Runs JUnit tests on all Java 8 environments.', environments + 'java8', java8, 0, Modifiers.JUNIT)
tasks.register('JUnit') {
description = 'Runs JUnit tests on all environments.'
dependsOn JUnitJava8, JUnitJava17//, JUnitJava21
dependsOn JUnitJava17//, JUnitJava21
}

// Build flavor configurations
Expand Down Expand Up @@ -394,7 +391,7 @@ javadoc {
exclude("ch/njol/skript/lang/function/ExprFunctionCall.java")
exclude("ch/njol/skript/hooks/**")
exclude("ch/njol/skript/test/**")

classpath = configurations.compileClasspath + sourceSets.main.output
options.encoding = 'UTF-8'
// currently our javadoc has a lot of errors, so we need to suppress the linter
Expand Down
5 changes: 2 additions & 3 deletions code-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ Your comments should look something like these:
## Language Features

### Compatibility
[//]: # (To be updated after feature/2.9 for Java 17)
* Contributions should maintain Java 11 source/binary compatibility, even though compiling Skript requires Java 21
- Users must not need JRE newer than version 11
* Contributions should maintain Java 17 source/binary compatibility, even though compiling Skript requires Java 21
- Users must not need JRE newer than version 17
* Versions up to and including Java 21 should work too
- Please avoid using unsafe reflection
* It is recommended to make fields final, if they are effectively final
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.parallel=true

groupid=ch.njol
name=skript
version=2.8.7
version=2.9.1
jarName=Skript.jar
testEnv=java21/paper-1.20.6
testEnv=java21/paper-1.21.0
testEnvJavaVersion=21
69 changes: 46 additions & 23 deletions src/main/java/ch/njol/skript/Skript.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import ch.njol.skript.events.EvtSkript;
import ch.njol.skript.hooks.Hook;
import ch.njol.skript.lang.Condition;
import ch.njol.skript.lang.Condition.ConditionType;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.ExpressionInfo;
Expand Down Expand Up @@ -85,8 +86,10 @@
import ch.njol.util.StringUtils;
import ch.njol.util.coll.iterator.CheckedIterator;
import ch.njol.util.coll.iterator.EnumerationIterable;

import com.google.common.collect.Lists;
import com.google.gson.Gson;

import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -752,13 +755,17 @@ protected void afterErrors() {
TestTracker.JUnitTestFailed(test, message);
Skript.exception(failure.getException(), "JUnit test '" + failure.getTestHeader() + " failed.");
});
if (SkriptJUnitTest.class.isAssignableFrom(clazz))
((SkriptJUnitTest) clazz.getConstructor().newInstance()).cleanup();
SkriptJUnitTest.clearJUnitTest();
}
} catch (IOException e) {
Skript.exception(e, "Failed to execute JUnit runtime tests.");
} catch (ClassNotFoundException e) {
// Should be the Skript test jar gradle task.
assert false : "Class 'ch.njol.skript.variables.FlatFileStorageTest' was not found.";
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
Skript.exception(e, "Failed to initalize test JUnit classes.");
}
if (ignored > 0)
Skript.warning("There were " + ignored + " ignored test cases! This can mean they are not properly setup in order in that class!");
Expand Down Expand Up @@ -1371,23 +1378,55 @@ public static SkriptAddon getAddonInstance() {

// ================ CONDITIONS & EFFECTS & SECTIONS ================

private static final Collection<SyntaxElementInfo<? extends Condition>> conditions = new ArrayList<>(50);
private static final Collection<SyntaxElementInfo<? extends Effect>> effects = new ArrayList<>(50);
private static final Collection<SyntaxElementInfo<? extends Statement>> statements = new ArrayList<>(100);
private static final Collection<SyntaxElementInfo<? extends Section>> sections = new ArrayList<>(50);
private static final List<SyntaxElementInfo<? extends Condition>> conditions = new ArrayList<>(50);
private static final List<SyntaxElementInfo<? extends Effect>> effects = new ArrayList<>(50);
private static final List<SyntaxElementInfo<? extends Statement>> statements = new ArrayList<>(100);
private static final List<SyntaxElementInfo<? extends Section>> sections = new ArrayList<>(50);

public static Collection<SyntaxElementInfo<? extends Statement>> getStatements() {
return statements;
}

public static Collection<SyntaxElementInfo<? extends Effect>> getEffects() {
return effects;
}

public static Collection<SyntaxElementInfo<? extends Section>> getSections() {
return sections;
}

// ================ CONDITIONS ================
public static Collection<SyntaxElementInfo<? extends Condition>> getConditions() {
return conditions;
}

private final static int[] conditionTypesStartIndices = new int[ConditionType.values().length];

/**
* registers a {@link Condition}.
*
* @param condition The condition's class
* @param patterns Skript patterns to match this condition
*/
public static <E extends Condition> void registerCondition(final Class<E> condition, final String... patterns) throws IllegalArgumentException {
public static <E extends Condition> void registerCondition(Class<E> condition, String... patterns) throws IllegalArgumentException {
registerCondition(condition, ConditionType.COMBINED, patterns);
}

/**
* registers a {@link Condition}.
*
* @param condition The condition's class
* @param type The conditions {@link ConditionType type}. This is used to determine in which order to try to parse conditions.
* @param patterns Skript patterns to match this condition
*/
public static <E extends Condition> void registerCondition(Class<E> condition, ConditionType type, String... patterns) throws IllegalArgumentException {
checkAcceptRegistrations();
String originClassPath = Thread.currentThread().getStackTrace()[2].getClassName();
final SyntaxElementInfo<E> info = new SyntaxElementInfo<>(patterns, condition, originClassPath);
conditions.add(info);
statements.add(info);
conditions.add(conditionTypesStartIndices[type.ordinal()], info);
statements.add(conditionTypesStartIndices[type.ordinal()], info);
for (int i = type.ordinal(); i < ConditionType.values().length; i++)
conditionTypesStartIndices[i]++;
}

/**
Expand Down Expand Up @@ -1418,22 +1457,6 @@ public static <E extends Section> void registerSection(Class<E> section, String.
sections.add(info);
}

public static Collection<SyntaxElementInfo<? extends Statement>> getStatements() {
return statements;
}

public static Collection<SyntaxElementInfo<? extends Condition>> getConditions() {
return conditions;
}

public static Collection<SyntaxElementInfo<? extends Effect>> getEffects() {
return effects;
}

public static Collection<SyntaxElementInfo<? extends Section>> getSections() {
return sections;
}

// ================ EXPRESSIONS ================

private final static List<ExpressionInfo<?, ?>> expressions = new ArrayList<>(100);
Expand Down
Loading

0 comments on commit c54ff14

Please sign in to comment.