Skip to content

Commit 327153f

Browse files
committed
Attempt to switch to java 8
1 parent 0eef54a commit 327153f

File tree

31 files changed

+939
-13
lines changed

31 files changed

+939
-13
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* MiniGamesBox - Library box with massive content that could be seen as minigames core.
3+
* Copyright (C) 2023 Plugily Projects - maintained by Tigerpanzer_02 and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
plugins {
20+
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
21+
id("groovy-gradle-plugin")
22+
}
23+
24+
repositories {
25+
// Use the plugin portal to apply community plugins in convention plugins.
26+
gradlePluginPortal()
27+
}
28+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//CHECKSTYLE:OFF
2+
import org.gradle.util.GradleVersion;
3+
import org.gradle.groovy.scripts.BasicScript;
4+
import org.gradle.groovy.scripts.ScriptSource;
5+
import org.gradle.groovy.scripts.TextResourceScriptSource;
6+
import org.gradle.internal.resource.StringTextResource;
7+
/**
8+
* Precompiled plugily.projects.java-conventions script plugin.
9+
**/
10+
@SuppressWarnings("DefaultPackage")
11+
public class PlugilyProjectsJavaConventionsPlugin implements org.gradle.api.Plugin<org.gradle.api.internal.project.ProjectInternal> {
12+
private static final String MIN_SUPPORTED_GRADLE_VERSION = "5.0";
13+
@Override
14+
public void apply(org.gradle.api.internal.project.ProjectInternal target) {
15+
assertSupportedByCurrentGradleVersion();
16+
try {
17+
Class<? extends BasicScript> pluginsBlockClass = Class.forName("cp_precompiled_PlugilyProjectsJavaConventions").asSubclass(BasicScript.class);
18+
BasicScript pluginsBlockScript = pluginsBlockClass.getDeclaredConstructor().newInstance();
19+
pluginsBlockScript.setScriptSource(scriptSource(pluginsBlockClass));
20+
pluginsBlockScript.init(target, target.getServices());
21+
pluginsBlockScript.run();
22+
target.getPluginManager().apply("java-library");
23+
target.getPluginManager().apply("signing");
24+
target.getPluginManager().apply("maven-publish");
25+
26+
27+
Class<? extends BasicScript> precompiledScriptClass = Class.forName("precompiled_PlugilyProjectsJavaConventions").asSubclass(BasicScript.class);
28+
BasicScript script = precompiledScriptClass.getDeclaredConstructor().newInstance();
29+
script.setScriptSource(scriptSource(precompiledScriptClass));
30+
script.init(target, target.getServices());
31+
script.run();
32+
} catch (Exception e) {
33+
throw new RuntimeException(e);
34+
}
35+
}
36+
private static ScriptSource scriptSource(Class<?> scriptClass) {
37+
return new TextResourceScriptSource(new StringTextResource(scriptClass.getSimpleName(), ""));
38+
}
39+
private static void assertSupportedByCurrentGradleVersion() {
40+
if (GradleVersion.current().getBaseVersion().compareTo(GradleVersion.version(MIN_SUPPORTED_GRADLE_VERSION)) < 0) {
41+
throw new RuntimeException("Precompiled Groovy script plugins require Gradle "+MIN_SUPPORTED_GRADLE_VERSION+" or higher");
42+
}
43+
}
44+
}
45+
//CHECKSTYLE:ON
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
implementation-class=PlugilyProjectsJavaConventionsPlugin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
implementation-class=PlugilyProjectsJavaConventionsPlugin
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Manifest-Version: 1.0
2+
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*/
4+
5+
plugins {
6+
id 'java-library'
7+
id 'signing'
8+
id 'maven-publish'
9+
}
10+
11+
repositories {
12+
mavenCentral()
13+
mavenLocal()
14+
maven {
15+
name = "papermc"
16+
url = uri("https://repo.papermc.io/repository/maven-public/")
17+
}
18+
maven {
19+
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
20+
21+
// As of Gradle 5.1, you can limit this to only those
22+
// dependencies you expect from it
23+
content {
24+
includeGroup 'org.bukkit'
25+
includeGroup 'org.spigotmc'
26+
}
27+
}
28+
29+
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
30+
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
31+
32+
// mavenLocal() // This is needed for CraftBukkit and Spigot.
33+
34+
maven {
35+
url = uri('https://maven.plugily.xyz/releases')
36+
}
37+
38+
maven {
39+
url = uri('https://simonsator.de/repo/')
40+
}
41+
42+
maven {
43+
url = uri('https://repo.alessiodp.com/releases/')
44+
}
45+
46+
maven {
47+
url = uri('https://repo.extendedclip.com/releases/')
48+
}
49+
}
50+
51+
dependencies {
52+
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")
53+
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
54+
compileOnly 'org.jetbrains:annotations:23.0.0'
55+
}
56+
57+
java {
58+
withJavadocJar()
59+
}
60+
61+
javadoc {
62+
options.encoding = 'UTF-8'
63+
}
64+
65+
publishing {
66+
repositories {
67+
maven {
68+
name = "Releases"
69+
url = "https://maven.plugily.xyz/releases"
70+
credentials {
71+
username = System.getenv("MAVEN_USERNAME")
72+
password = System.getenv("MAVEN_PASSWORD")
73+
}
74+
}
75+
maven {
76+
name = "Snapshots"
77+
url = uri("https://maven.plugily.xyz/snapshots")
78+
credentials {
79+
username = System.getenv("MAVEN_USERNAME")
80+
password = System.getenv("MAVEN_PASSWORD")
81+
}
82+
}
83+
}
84+
publications {
85+
maven(MavenPublication) {
86+
from components.java
87+
if (project.tasks.findByName("shadowJar") != null) {
88+
artifact tasks.shadowJar
89+
}
90+
}
91+
}
92+
}
93+
94+
tasks.withType(JavaCompile).configureEach {
95+
options.encoding = 'UTF-8'
96+
}

0 commit comments

Comments
 (0)