From ce94280b45c17f14cef51b80165ebfab8aba2a89 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Tue, 25 May 2021 01:32:22 +0100 Subject: [PATCH] Re-organising structure --- .versionrc.js | 20 +++++++++-- README.md | 7 ++-- api/build.gradle | 35 +++++++++++++++++++ build.gradle | 15 ++++---- bungee/src/build.gradle | 18 +++------- core/build.gradle | 3 ++ docs/README.md | 6 ++++ gradle.properties | 1 + lang/build.gradle | 3 ++ .../src/main/resources/lang/de_DE.lang | 0 .../src/main/resources/lang/en_GB.lang | 0 .../src/main/resources/lang/fr_FR.lang | 0 .../src/main/resources/lang/hu_HU.lang | 0 settings.gradle | 1 + spigot/build.gradle | 18 +--------- velocity/build.gradle | 25 +++++++++++++ 16 files changed, 109 insertions(+), 43 deletions(-) create mode 100644 api/build.gradle create mode 100644 docs/README.md create mode 100644 lang/build.gradle rename {core => lang}/src/main/resources/lang/de_DE.lang (100%) rename {core => lang}/src/main/resources/lang/en_GB.lang (100%) rename {core => lang}/src/main/resources/lang/fr_FR.lang (100%) rename {core => lang}/src/main/resources/lang/hu_HU.lang (100%) create mode 100644 velocity/build.gradle diff --git a/.versionrc.js b/.versionrc.js index 5eed5eb5..dde33140 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -18,11 +18,25 @@ const bungee = { ...ymlUpdater, } -const plugin = { - filename: 'src/main/resources/plugin.yml', +const spigotPlugin = { + filename: 'spigot/src/main/resources/plugin.yml', ...ymlUpdater, } + +const gradleTracker = { + filename: 'gradle.properties', + updater: { + 'readVersion': (contents) => { + return versionRegex.exec(contents)[2]; + }, + 'writeVersion': (contents, version) => { + return contents.replace(versionRegex, `$1${version}`); + } + } +} + + const velocity_plugin = { filename: 'src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java', updater: { @@ -35,7 +49,7 @@ const velocity_plugin = { } } -const files = [plugin, velocity_plugin, bungee]; +const files = [gradleTracker] // spigotPlugin, velocity_plugin, bungee module.exports = { bumpFiles: files, diff --git a/README.md b/README.md index d8cb0915..d52494aa 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,13 @@ Though due to incompatibilities and keeping the files smaller, we will be making ## Common * **api**: All code for adding tags and creating addons. * **core**: Functional code with an abstraction layer to create consistent behavior between platforms. +* **lang**: Translations of the plugin available by default. ## Implementations * **spigot**: All functionality for spigot to connect the abstraction layer. +More will be coming once we have finished the recode. + ## Proxy's * **bungee**: Bungee plugin to allow secure connections between severs. * **velocity**: Velocity proxy plugin, @@ -62,6 +65,4 @@ We don't currently do tests. But in case. --> ## Scopes available -Scopes are only needed if relating to specific features just to make them easier to find. -_I'll expand the list as I work more on the project._ -* **proxy** (Proxy specific features and issues) +The scopes available should be the specific modules being worked on. E.g. core, spigot, docs diff --git a/api/build.gradle b/api/build.gradle new file mode 100644 index 00000000..6dd05a8d --- /dev/null +++ b/api/build.gradle @@ -0,0 +1,35 @@ + +apply plugin: 'maven-publish' +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +configurations { + // configuration that holds jars to copy into lib + includeLibs +} + +repositories { + maven { url "https://repo.maven.apache.org/maven2" } +} + +// includeLibs just says to include the library in the final jar +dependencies { + +} + +jar { + from configurations.includeLibs.collect { it.isDirectory() ? it : zipTree(it) } +} + +// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task +// if it is present. +// If you remove this task, sources will not be generated. +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} diff --git a/build.gradle b/build.gradle index f0e6e82d..bb2feaaa 100644 --- a/build.gradle +++ b/build.gradle @@ -14,14 +14,13 @@ import org.apache.http.impl.client.HttpClients import org.apache.http.client.methods.HttpGet import com.google.gson.Gson -apply plugin: 'maven-publish' -apply plugin: 'idea' -apply plugin: 'eclipse' -// A little messier/not advised but allprojects { apply plugin: 'java' + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -68,10 +67,12 @@ repositories { // includeLibs just says to include the library in the final jar dependencies { + includeLibs project(':api') + includeLibs project(':lang') includeLibs project(':core') - //implementation project(':bungee') - //implementation project(':spigot') - //implementation project(':velocity') + includeLibs project(':bungee') + includeLibs project(':spigot') + includeLibs project(':velocity') } diff --git a/bungee/src/build.gradle b/bungee/src/build.gradle index 5790054c..7c1abcdc 100644 --- a/bungee/src/build.gradle +++ b/bungee/src/build.gradle @@ -1,4 +1,9 @@ +apply plugin: 'maven-publish' +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -34,19 +39,6 @@ jar { from configurations.includeLibs.collect { it.isDirectory() ? it : zipTree(it) } } -// Set SPIGOT_LOC to the location of your server and SPIGOT_JAR as the name of the jar file in the server you want to run -// DIReallyKnowWhatIAmDoingISwear is to remove the stupid pause spigot has at the start -task runJar() { - doLast { - javaexec { - main "-jar" - args "${System.env.MC_SERVER_LOC}\\${System.env.MC_SERVER_JAR}.jar" - jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-DIReallyKnowWhatIAmDoingISwear=true"] - workingDir "${System.env.MC_SERVER_LOC}" - } - } -} - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. diff --git a/core/build.gradle b/core/build.gradle index 999f8fb8..7a498ca6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,3 +1,6 @@ +apply plugin: 'maven-publish' +apply plugin: 'idea' +apply plugin: 'eclipse' tasks.withType(JavaCompile) { options.encoding = 'UTF-8' diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..fcf3978d --- /dev/null +++ b/docs/README.md @@ -0,0 +1,6 @@ +Advanced Portals Documentation +============================= + +# Changelogs + * [Main Release Changelogs](./changelogs/CHANGELOG.md) + * [Snapshot Release Changelogs](./changelogs/SNAPSHOT_CHANGELOG.md) diff --git a/gradle.properties b/gradle.properties index e97e012e..38a2a352 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ z# https://docs.gradle.org/current/userguide/build_environment.html # Disable with --no-build-cache org.gradle.caching=true +version=1.0.0-0 github=https://github.com/sekwah41/Advanced-Portals curse_project_id=86001 diff --git a/lang/build.gradle b/lang/build.gradle new file mode 100644 index 00000000..35a994dd --- /dev/null +++ b/lang/build.gradle @@ -0,0 +1,3 @@ +// Check the root build.gradle under allprojects for common settings + + diff --git a/core/src/main/resources/lang/de_DE.lang b/lang/src/main/resources/lang/de_DE.lang similarity index 100% rename from core/src/main/resources/lang/de_DE.lang rename to lang/src/main/resources/lang/de_DE.lang diff --git a/core/src/main/resources/lang/en_GB.lang b/lang/src/main/resources/lang/en_GB.lang similarity index 100% rename from core/src/main/resources/lang/en_GB.lang rename to lang/src/main/resources/lang/en_GB.lang diff --git a/core/src/main/resources/lang/fr_FR.lang b/lang/src/main/resources/lang/fr_FR.lang similarity index 100% rename from core/src/main/resources/lang/fr_FR.lang rename to lang/src/main/resources/lang/fr_FR.lang diff --git a/core/src/main/resources/lang/hu_HU.lang b/lang/src/main/resources/lang/hu_HU.lang similarity index 100% rename from core/src/main/resources/lang/hu_HU.lang rename to lang/src/main/resources/lang/hu_HU.lang diff --git a/settings.gradle b/settings.gradle index c685b0f9..fd148a49 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,6 +2,7 @@ rootProject.name = "advanced-portals" // Core modules include 'core' include 'api' +include 'lang' // Implementations include 'spigot' diff --git a/spigot/build.gradle b/spigot/build.gradle index 3e646870..d99752df 100644 --- a/spigot/build.gradle +++ b/spigot/build.gradle @@ -1,7 +1,4 @@ - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} +// Check the root build.gradle under allprojects for common settings configurations { // configuration that holds jars to copy into lib @@ -26,16 +23,3 @@ jar { it.isDirectory() ? it : zipTree(it) } } - -// Set SPIGOT_LOC to the location of your server and SPIGOT_JAR as the name of the jar file in the server you want to run -// DIReallyKnowWhatIAmDoingISwear is to remove the stupid pause spigot has at the start -task runJar() { - doLast { - javaexec { - main "-jar" - args "${System.env.MC_SERVER_LOC}\\${System.env.MC_SERVER_JAR}.jar" - jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-DIReallyKnowWhatIAmDoingISwear=true"] - workingDir "${System.env.MC_SERVER_LOC}" - } - } -} diff --git a/velocity/build.gradle b/velocity/build.gradle new file mode 100644 index 00000000..bbd24f51 --- /dev/null +++ b/velocity/build.gradle @@ -0,0 +1,25 @@ +// Check the root build.gradle under allprojects for common settings + +configurations { + // configuration that holds jars to copy into lib + includeLibs +} + +repositories { + maven { url "https://repo.maven.apache.org/maven2" } + maven { url "https://nexus.velocitypowered.com/repository/maven-public/" } +} + +// includeLibs just says to include the library in the final jar +dependencies { + implementation project(":core") + + implementation "com.velocitypowered:velocity-api:1.1.0-SNAPSHOT" + annotationProcessor "com.velocitypowered:velocity-api:1.1.0-SNAPSHOT" +} + +jar { + from configurations.includeLibs.collect { + it.isDirectory() ? it : zipTree(it) + } +}