Skip to content

Commit

Permalink
Switch to Architectury!
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbiros committed Jul 25, 2023
1 parent 2585aaf commit 2e2810d
Show file tree
Hide file tree
Showing 39 changed files with 875 additions and 502 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@ on: [pull_request, push, workflow_dispatch]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-2022]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
java-version: 17

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2

- name: Upload Fabric Artifacts
uses: actions/upload-artifact@v3
with:
name: fabric-artifacts
path: fabric/build/libs/

- name: Upload Forge Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
name: forge-artifacts
path: forge/build/libs/
127 changes: 107 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,120 @@
# gradle
# User-specific stuff
.idea/

.gradle/
build/
*.iml
*.ipr
*.iws

# IntelliJ
out/
classes/
# mpeltonen/sbt-idea plugin
.idea_modules/

# eclipse
# JIRA plugin
atlassian-ide-plugin.xml

*.launch
# Compiled class file
*.class

# idea
# Log file
*.log

.idea/
*.iml
*.ipr
*.iws
# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# vscode
# Linux trash folder which might appear on any partition or disk
.Trash-*

.settings/
.vscode/
bin/
.classpath
.project
# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# macos
# General
.DS_Store
.AppleDouble
.LSOverride

*.DS_Store
# Icon must end with two \r
Icon

# fabric
# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Cache of project
.gradletasknamecache

**/build/

# Common working directory
run/
fabric/run/
forge/run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Now I am trying to continue developing it.

### Special thanks
- LlamaLad7 from the Fabric Discord server: Thanks for helping CyborgCabbage with some mixin stuff!
- CyborgCabbage: Huge shoutout to you for creating this awesome mod in the first place!
- All the contributors: A big thank you to everyone who has contributed to the development of this mod! You rock!
- [CyborgCabbage](https://github.com/CyborgCabbage/): Huge shoutout to you for creating this awesome mod in the first place!
- [Juzz](https://github.com/Juuxel) from the Architectury Discord server: Thanks for helping with architectury!
- [All the contributors](https://github.com/Norbiros/emojitype/graphs/contributors): A big thank you to everyone who has contributed to the development of this mod! You rock!

### Links
- [Mod on CurseForge](https://legacy.curseforge.com/minecraft/mc-mods/emoji-type)
Expand Down
119 changes: 37 additions & 82 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,96 +1,51 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/"}
architectury {
minecraft = rootProject.minecraft_version
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
}
subprojects {
apply plugin: "dev.architectury.loom"

processResources {
inputs.property "version", project.version
loom {
silentMojangMappingsLicense()
}

filesMatching("fabric.mod.json") {
expand "version": project.version
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
}
}

tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/"}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
java {
withSourcesJar()
}
}
24 changes: 24 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
architectury {
common(project.enabled_platforms.split(","))
}

dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "me.shedaniel.cloth:cloth-config:${project.cloth_config_version}"
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
14 changes: 14 additions & 0 deletions common/src/main/java/dev/norbiros/emojitype/ConfigDirPlatform.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.norbiros.emojitype;

import dev.architectury.injectables.annotations.ExpectPlatform;

import java.nio.file.Path;

public class ConfigDirPlatform {

@ExpectPlatform
public static Path getConfigDirectory() {
// Just throw an error, the content should get replaced at runtime.
throw new AssertionError();
}
}
Loading

0 comments on commit 2e2810d

Please sign in to comment.