Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Mar 21, 2024
0 parents commit c5c5cf1
Show file tree
Hide file tree
Showing 26 changed files with 1,212 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish-1.6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish 1.6

on:
push:
branches:
- "dev/1.6"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- uses: gradle/wrapper-validation-action@v4
- run: cd test-mod && ./gradlew build
- run: ./gradlew build publish --stacktrace
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
122 changes: 122 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
plugins {
id("java")
id("maven-publish")
id("java-gradle-plugin")
id("idea")
}

group = "babric"
base.archivesName = project.name
def baseVersion = "1.6"

def ENV = System.getenv()

if (ENV.containsKey("GITHUB_RUN_NUMBER")) {
version = baseVersion + "." + ENV["GITHUB_RUN_NUMBER"]
} else {
version= "${baseVersion}.local"
}

repositories {
maven { url = "https://maven.fabricmc.net/" }
maven {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
}
mavenCentral()
}

dependencies {
implementation(gradleApi())

implementation("net.fabricmc:fabric-loom:${baseVersion}-SNAPSHOT")
compileOnly("net.fabricmc:mapping-io:0.5.1")
api("babric:stitch:0.6.2-babric.1")

testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}

tasks.test {
useJUnitPlatform()
}

jar {
manifest {
attributes 'Implementation-Version': project.version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

toolchain {
languageVersion = JavaLanguageVersion.of(17)
}

withSourcesJar()
}

gradlePlugin {
plugins {
babricLoom {
id = 'babric-loom'
implementationClass = 'babric.BabricLoomPlugin'
}
}
}

import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node

publishing {
publications {
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'

from components.java
}

// Manually crate the plugin marker for snapshot versions
snapshotPlugin(MavenPublication) { publication ->
groupId 'babric-loom'
artifactId 'babric-loom.gradle.plugin'
version baseVersion + '-SNAPSHOT'

pom.withXml({
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
Element root = asElement()
Document document = root.getOwnerDocument()
Node dependencies = root.appendChild(document.createElement('dependencies'))
Node dependency = dependencies.appendChild(document.createElement('dependency'))
Node groupId = dependency.appendChild(document.createElement('groupId'))
groupId.setTextContent('babric')
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent('babric-loom')
Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT')
})
}
}
repositories {
maven {
if (ENV.MAVEN_URL) {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Mar 21 21:38:16 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit c5c5cf1

Please sign in to comment.