Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve project structure #152

Merged
merged 27 commits into from
Feb 9, 2024
Merged

Improve project structure #152

merged 27 commits into from
Feb 9, 2024

Conversation

thecatcore
Copy link
Member

@thecatcore thecatcore commented Feb 7, 2024

Structure changes:

Example for legacy-fabric-registry-sync-api-v1:

Previously

Split into common/legacy-fabric-registry-sync-api-v1, 1.8.9/legacy-fabric-registry-sync-api-v1, 1.7.10/legacy-fabric-registry-sync-api-v1, 1.8/legacy-fabric-registry-sync-api-v1, 1.9.4/legacy-fabric-registry-sync-api-v1 1.10.2/legacy-fabric-registry-sync-api-v1, 1.12.2/legacy-fabric-registry-sync-api-v1.
Each declares its dependencies individually in the subproject build.gradle.
Supported version range is hardcoded in fabric.mod.json.

1.10.2/legacy-fabric-registry-sync-api-v1/build.gradle

version = getSubprojectVersion(project)

moduleDependencies(project, [
		'common:legacy-fabric-api-base-common',
		'common:legacy-fabric-networking-api-v1-common',
		'common:legacy-fabric-registry-sync-api-v1-common',
		'common:legacy-fabric-resource-loader-v1-common',
		'1.8.9:legacy-fabric-api-base'
])

1.10.2/legacy-fabric-registry-sync-api-v1/src/main/resources/fabric.mod.json

{
  "schemaVersion": 1,
  "id": "legacy-fabric-registry-sync-api-v1",
  "name": "Legacy Fabric Registry Sync API (V1)",
  "version": "${version}",
  "environment": "*",
  "license": "Apache-2.0",
  "icon": "assets/legacy-fabric/icon.png",
  "contact": {
    "homepage": "https://legacyfabric.net/",
    "irc": "irc://irc.esper.net:6667/legacyfabric",
    "issues": "https://github.com/Legacy-Fabric/fabric/issues",
    "sources": "https://github.com/Legacy-Fabric/fabric"
  },
  "authors": [
    "Legacy-Fabric"
  ],
  "depends": {
    "fabricloader": ">=0.4.0",
    "minecraft": ">1.9.4 <=1.10.2"
  },
  "description": "Registry hooks",
  "entrypoints": {
    "preLaunch": [
      "net.legacyfabric.fabric.impl.registry.sync.RegistrySyncEarlyInitializer"
    ]
  },
  "mixins": [
    "legacy-fabric-registry-sync-api-v1.mixins.json"
  ],
  "custom": {
    "modmenu": {
      "badges": [ "library" ],
      "parent": {
        "id": "legacy-fabric-api",
        "name": "Legacy Fabric API",
        "badges": [ "library" ],
        "description": "Core API module providing key hooks and inter-compatibility features for Minecraft 1.7.10-1.12.2.",
        "icon": "assets/legacy-fabric/icon.png"
      }
    }
  }
}

Now

Split into legacy-fabric-registry-sync-api-v1/common, legacy-fabric-registry-sync-api-v1/1.7.10, legacy-fabric-registry-sync-api-v1/1.8, legacy-fabric-registry-sync-api-v1/1.8.9, legacy-fabric-registry-sync-api-v1/1.9.4, legacy-fabric-registry-sync-api-v1/1.10.2, legacy-fabric-registry-sync-api-v1/1.12.2.
A common build.gradle file in legacy-fabric-registry-sync-api-v1 to declare module dependencies, version specific dependencies are inferred from it.
If additional dependencies are needed declare them in the submodule build.gradle.
Each submodule contains a gradle.properties file, containing informations related to the support mc version range, which will be used when inferring module dependencies.

legacy-fabric-registry-sync-api-v1/build.gradle

moduleDependencies(project, [
"legacy-fabric-api-base",
"legacy-fabric-networking-api-v1",
"legacy-fabric-registry-sync-api-v1",
"legacy-fabric-resource-loader-v1"
])

legacy-fabric-registry-sync-api-v1/1.10.2/build.gradle

// Nothing

legacy-fabric-registry-sync-api-v1/1.10.2/gradle.properties

minVersionExcluded=1.9.4
maxVersionIncluded=1.10.2

legacy-fabric-registry-sync-api-v1/1.10.2/src/main/resources/fabric.mod.json

{
  "schemaVersion": 1,
  "id": "legacy-fabric-registry-sync-api-v1",
  "name": "Legacy Fabric Registry Sync API (V1)",
  "version": "${version}",
  "environment": "*",
  "license": "Apache-2.0",
  "icon": "assets/legacy-fabric/icon.png",
  "contact": {
    "homepage": "https://legacyfabric.net/",
    "irc": "irc://irc.esper.net:6667/legacyfabric",
    "issues": "https://github.com/Legacy-Fabric/fabric/issues",
    "sources": "https://github.com/Legacy-Fabric/fabric"
  },
  "authors": [
    "Legacy-Fabric"
  ],
  "depends": {
    "fabricloader": ">=0.4.0",
    "minecraft": "${minecraft_version}"
  },
  "description": "Registry hooks",
  "entrypoints": {
    "preLaunch": [
      "net.legacyfabric.fabric.impl.registry.sync.RegistrySyncEarlyInitializer"
    ]
  },
  "mixins": [
    "legacy-fabric-registry-sync-api-v1.mixins.json"
  ],
  "custom": {
    "modmenu": {
      "badges": [ "library" ],
      "parent": {
        "id": "legacy-fabric-api",
        "name": "Legacy Fabric API",
        "badges": [ "library" ],
        "description": "Core API module providing key hooks and inter-compatibility features for Minecraft 1.7.10-1.12.2.",
        "icon": "assets/legacy-fabric/icon.png"
      }
    }
  }
}

@thecatcore thecatcore changed the title Improve project structure + Update Loom, Gradle and dependencies Improve project structure Feb 8, 2024
@thecatcore thecatcore marked this pull request as ready for review February 8, 2024 13:53
@thecatcore thecatcore requested a review from BluCobalt February 8, 2024 13:53
@thecatcore
Copy link
Member Author

Ready for review

@thecatcore thecatcore requested a review from Grayray75 February 8, 2024 20:53
@thecatcore thecatcore merged commit 450251e into main Feb 9, 2024
2 checks passed
@thecatcore thecatcore deleted the feature/project-restructuration branch February 9, 2024 09:35
@thecatcore thecatcore added this to the 1.9.2 milestone May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants