architectury / architectury-templates

Downloads to template mods to set-up architectury mods.
72 stars 9 forks source link

:common resources are not included when running via IDE #28

Closed MattSturgeon closed 9 months ago

MattSturgeon commented 9 months ago

The sourceJar task adds sources & resources from the :common project, however nothing does this when running via IDE run tasks or (I assume) the runClient gradle task.

This means resources (such as icons and textures) are missing when debugging.

Oddly, i18n still seems to work, despite lang files also being missing from the build, which is odd...

Workaround

Original workaround

I'm currently "fixing" this by manually tweaking the sourceSet: ```groovy sourceSets { main { resources { resources.srcDir tasks.getByPath(":common:processResources").outputs } } } ``` But that means I end up having to set `DuplicatesStrategy.EXCLUDE` in `sourcesJar`'s `commonSources` map, which feels a bit hacky.

EDIT: the workaround above breaks production's mixin refMaps, I ended up moving all my assets into a separate source set, and include that instead:

// common bulid.gradle
sourceSets {
    assets {
        java.srcDirs = []
    }
}

// forge/fabric build.gradle
sourceSets {
    main {
        resources {
            resources.srcDir tasks.getByPath(":common:processAssetsResources").outputs
        }
    }
}

This works in production and also doesn't need the sourcesJar workaround.

MattSturgeon commented 9 months ago

Not sure why I was having issues before, but I've tested my original code again without the workaround and everything is working fine now.

Other than the mod icon being missing from the mod menu, this issue appears to be invalid.