Giter Site home page Giter Site logo

plumygames / mgpp Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 3.0 1.65 MB

The next generation of Mindustry modding.

Home Page: https://plumygames.github.io/mgpp/

License: GNU General Public License v3.0

Java 2.50% Kotlin 96.49% Groovy 0.37% HTML 0.63%
gradle gradle-plugin mgpp mindustry mindustry-mod mod

mgpp's People

Contributors

electronicsarchiver avatar liplum avatar luacsharp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mgpp's Issues

Removed R class generator

Why?

  1. R class generator works only in some narrow use cases. In most cases, users can do them manually. Even I haven't used it yet.
  2. It's not flexible and extendable. Java doesn't have partial class feature like C#. Users cannot modify the R class.
  3. It makes spaghetti code. There are too much abstract layers, which highly increases the complexity.

[Feature Request] Json/JavaScript Mod `auto work with--fromTask`

Use cases

  1. In a multi-project mod, users want to test something on Json/JavaScript mod. However, when they run :runClient task, the Json/JavaScript mod isn't involving the mod work with--fromTask automatically as what jar does, that is, users have to add something like:
    add fromTask ":project:zip"
  2. If users are willing to use gradle and mgpp to develop Json/JavaScript mod, it's useful to start the game on their workspace in no time.

[v1.1.6] `deploy` cannot find renamed `jar` output

In my build.gradle:

tasks.jar {
    archiveBaseName.set("CyberIO")
}
* What went wrong:
Execution failed for task ':main:deploy'.
> Cannot expand ZIP '/home/runner/work/CyberIO/CyberIO/main/build/libs/main-4.0.jar' as it does not exist.

Can't fetch latest be version, so use 22767 as default instead.

When I tried using the latest Mindustry client, I got this.

mindustry {
    client {
        mindustry be latest
    }
}
Can't fetch latest be version, so use 22767 as default instead.
java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.github.com/repos/Anuken/MindustryBuilds/releases/latest
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
	at java.net.URL.openStream(URL.java:1067)
	at kotlin.io.TextStreamsKt.readBytes(ReadWrite.kt:150)
	at io.github.liplum.mindustry.IGameSpec$DefaultImpls.LatestBE(GameSpec.kt:110)
	at io.github.liplum.mindustry.ServerSpec.LatestBE(GameSpec.kt:184)
	at io.github.liplum.mindustry.IGameSpec$DefaultImpls.be(GameSpec.kt:70)
	at io.github.liplum.mindustry.ServerSpec.be(GameSpec.kt:184)
	at Build_gradle$2.execute(build.gradle.kts:29)
	at Build_gradle$2.execute(build.gradle.kts:4)
	at org.gradle.internal.extensibility.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:173)
	at org.gradle.internal.extensibility.ExtensionsStorage.configureExtension(ExtensionsStorage.java:64)
	at org.gradle.internal.extensibility.DefaultConvention.configure(DefaultConvention.java:194)
	at io.github.liplum.mindustry.Extension.mindustry(Extensions.kt:23)
	at Build_gradle.<init>(build.gradle.kts:24)

[v1.1.2] Assets batch will overwrite what existed before in `jar`

When I configured the assets batch, the content in jar task output will be overwritten.

mindustryAssets {
    sprites {
        dir = rootDir.resolve("sprites")
        dependsOn("antiAlias")
    }
    sprites {
        dir = rootDir.resolve("sprites/data")
        rootAt(rootDir.resolve("sprites"))
        dependsOn("antiAlias")
        genClass
    }
    sounds {
        dir = rootDir.resolve("sounds")
        genClass
    }
}

Support more resource generators.

Shader

It only needs the field without void load( ) method. Because users may have their own way to initialize those shaders.

Bundle

To generate each i18n pair in bundles.

Generate a Meta class from mod.[h]json.

Sometimes, users would forget their mod name or would like to reference the content in mod.json.
So I think the additional function could be useful for them.

[`mod works with`] `fromTask` can't locate a task in another project

That's how I used.

mods {
    worksWith {
         add fromTask ":js:zip"
    }
}

The excpetion:

* What went wrong:
Could not create task ':main:runClient'.
Task with name ':js:zip' not found in project ':main'.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not create task ':main:runClient'.
Task with name ':js:zip' not found in project ':main'.
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:388)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:137)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)
	at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:64)

Debug both client and server simultaneously

I want to test whether my mod could work on server side, but I can't start multiple debugging session, one for client, one for server.
As a workaround, I debug the server in intellij IDEA but start the game outside.
Is any way to debug both at the same time?

[v1.1.1] `mindustry be latest` doesn't fetch the latest

It hasn't checked the latest version yet since I ran runClient first time after the mgpp was upgraded to v1.1.1.
In my latest_cache.json:

[
  {
    "name": "mindustry-client-be",
    "lastValue": "22810",
    "lastUpdatedTimeStamp": 1657982383132
  },
  {
    "name": "mindustry-server-be",
    "lastValue": "22810",
    "lastUpdatedTimeStamp": 1657982383217
  }
]

But as you see, the true latest version is 22850 now.

[Feature Request] Gradle task for json&js mod

Proposal

If anyone would like to make a json&js mod with mgpp gradle plugin, they may need:

  • To package the mod.zip.

It's also used to build a Json mod, e.g. for testing purpose, in a multiple-mod project.

When java plugin isn't applied, the these task should be added.

[Feature Request] Make all modules download game once if they have the same version

My Issues
When I set the game location only in the root project, the game would be downloaded several times, however, they have the same version, which is a definitely waste of network data.

My solutions/needs
So I want them to be downloaded once if they have the same version, in other words, the game can be shared among all modules.

Share mindustry dependencies in multi-module project

I often make some mods that have many modules for decoupling and package management.
But in terms of my practice, I still have to configure the mindustry dependency and game version for each subproject. That's annoying and a bit difficult to keep them pace with other modules or the latest mindustry I'd like to work on.

A module can't apply mgpp in a multi-module project

Context

In its the build.gradle.kts, I added some dependencies from other modules in my while project.

plugins {
    kotlin("jvm")
    id("com.google.devtools.ksp") version "1.7.0-1.0.6"
    `maven-publish`
    id("io.github.liplum.mgpp")
}
...
dependencies {
    implementation(project(":annotations"))
    implementation(project(":lib"))
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
}

Problem

When I sync the gradle in my Intellij IDEA, the problem was ocurred.

Build file 'E:\MyProject\Mindustry\CyberIO\lib\build.gradle.kts' line: 2

An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.jvm', version: '1.6.21']
> Failed to apply plugin 'org.jetbrains.kotlin.jvm'.
   > Gradle#projectsEvaluated(Action) on build 'cyberio' cannot be executed in the current context.

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.jvm', version: '1.6.21']
...
at io.github.liplum.mindustry.MindustryJavaPlugin$apply$1$2$1.invoke(Plugins.kt:453)
	at io.github.liplum.mindustry.MindustryJavaPlugin$apply$1$2$1.invoke(Plugins.kt:275)
	at io.github.liplum.dsl.KtDslSupportKt$sam$i$org_gradle_api_Action$0.execute(KtDslSupport.kt)
	at org.gradle.api.internal.DefaultMutationGuard$2.execute(DefaultMutationGuard.java:44)
	at org.gradle.api.internal.DefaultMutationGuard$2.execute(DefaultMutationGuard.java:44)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection$ExistingNamedDomainObjectProvider.configure(DefaultNamedDomainObjectCollection.java:853)
	at org.gradle.api.internal.tasks.DefaultTaskCollection$ExistingTaskProvider.configure(DefaultTaskCollection.java:200)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.named(DefaultNamedDomainObjectCollection.java:391)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.named(DefaultTaskCollection.java:127)
	at io.github.liplum.mindustry.MindustryJavaPlugin$apply$1$2.invoke(Plugins.kt:452)
	at io.github.liplum.mindustry.MindustryJavaPlugin$apply$1$2.invoke(Plugins.kt:273)
	at io.github.liplum.dsl.DslExtensionsKt.afterEvaluateThis$lambda-1(DslExtensions.kt:99)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:123)

Caused by: org.gradle.api.internal.AbstractMutationGuard$IllegalMutationException: Gradle#projectsEvaluated(Action) on build 'cyberio' cannot be executed in the current context.
	at org.gradle.api.internal.AbstractMutationGuard.createIllegalStateException(AbstractMutationGuard.java:39)
	at org.gradle.api.internal.AbstractMutationGuard.assertMutationAllowed(AbstractMutationGuard.java:34)
	at org.gradle.invocation.DefaultGradle.assertProjectMutatingMethodAllow

My research

When I comment, aka remove, all implementation dependencies of other modules, such as implementation(project(":annotations")), it's solved.
But it's unacceptable, I need them.

[Feature Request] `mods.keepOtherMods` as default

My Issues
Mgpp will remove all other mods when I working on the default data directory, %APPDATA%/Mindustry/mods.

My solutions/needs

  • Keep mods.keepOtherMods default.
  • Overwrite it from local.properties

Rename `dot` name rule to `domain`

dot is confusing to represent a name rule.
As a convention, Java use reverse domain name notation, like org.plumy.foo.
By the way, matching name rule regardless of any letter case will be better.

[v1.1.2] Can't resolve v136 dependencies

When I tried to upgrade my dependency to v136

mindustry {
    dependency {
        mindustry version: 'v136'
        arc version: 'v136'
    }
}
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com.github.anuken.mindustry:desktop:v136.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/github/anuken/mindustry/desktop/v136/desktop-v136.pom
       - https://www.jitpack.io/com/github/anuken/mindustry/desktop/v136/desktop-v136.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Build a documentation page

As the more and more features are introduced in mgpp, the guideline is essential for users.

What we need

  1. A dynamic documentation page for switchable DSL.
  2. Detailed descriptive document for each task and configuration.

[Feature Request] Record local game location and data directory in local.properties

How

Read the local game location and data dir path from local.properties.

Why

When I work with someone on a project, we have diffierent opinions on where to save the data. For example:
They want to use the default data directory.

mindustry {
    run {
        setDataDefault()
    }
}

But I don't want that, because it will mess up my other saves and settings.

[Feature Request]Run game from local disk

Reasons

  1. Downloading game from the Internet all the time will incur a significant data overhead.
  2. Users have to await the downloading, so that maight be an issue if they could not access the Internet or that's forbidden in some places.
  3. Fast ๐Ÿš€๐Ÿš€๐Ÿš€
  4. If GitHub is dead.

[v1.1.12] Cannot `runClient` on macOS

Gradle Log

[W] Applying -XstartOnFirstThread for macOS support.

Since Mindustry is a libGDX project, the -XstartOnFirstThread is needed on macOS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.