Skip to content

Commit

Permalink
Make mod not depend on fabric api and bintray upload
Browse files Browse the repository at this point in the history
  • Loading branch information
OroArmor committed Jan 21, 2021
1 parent 0df99c9 commit 9d9ca87
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 26 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish to Bintray

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew bintrayUpload --parallel --stacktrace
env:
BINTRAY_USER: oroarmor
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ My goal in creating this library was to make an light-weight config library that
## How to include
Include my library in your mod by adding it to your `build.gradle` file.

Make sure jitpack is included in your repositiories section:
Make sure my bintray repo is included in your repositiories section:
```
repositories {
maven {
url = "https://jitpack.io"
url = "https://dl.bintray.com/oroarmor/oroarmor"
}
}
```
Then in your dependencies section add my library to the classpath and jar-in-jar it so that users dont have to download an extra file:

The current version is: ![](https://img.shields.io/github/v/tag/oroarmor/oro-config.svg)

```
dependencies {
modImplementation 'com.github.OroArmor:oro-config:-SNAPSHOT'
include 'com.github.OroArmor:oro-config:-SNAPSHOT'
modImplementation 'com.github.OroArmor:oro-config:${version}'
include 'com.github.OroArmor:oro-config:${version}'
}
```

Expand Down
41 changes: 26 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'maven-publish'
id 'com.jfrog.bintray' version "1.8.4"
}

repositories {
Expand Down Expand Up @@ -28,31 +29,20 @@ task runTestmodClient(type: RunClientTask) {


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}"

// Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// [
// "fabric-api-base",
// "fabric-command-api-v1",
// "fabric-resource-loader-v0"
// ].forEach {
// modImplementation(fabricApi.module(it, project.fabric_version))
// }
testmodCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modCompile("io.github.prospector:modmenu:1.14.6+build.31") {
exclude(module: "fabric-api")
}
modApi("me.shedaniel.cloth:config-2:4.8.3"){

modCompile("me.shedaniel.cloth:config-2:4.8.3") {
exclude(module: "fabric-api")
}

testImplementation 'junit:junit:4.13.1'

testmodCompile sourceSets.main.output
Expand Down Expand Up @@ -101,6 +91,10 @@ publishing {
artifact(sourcesJar) {
builtBy remapSourcesJar
}

archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
}
}

Expand All @@ -109,4 +103,21 @@ publishing {
// uncomment to publish to the local maven
// mavenLocal()
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ["mavenJava"]
publish = true
pkg {
repo = 'oroarmor'
name = rootProject.archives_base_name
userOrg = "oroarmor"
licenses = ['CC0-1.0']
vcsUrl = 'https://github.com/OroArmor/Oro-Config.git'
version {
name = rootProject.mod_version
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ org.gradle.jvmargs=-Xmx2G
loader_version=0.10.0+build.208

# Mod Properties
mod_version = 1.0.0
mod_version = 1.1.0
maven_group = com.oroarmor
archives_base_name = oro-config

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version= 0.22.1+build.409-1.16
fabric_version= 0.29.4+1.16
6 changes: 2 additions & 4 deletions src/main/java/com/oroarmor/config/command/ConfigCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.oroarmor.config.ConfigItemGroup;
import com.oroarmor.config.ConfigItem.Type;

import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.ClickEvent;
Expand All @@ -36,7 +35,7 @@
* @author Eli Orona
*
*/
public class ConfigCommand implements CommandRegistrationCallback {
public class ConfigCommand {

/**
* The config
Expand Down Expand Up @@ -127,9 +126,8 @@ protected int listItem(CommandContext<ServerCommandSource> c, ConfigItem<?> item
return 1;
}

@Override
public void register(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated) {
LiteralArgumentBuilder<ServerCommandSource> literalArgumentBuilder = literal(config.getID()).requires(p -> p.hasPermissionLevel(2)).executes(c -> listConfigGroups(c));
LiteralArgumentBuilder<ServerCommandSource> literalArgumentBuilder = literal(config.getID()).requires(p -> p.hasPermissionLevel(2)).executes(this::listConfigGroups);

for (ConfigItemGroup group : config.getConfigs()) {
parseConfigItemGroupCommand(literalArgumentBuilder, group);
Expand Down
Binary file modified src/main/resources/oro-config_icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void onInitialize() {

System.out.println(CONFIG);

CommandRegistrationCallback.EVENT.register(new ConfigCommand(CONFIG));
CommandRegistrationCallback.EVENT.register(new ConfigCommand(CONFIG)::register);
}

}

0 comments on commit 9d9ca87

Please sign in to comment.