diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ced72dc..b1ccf73 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,41 +1,40 @@ version: 2 registries: - maven-central: - type: maven-repository - url: https://repo.maven.apache.org/maven2/ - fabricmc: - type: maven-repository - url: https://maven.fabricmc.net/ - quiltmc: - type: maven-repository - url: https://maven.quiltmc.org/repository/release/ - parchment: - type: maven-repository - url: https://maven.parchmentmc.org/ - neoforge: - type: maven-repository - url: https://maven.neoforged.net/ + maven-central: + type: maven-repository + url: https://repo.maven.apache.org/maven2/ + fabricmc: + type: maven-repository + url: https://maven.fabricmc.net/ + quiltmc: + type: maven-repository + url: https://maven.quiltmc.org/repository/release/ + parchment: + type: maven-repository + url: https://maven.parchmentmc.org/ + neoforged: + type: maven-repository + url: https://maven.neoforged.net/ + lukebemish: + type: maven-repository + url: https://maven.lukebemish.dev/ + architectury: + type: maven-repository + url: https://maven.architectury.dev/ updates: - - package-ecosystem: "gradle" - directory: "/" - registries: - - maven-central - - fabricmc - - quiltmc - - parchment - - neoforge - schedule: - interval: "weekly" - ignore: - - dependency-name: "*modsdotgroovy*" - update-types: ["version-update:semver-major"] - - dependency-name: "com.mojang:minecraft" - update-types: ["version-update:semver-major"] - - dependency-name: "*neoforge*" - update-types: ["version-update:semver-major"] - - dependency-name: "org.quiltmc*" - update-types: ["version-update:semver-major"] - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" + - package-ecosystem: "gradle" + directory: "/" + registries: + - maven-central + - fabricmc + - quiltmc + - parchment + - neoforged + - lukebemish + - architectury + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml new file mode 100644 index 0000000..ed01916 --- /dev/null +++ b/.github/workflows/build_pr.yml @@ -0,0 +1,69 @@ +{ + "jobs": { + "build": { + "runs-on": "ubuntu-22.04", + "steps": [ + { + "name": "Setup Java", + "run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\"" + }, + { + "with": { + "fetch-depth": "0", + "persist-credentials": "false" + }, + "name": "Checkout", + "uses": "actions/checkout@v4" + }, + { + "with": { + "path": "**/.gradle/loom-cache", + "key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}", + "restore-keys": "${{ runner.os }}-gradle-" + }, + "name": "Cache", + "uses": "actions/cache/restore@v3" + }, + { + "with": { + "cache-read-only": true, + "gradle-home-cache-cleanup": true + }, + "name": "Setup Gradle", + "uses": "gradle/gradle-build-action@v2" + }, + { + "name": "Build", + "run": "./gradlew checkLicenses build", + "id": "build", + "env": { + "PR_NUMBER": "${{ github.event.pull_request.number }}" + } + }, + { + "name": "Publish", + "run": "./gradlew publish", + "id": "publish", + "env": { + "PR_NUMBER": "${{ github.event.pull_request.number }}" + } + }, + { + "with": { + "name": "artifacts", + "path": "build/repo" + }, + "name": "Archive Publishable Artifacts", + "uses": "actions/upload-artifact@v4" + } + ] + } + }, + "name": "Build PR", + "concurrency": "ci-${{ github.ref }}", + "on": { + "pull_request": { + + } + } +} \ No newline at end of file diff --git a/.github/workflows/publish_pr.yml b/.github/workflows/publish_pr.yml new file mode 100644 index 0000000..f194bfd --- /dev/null +++ b/.github/workflows/publish_pr.yml @@ -0,0 +1,56 @@ +{ + "jobs": { + "publish": { + "runs-on": "ubuntu-22.04", + "steps": [ + { + "with": { + "repository": "lukebemish/artifact-sync", + "ref": "refs/heads/main", + "persist-credentials": false + }, + "name": "Checkout Artifact Sync", + "uses": "actions/checkout@v4" + }, + { + "run": "mkdir repo" + }, + { + "with": { + "script": "const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};\nif (!pull_requests.length) {\n return core.error(\"This workflow doesn't match any pull requests!\");\n}\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));" + }, + "name": "Download Artifacts", + "uses": "actions/github-script@v7" + }, + { + "name": "Unpack Artifacts", + "run": "unzip repo.zip -d repo" + }, + { + "name": "Publish Artifacts", + "run": "python3 run.py", + "env": { + "MAVEN_USER": "github", + "MAVEN_PASSWORD": "${{ secrets.PR_MAVEN_PASSWORD }}", + "MAVEN_URL": "https://maven.lukebemish.dev/pullrequests/", + "ALLOWED_VERSION": "*-pr${{ github.event.workflow_run.pull_requests[0].number }}", + "ALLOWED_PATHS": "dev/lukebemish/dynamicassetgenerator/dynamicassetgenerator-*" + } + } + ], + "if": "${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}" + } + }, + "name": "Publish PR", + "concurrency": "ci-${{ github.ref }}", + "on": { + "workflow_run": { + "types": [ + "completed" + ], + "workflows": [ + "Build PR" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml deleted file mode 100644 index 5aa1637..0000000 --- a/.github/workflows/pullrequest.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Publish PR -on: - workflow_run: - workflows: [Test] - types: [completed] -jobs: - publish: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - repository: lukebemish/artifact-sync - ref: refs/heads/main - - run: mkdir repo - - name: 'Download artifact' - uses: actions/github-script@v6 - with: - script: | - const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }}; - if (!pull_requests.length) { - return core.error("This workflow doesn't match any pull requests!"); - } - - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "artifacts" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data)); - - name: 'Unzip artifacts' - run: unzip repo.zip -d repo - - name: 'Publish artifacts' - run: python3 run.py - env: - MAVEN_USER: github - MAVEN_PASSWORD: ${{ secrets.PR_MAVEN_PASSWORD }} - MAVEN_URL: "https://maven.lukebemish.dev/pullrequests/" - ALLOWED_VERSION: '*-pr${{ github.event.workflow_run.pull_requests[0].number }}' - ALLOWED_PATHS: "dev/lukebemish/defaultresources/defaultresources-*" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04e9368..7efefb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,88 @@ -name: Release -concurrency: ci-${{ github.ref }} -on: - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Setup Java - run: | - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: fregante/setup-git-user@v2 - - uses: actions/cache@v3 - with: - path: | - .gradle/quilt-loom-cache - .gradle/loom-cache - **/.gradle/caches - **/.gradle/repositories - **/build/neoForm - key: ${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle- - - uses: gradle/gradle-build-action@v2 - name: Setup Gradle - - name: Tag Release - run: | - ./gradlew tagRelease - - name: Build - run: | - ./gradlew checkLicenses build - - name: Publish - run: | - ./gradlew publish - env: - MAVEN_USER: github - MAVEN_PASSWORD: ${{ secrets.RELEASE_MAVEN_PASSWORD }} - MAVEN_URL: https://maven.lukebemish.dev/releases/ - - run: | - git push - git push --tags +{ + "jobs": { + "build": { + "runs-on": "ubuntu-22.04", + "permissions": { + "contents": "write" + }, + "steps": [ + { + "name": "Setup Java", + "run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\"" + }, + { + "with": { + "fetch-depth": "0" + }, + "name": "Checkout", + "uses": "actions/checkout@v4" + }, + { + "with": { + "path": "**/.gradle/loom-cache", + "key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}", + "restore-keys": "${{ runner.os }}-gradle-" + }, + "name": "Cache", + "uses": "actions/cache@v3" + }, + { + "with": { + "gradle-home-cache-cleanup": true + }, + "name": "Setup Gradle", + "uses": "gradle/gradle-build-action@v2" + }, + { + "uses": "fregante/setup-git-user@v2" + }, + { + "name": "Tag Release", + "run": "./gradlew tagRelease", + "id": "tag_release", + "env": { + "RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}", + "RELEASE_MAVEN_USER": "github", + "RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/", + "CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}", + "MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}" + } + }, + { + "name": "Build", + "run": "./gradlew checkLicenses build", + "id": "build", + "env": { + "RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}", + "RELEASE_MAVEN_USER": "github", + "RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/", + "CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}", + "MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}" + } + }, + { + "run": "git push && git push --tags" + }, + { + "name": "Publish", + "run": "./gradlew publish", + "id": "publish", + "env": { + "RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}", + "RELEASE_MAVEN_USER": "github", + "RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/", + "CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}", + "MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}" + } + } + ] + } + }, + "name": "Release", + "concurrency": "ci-${{ github.ref }}", + "on": { + "workflow_dispatch": { + + } + } +} \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index ac3ad5a..0aa2bf9 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -1,42 +1,70 @@ -name: Snapshot -concurrency: ci-${{ github.ref }} -on: - workflow_dispatch: - push: - branches: - - 1.* -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Setup Java - run: | - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: fregante/setup-git-user@v2 - - uses: actions/cache@v3 - with: - path: | - .gradle/quilt-loom-cache - .gradle/loom-cache - **/.gradle/caches - **/.gradle/repositories - **/build/neoForm - key: ${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle- - - uses: gradle/gradle-build-action@v2 - name: Setup Gradle - - name: Build - run: | - ./gradlew checkLicenses build - env: - SNAPSHOT_MAVEN_URL: https://maven.lukebemish.dev/snapshots/ - - name: Publish - run: | - ./gradlew publish - env: - MAVEN_USER: github - MAVEN_PASSWORD: ${{ secrets.SNAPSHOT_MAVEN_PASSWORD }} - SNAPSHOT_MAVEN_URL: https://maven.lukebemish.dev/snapshots/ +{ + "jobs": { + "build": { + "runs-on": "ubuntu-22.04", + "steps": [ + { + "name": "Setup Java", + "run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\"" + }, + { + "with": { + "fetch-depth": "0", + "persist-credentials": "false" + }, + "name": "Checkout", + "uses": "actions/checkout@v4" + }, + { + "with": { + "path": "**/.gradle/loom-cache", + "key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}", + "restore-keys": "${{ runner.os }}-gradle-" + }, + "name": "Cache", + "uses": "actions/cache/restore@v3" + }, + { + "with": { + "cache-read-only": true, + "gradle-home-cache-cleanup": true + }, + "name": "Setup Gradle", + "uses": "gradle/gradle-build-action@v2" + }, + { + "name": "Build", + "run": "./gradlew checkLicenses build", + "id": "build", + "env": { + "SNAPSHOT_MAVEN_PASSWORD": "${{ secrets.SNAPSHOT_MAVEN_PASSWORD }}", + "SNAPSHOT_MAVEN_USER": "github", + "SNAPSHOT_MAVEN_URL": "https://maven.lukebemish.dev/snapshots/" + } + }, + { + "name": "Publish", + "run": "./gradlew publish", + "id": "publish", + "env": { + "SNAPSHOT_MAVEN_PASSWORD": "${{ secrets.SNAPSHOT_MAVEN_PASSWORD }}", + "SNAPSHOT_MAVEN_USER": "github", + "SNAPSHOT_MAVEN_URL": "https://maven.lukebemish.dev/snapshots/" + } + } + ] + } + }, + "name": "Snapshot", + "concurrency": "ci-${{ github.ref }}", + "on": { + "workflow_dispatch": { + + }, + "push": { + "branches": [ + "1.*" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 9ec4641..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test -concurrency: ci-${{ github.ref }} -on: [workflow_dispatch, pull_request] -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Setup Java - run: | - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" - - uses: actions/checkout@v4 - with: - persist-credentials: false - fetch-depth: 0 - - uses: actions/cache/restore@v3 - with: - path: | - .gradle/quilt-loom-cache - .gradle/loom-cache - key: ${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle- - - uses: gradle/gradle-build-action@v2 - name: Setup Gradle - with: - cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') }} - - name: Build - run: | - ./gradlew checkLicenses build publish - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - - name: Archive publishable artifacts - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: build/repo diff --git a/FabriQuilt/build.gradle b/FabriQuilt/build.gradle deleted file mode 100644 index fe2cc56..0000000 --- a/FabriQuilt/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -plugins { - id 'maven-publish' -} - -apply plugin: 'fabric-loom' - -dependencies { - minecraft libs.minecraft - mappings loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip") - } - - modImplementation libs.fabric.loader - modImplementation libs.fabric.api - - compileOnly project(":Common") - - compileOnly libs.autoservice - annotationProcessor libs.autoservice -} - -loom { - runs { - client { - client() - setConfigName("Quilt Client") - ideConfigGenerated(true) - runDir("run") - } - server { - server() - setConfigName("Quilt Server") - ideConfigGenerated(true) - runDir("runserver") - } - } - - mixin { - defaultRefmapName = "defaultresources.refmap.json" - } -} - -processResources { - from project(":Common").sourceSets.main.resources -} - -tasks.named('compileJava',JavaCompile).configure { - source(project(":Common").sourceSets.main.allSource) -} - -sourcesJar { - from project(":Common").sourceSets.main.allSource -} - -javadocJar { - from project(":Common").sourceSets.main.allJava -} - -jar { - from("LICENSE") { - rename { "${it}_${mod_name}" } - } -} - -tasks.jar.finalizedBy(tasks.remapJar) - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifactId base.archivesName.get() - } - } - - repositories { - } -} diff --git a/NeoForge/build.gradle b/NeoForge/build.gradle deleted file mode 100644 index 1f3b6f2..0000000 --- a/NeoForge/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -plugins { - alias libs.plugins.neogradle.userdev - alias libs.plugins.neogradle.mixin - //alias libs.plugins.librarian -} - -runs { - configureEach { - systemProperty 'forge.logging.console.level', 'debug' - modSource project.sourceSets.main - //modSource project(':Common').sourceSets.main - } - - client { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - server { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' - } -} - -sourceSets.main.resources.srcDir 'src/generated/resources' - -dependencies { - implementation libs.neoforge - - compileOnly project(":Common") - - compileOnly libs.autoservice - annotationProcessor libs.autoservice -} - -mixin { - //add project(":Common").sourceSets.main, 'defaultresources.refmap.json' - //config 'mixin.defaultresources.json' - configs.add 'mixin.defaultresources.json' -} - -tasks.named('compileJava',JavaCompile).configure { - source(project(":Common").sourceSets.main.allSource) -} - - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper - -processResources { - from project(":Common").sourceSets.main.resources - - doLast { - fileTree(dir: outputs.files.asPath, include: "mixin.*.json").each { File file -> - def obj = new JsonSlurper().parse(file) - if (obj.refmap) { - obj.remove('refmap') - } - file.text = JsonOutput.toJson(obj) - } - } -} - -sourcesJar { - from project(":Common").sourceSets.main.allSource -} - -javadocJar { - from project(":Common").sourceSets.main.allJava -} - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifactId base.archivesName.get() - } - } -} diff --git a/build.gradle b/build.gradle index c238613..893350e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,65 @@ plugins { alias libs.plugins.quilt.licenser apply false alias libs.plugins.mdg.plugin - alias libs.plugins.fabric.loom apply false alias libs.plugins.managedversioning + alias libs.plugins.architectury.loom apply false } managedVersioning { versionFile.set rootProject.file('version.properties') metadataVersion.set libs.versions.minecraft - if (System.getenv('PR_NUMBER')) { - suffix.set("pr${System.getenv('PR_NUMBER')}") - } else if (System.getenv('SNAPSHOT_MAVEN_URL')) { - suffix.set('SNAPSHOT') + versionPRs() + versionSnapshots() + + gitHubActions { + snapshot { + prettyName.set 'Snapshot' + workflowDispatch.set(true) + onBranches.add '1.*' + gradleJob { + name.set 'build' + gradlew 'Build', 'checkLicenses', 'build' + gradlew 'Publish', 'publish' + mavenSnapshot('github') + } + } + release { + prettyName.set 'Release' + workflowDispatch.set(true) + gradleJob { + name.set 'build' + step { + setupGitUser() + } + readOnly.set false + gradlew 'Tag Release', 'tagRelease' + gradlew 'Build', 'checkLicenses', 'build' + step { + run.set 'git push && git push --tags' + } + gradlew 'Publish', 'publish' + mavenRelease('github') + modPublishing() + } + } + build_pr { + prettyName.set 'Build PR' + pullRequest.set(true) + gradleJob { + name.set 'build' + gradlew 'Build', 'checkLicenses', 'build' + gradlew 'Publish', 'publish' + pullRequestArtifact() + } + } + publish_pr { + prettyName.set 'Publish PR' + publishPullRequestAction( + 'github', + 'dev/lukebemish/dynamicassetgenerator/dynamicassetgenerator-*', + 'Build PR' + ) + } } } @@ -19,13 +67,24 @@ managedVersioning.apply() println "Building: $version" +configurations { + license { + canBeResolved = false + canBeConsumed = true + } +} + +artifacts { + add 'license', file("LICENSE") +} + modsDotGroovy { dslVersion = libs.versions.mdg.dsl.get() platform 'multiloader' multiloader { - forge = [project(":NeoForge")] - fabric = [project(":FabriQuilt")] - quilt = [project(":FabriQuilt")] + forge = [project(":neoforge")] + fabric = [project(":fabriquilt")] + quilt = [] } } @@ -34,18 +93,10 @@ subprojects { p -> apply plugin: 'java-library' apply plugin: libs.plugins.quilt.licenser.get().pluginId - group = rootProject.group - version = rootProject.version - base.archivesName = "${rootProject.name}-${p.name.toLowerCase(Locale.ROOT)}-${libs.versions.minecraft.get()}" - java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.withSourcesJar() java.withJavadocJar() - javadoc { - include "**/api/**" - } - license { rule rootProject.file('header.txt') exclude '**/*.mcmeta' @@ -55,60 +106,13 @@ subprojects { p -> jar { manifest { attributes([ - 'Specification-Title' : mod_name, - 'Specification-Vendor' : mod_author, - 'Specification-Version' : rootProject.version, - 'Implementation-Title' : "$mod_name - ${project.name}", - 'Implementation-Version' : rootProject.version, - 'Implementation-Vendor' : mod_author, 'Implementation-Commit-Time': managedVersioning.timestamp.get(), - 'Implementation-Commit': managedVersioning.hash.get(), - 'Build-On-Minecraft' : libs.versions.minecraft.get(), + 'Implementation-Commit': managedVersioning.hash.get() ]) } } - repositories { - mavenCentral() - - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - - maven { - name 'Quilt (Release)' - url 'https://maven.quiltmc.org/repository/release/' - } - } - - dependencies { - compileOnly libs.jetbrains.annotations - compileOnly libs.jspecify - } - - tasks.withType(JavaCompile).configureEach { - it.options.encoding = 'UTF-8' - it.options.release = 17 - } - - publishing { - repositories { - if (System.getenv('PR_NUMBER')) { - maven { - name = 'LocalMaven' - url = rootProject.layout.buildDirectory.dir('repo') - } - } else if (System.getenv('MAVEN_PASSWORD')) { - maven { - name = 'PersonalMaven' - url = uri(System.getenv('SNAPSHOT_MAVEN_URL') ?: System.getenv('MAVEN_URL')) - credentials { - username = System.getenv('MAVEN_USER') - password = System.getenv('MAVEN_PASSWORD') - } - } - } - } - } + managedVersioning.publishing.mavenPulLRequest(publishing) + managedVersioning.publishing.mavenSnapshot(publishing) + managedVersioning.publishing.mavenRelease(publishing) } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..6784052 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,3 @@ +plugins { + id 'groovy-gradle-plugin' +} diff --git a/buildSrc/src/main/groovy/convention.consumer.gradle b/buildSrc/src/main/groovy/convention.consumer.gradle new file mode 100644 index 0000000..dc873b8 --- /dev/null +++ b/buildSrc/src/main/groovy/convention.consumer.gradle @@ -0,0 +1,40 @@ +plugins { + id 'convention.shared' +} + +configurations { + commonJava{ + canBeResolved = true + } + commonResources{ + canBeResolved = true + } +} + +dependencies { + compileOnly project(':common') + commonJava project(path: ':common', configuration: 'commonJava') + commonResources project(path: ':common', configuration: 'commonResources') +} + +tasks.named('compileJava', JavaCompile) { + dependsOn(configurations.commonJava) + source(configurations.commonJava) +} + +processResources { + dependsOn(configurations.commonResources) + from(configurations.commonResources) +} + +tasks.named('javadoc', Javadoc).configure { + dependsOn(configurations.commonJava) + source(configurations.commonJava) +} + +tasks.named("sourcesJar", Jar) { + dependsOn(configurations.commonJava) + from(configurations.commonJava) + dependsOn(configurations.commonResources) + from(configurations.commonResources) +} diff --git a/buildSrc/src/main/groovy/convention.shared.gradle b/buildSrc/src/main/groovy/convention.shared.gradle new file mode 100644 index 0000000..e87626b --- /dev/null +++ b/buildSrc/src/main/groovy/convention.shared.gradle @@ -0,0 +1,77 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'idea' +} + +version = rootProject.version +group = rootProject.group + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) +java.withSourcesJar() +java.withJavadocJar() + +javadoc { + include "**/api/**" +} + +base { + archivesName = "${artifact_id}-${project.name}-${libs.versions.minecraft.get()}" +} + +repositories { + mavenCentral() + maven { + name = 'Architectury' + url "https://maven.architectury.dev/" + } + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } +} + +configurations { + rootProjectLicense.canBeResolved = true +} + +dependencies { + compileOnly libs.jetbrains.annotations + compileOnly libs.jspecify + rootProjectLicense project(path: ':', configuration: 'license') +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + artifactId base.archivesName.get() + from components.java + } + } +} + +sourcesJar { + dependsOn(configurations.rootProjectLicense) + from(configurations.rootProjectLicense) { + rename { "${it}_${artifact_id}" } + } +} + +jar { + dependsOn(configurations.rootProjectLicense) + from(configurations.rootProjectLicense) { + rename { "${it}_${artifact_id}" } + } + + manifest { + attributes([ + 'Specification-Title' : mod_name, + 'Specification-Vendor' : mod_author, + 'Specification-Version' : rootProject.version, + 'Implementation-Title' : "$mod_name - ${project.name}", + 'Implementation-Version' : rootProject.version, + 'Implementation-Vendor' : mod_author, + 'Built-On-Minecraft' : libs.versions.minecraft.get() + ]) + } +} diff --git a/Common/build.gradle b/common/build.gradle similarity index 55% rename from Common/build.gradle rename to common/build.gradle index 3c161c9..ce5151a 100644 --- a/Common/build.gradle +++ b/common/build.gradle @@ -1,8 +1,18 @@ plugins { - id 'maven-publish' + id 'convention.shared' + alias libs.plugins.architectury.loom } -apply plugin: 'fabric-loom' +configurations { + commonJava { + canBeResolved = false + canBeConsumed = true + } + commonResources { + canBeResolved = false + canBeConsumed = true + } +} loom { runConfigs.configureEach { @@ -10,35 +20,21 @@ loom { } } -configurations { - testCompileOnly.extendsFrom(compileOnly) +import net.fabricmc.loom.task.AbstractRemapJarTask +tasks.withType(AbstractRemapJarTask).each { + it.targetNamespace = "named" } dependencies { - minecraft libs.minecraft mappings loom.layered() { officialMojangMappings() parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip") } - //DO NOT USE IN PROJECT - //Provides necessary stuff for project to compile - modCompileOnly libs.fabric.loader -} - -import net.fabricmc.loom.task.AbstractRemapJarTask - -tasks.withType(AbstractRemapJarTask).each { - it.targetNamespace = "named" + minecraft libs.minecraft + modImplementation libs.fabric.loader } -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifactId base.archivesName.get() - } - } - - repositories { - } +artifacts { + commonJava sourceSets.main.java.sourceDirectories.singleFile + commonResources sourceSets.main.resources.sourceDirectories.singleFile } diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/api/GlobalResourceManager.java b/common/src/main/java/dev/lukebemish/defaultresources/api/GlobalResourceManager.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/api/GlobalResourceManager.java rename to common/src/main/java/dev/lukebemish/defaultresources/api/GlobalResourceManager.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/api/package-info.java b/common/src/main/java/dev/lukebemish/defaultresources/api/package-info.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/api/package-info.java rename to common/src/main/java/dev/lukebemish/defaultresources/api/package-info.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataFilePackResources.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataFilePackResources.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataFilePackResources.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataFilePackResources.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataPathPackResources.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataPathPackResources.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataPathPackResources.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/AutoMetadataPathPackResources.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/CombinedResourceManager.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/CombinedResourceManager.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/CombinedResourceManager.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/CombinedResourceManager.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/Config.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/Config.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/Config.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/Config.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResources.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResources.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResources.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResources.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResourcesMetadataSection.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResourcesMetadataSection.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResourcesMetadataSection.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/DefaultResourcesMetadataSection.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/ModMetaFile.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/ModMetaFile.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/ModMetaFile.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/ModMetaFile.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/Services.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/Services.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/Services.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/Services.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/WrappingResourceManager.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/WrappingResourceManager.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/WrappingResourceManager.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/WrappingResourceManager.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/mixin/ResourceAccessor.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/mixin/ResourceAccessor.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/mixin/ResourceAccessor.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/mixin/ResourceAccessor.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/package-info.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/package-info.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/package-info.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/package-info.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/services/Platform.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/services/Platform.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/services/Platform.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/services/Platform.java diff --git a/Common/src/main/java/dev/lukebemish/defaultresources/impl/services/package-info.java b/common/src/main/java/dev/lukebemish/defaultresources/impl/services/package-info.java similarity index 100% rename from Common/src/main/java/dev/lukebemish/defaultresources/impl/services/package-info.java rename to common/src/main/java/dev/lukebemish/defaultresources/impl/services/package-info.java diff --git a/Common/src/main/resources/mixin.defaultresources.json b/common/src/main/resources/mixin.defaultresources.json similarity index 100% rename from Common/src/main/resources/mixin.defaultresources.json rename to common/src/main/resources/mixin.defaultresources.json diff --git a/Common/src/main/resources/mods.groovy b/common/src/main/resources/mods.groovy similarity index 70% rename from Common/src/main/resources/mods.groovy rename to common/src/main/resources/mods.groovy index 911ea7d..b37e124 100644 --- a/Common/src/main/resources/mods.groovy +++ b/common/src/main/resources/mods.groovy @@ -1,3 +1,5 @@ +import modsdotgroovy.Dependency + /* * Copyright (C) 2023 Luke Bemish, and contributors * SPDX-License-Identifier: LGPL-3.0-or-later @@ -40,6 +42,23 @@ ModsDotGroovy.make { } } } + + dependencies = dependencies.collect {dep -> + new Dependency() { + @Override + Map asForgeMap() { + def map = super.asForgeMap() + map.remove('mandatory') + map.put('type', this.mandatory ? 'required' : 'optional') + } + }.tap { + it.modId = dep.modId + it.mandatory = dep.mandatory + it.versionRange = dep.versionRange + it.ordering = dep.ordering + it.side = dep.side + } + } } onFabric { mixin = [ @@ -47,4 +66,9 @@ ModsDotGroovy.make { 'mixin.defaultresources.json' ] } + onForge { + mixins = [ + ['config':'mixin.defaultresources.json'] + ] + } } diff --git a/fabriquilt/build.gradle b/fabriquilt/build.gradle new file mode 100644 index 0000000..4adc5fe --- /dev/null +++ b/fabriquilt/build.gradle @@ -0,0 +1,37 @@ +plugins { + id 'convention.consumer' + alias libs.plugins.architectury.loom +} + +dependencies { + mappings loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip") + } + minecraft libs.minecraft + modImplementation libs.fabric.loader + modImplementation libs.fabric.api + + compileOnly libs.autoservice + annotationProcessor libs.autoservice +} + +loom { + mixin { + defaultRefmapName = "defaultresources.refmap.json" + } + runs { + client { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + runDir("run") + } + server { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + runDir("runserver") + } + } +} diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuilt.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuilt.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuilt.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuilt.java diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuiltClient.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuiltClient.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuiltClient.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/DefaultResourcesFabriQuiltClient.java diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/PlatformImpl.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/PlatformImpl.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/PlatformImpl.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/PlatformImpl.java diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/ResourceLoader.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/ResourceLoader.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/ResourceLoader.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/ResourceLoader.java diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/mixin/MultiPackResourceManagerMixin.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/mixin/MultiPackResourceManagerMixin.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/mixin/MultiPackResourceManagerMixin.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/mixin/MultiPackResourceManagerMixin.java diff --git a/FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/package-info.java b/fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/package-info.java similarity index 100% rename from FabriQuilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/package-info.java rename to fabriquilt/src/main/java/dev/lukebemish/defaultresources/impl/fabriquilt/package-info.java diff --git a/FabriQuilt/src/main/resources/mixin.defaultresources.fabriquilt.json b/fabriquilt/src/main/resources/mixin.defaultresources.fabriquilt.json similarity index 100% rename from FabriQuilt/src/main/resources/mixin.defaultresources.fabriquilt.json rename to fabriquilt/src/main/resources/mixin.defaultresources.fabriquilt.json diff --git a/gradle.properties b/gradle.properties index ff8e132..31c9096 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,7 @@ group=dev.lukebemish.defaultresources mod_name=Default Resources mod_author=Luke Bemish mod_id=defaultresources +artifact_id=defaultresources # Gradle org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3052791..15e2745 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,27 +1,24 @@ [versions] -minecraft = "1.20.2" -parchment_minecraft = "1.20.1" -parchment_mappings = "2023.08.20" +minecraft = "1.20.4" +parchment_minecraft = "1.20.2" +parchment_mappings = "2023.12.10" -neoforge = "20.2.8-beta" +neoforge = "20.4.80-beta" -fabric_loader = "0.14.24" -fabric_api = "0.90.4+1.20.2" +fabric_loader = "0.15.3" +fabric_api = "0.92.1+1.20.4" -mdg_plugin = "1.4.1" +mdg_plugin = "1.4.3" mdg_dsl = "1.5.1" autoservice = "1.1.1" -fabric_loom = "1.4.4" +architectury_loom = "1.4.373" quilt_licenser = "2.0.1" -neogradle = "7.0.8" -#librarian = "1.2.0" - jetbrains_annotations = "24.0.1" jspecify = "0.3.0" -managedversioning = "1.0.0" +managedversioning = "1.2.3" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } @@ -40,8 +37,5 @@ autoservice = { module = "com.google.auto.service:auto-service", version.ref = " managedversioning = { id = "dev.lukebemish.managedversioning", version.ref = "managedversioning" } mdg_plugin = { id = "org.groovymc.modsdotgroovy", version.ref = "mdg_plugin" } -fabric_loom = { id = "fabric-loom", version.ref = "fabric_loom" } quilt_licenser = { id = "org.quiltmc.gradle.licenser", version.ref = "quilt_licenser" } -neogradle_userdev = { id = "net.neoforged.gradle.userdev", version.ref = "neogradle" } -neogradle_mixin = { id = "net.neoforged.gradle.mixin", version.ref = "neogradle" } -#librarian = { id = "org.parchmentmc.librarian.forgegradle", version.ref = "librarian" } +architectury_loom = { id = "dev.architectury.loom", version.ref = "architectury_loom" } diff --git a/neoforge/build.gradle b/neoforge/build.gradle new file mode 100644 index 0000000..4c6f982 --- /dev/null +++ b/neoforge/build.gradle @@ -0,0 +1,54 @@ +plugins { + id 'convention.consumer' + alias libs.plugins.architectury.loom +} + +repositories { + maven { + name = 'NeoForged' + url = 'https://maven.neoforged.net/' + } +} + +dependencies { + minecraft libs.minecraft + neoForge libs.neoforge + mappings loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip") + } + + compileOnly libs.autoservice + annotationProcessor libs.autoservice +} + +loom { + runs { + client { + client() + setConfigName("NeoForge Client") + ideConfigGenerated(true) + runDir("run") + } + server { + server() + setConfigName("NeoForge Server") + ideConfigGenerated(true) + runDir("runserver") + } + } +} + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +processResources { + doLast { + fileTree(dir: outputs.files.asPath, include: "mixin.*.json").each { File file -> + def obj = new JsonSlurper().parse(file) + if (obj.refmap) { + obj.remove('refmap') + } + file.text = JsonOutput.toJson(obj) + } + } +} diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties new file mode 100644 index 0000000..7da18ea --- /dev/null +++ b/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge diff --git a/NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/DefaultResourcesNeoForge.java b/neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/DefaultResourcesNeoForge.java similarity index 100% rename from NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/DefaultResourcesNeoForge.java rename to neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/DefaultResourcesNeoForge.java diff --git a/NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/PlatformImpl.java b/neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/PlatformImpl.java similarity index 100% rename from NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/PlatformImpl.java rename to neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/PlatformImpl.java diff --git a/NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/package-info.java b/neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/package-info.java similarity index 100% rename from NeoForge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/package-info.java rename to neoforge/src/main/java/dev/lukebemish/defaultresources/impl/neoforge/package-info.java diff --git a/NeoForge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta similarity index 100% rename from NeoForge/src/main/resources/pack.mcmeta rename to neoforge/src/main/resources/pack.mcmeta diff --git a/settings.gradle b/settings.gradle index a940720..1a57bb0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,8 +20,8 @@ pluginManagement { } maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' + name = 'Architectury' + url "https://maven.architectury.dev/" } mavenCentral() @@ -29,5 +29,50 @@ pluginManagement { } } +plugins { + id 'com.gradle.enterprise' version '3.16.1' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + +gradleEnterprise { + if (System.getenv('CI') != null) { + buildScan { + publishAlways() + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } + } +} + rootProject.name = 'defaultresources' -include("Common", "NeoForge", "FabriQuilt") +include("common", "neoforge", "fabriquilt") + +buildCache { + if (providers.gradleProperty('buildCacheUrl').orNull) { + remote(HttpBuildCache) { + url = providers.gradleProperty('buildCacheUrl').orNull + credentials { + username = providers.gradleProperty('buildCacheUser').orNull + password = providers.gradleProperty('buildCachePassword').orNull + } + if (providers.gradleProperty('buildCachePush').orNull) { + push = true + } else { + push = false + } + } + } else if (System.getenv('BUILD_CACHE_URL')) { + remote(HttpBuildCache) { + url = System.getenv('BUILD_CACHE_URL') + credentials { + username = System.getenv('BUILD_CACHE_USER') + password = System.getenv('BUILD_CACHE_PASSWORD') + } + if (System.getenv('BUILD_CACHE_PUSH') || System.getenv('CI')) { + push = true + } else { + push = false + } + } + } +}