mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #2926 from MartinTheDragon/maven-publishing
Configure maven publishing
This commit is contained in:
commit
1306abc0b0
3
.gitignore
vendored
3
.gitignore
vendored
@ -27,5 +27,8 @@
|
|||||||
# CurseForge configuration
|
# CurseForge configuration
|
||||||
/curseforge.properties
|
/curseforge.properties
|
||||||
|
|
||||||
|
# Maven configuration
|
||||||
|
/maven.properties
|
||||||
|
|
||||||
# Changelog backup
|
# Changelog backup
|
||||||
/changelog.bak
|
/changelog.bak
|
||||||
|
|||||||
20
README.md
20
README.md
@ -24,6 +24,26 @@ For further ports, try:
|
|||||||
|
|
||||||
Simply navigate to "Releases" on the right side of the page, download links for the compiled JAR as well as the corresponding source code are under the "Assets" category below the changelog. Make sure to review all changelogs when updating!
|
Simply navigate to "Releases" on the right side of the page, download links for the compiled JAR as well as the corresponding source code are under the "Assets" category below the changelog. Make sure to review all changelogs when updating!
|
||||||
|
|
||||||
|
## Using in your project
|
||||||
|
|
||||||
|
To include the mod as a dependency in a project of your own, you can adjust your Gradle buildscript according to the following example:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name "NTM Releases"
|
||||||
|
url "https://maven.ntmr.dev/releases"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
def ntmBuildNumber = "5687" // Change this value according to the release you wish to use
|
||||||
|
|
||||||
|
implementation "com.hbm:HBM-NTM:1.0.27_X${ntmBuildNumber}:dev"
|
||||||
|
compileOnly "com.hbm:HBM-NTM:1.0.27_X${ntmBuildNumber}:src"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
Tired of waiting until the next version comes out? Here is a tutorial on how to compile the very newest version yourself:
|
Tired of waiting until the next version comes out? Here is a tutorial on how to compile the very newest version yourself:
|
||||||
|
|||||||
101
build.gradle
101
build.gradle
@ -18,6 +18,7 @@ buildscript {
|
|||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
apply plugin: 'curseforge'
|
apply plugin: 'curseforge'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
|
||||||
if(Files.exists(Paths.get("curseforge.properties"))) {
|
if(Files.exists(Paths.get("curseforge.properties"))) {
|
||||||
@ -25,6 +26,10 @@ if(Files.exists(Paths.get("curseforge.properties"))) {
|
|||||||
ext.cfprops = parseConfig(file("curseforge.properties"))
|
ext.cfprops = parseConfig(file("curseforge.properties"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Files.exists(Paths.get("maven.properties"))) {
|
||||||
|
ext.mavenprops = parseConfig(file("maven.properties"))
|
||||||
|
}
|
||||||
|
|
||||||
def version_name = version = mod_version
|
def version_name = version = mod_version
|
||||||
if(!mod_build_number.isEmpty()) {
|
if(!mod_build_number.isEmpty()) {
|
||||||
version_name = mod_version + "_X" + mod_build_number
|
version_name = mod_version + "_X" + mod_build_number
|
||||||
@ -45,7 +50,7 @@ minecraft {
|
|||||||
eclipse.classpath.file.whenMerged { cp ->
|
eclipse.classpath.file.whenMerged { cp ->
|
||||||
// Find all codechicken source jars
|
// Find all codechicken source jars
|
||||||
def srcent = cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-src.jar") }
|
def srcent = cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-src.jar") }
|
||||||
|
|
||||||
// Remove them from classpath
|
// Remove them from classpath
|
||||||
cp.entries.removeAll srcent
|
cp.entries.removeAll srcent
|
||||||
|
|
||||||
@ -55,10 +60,10 @@ eclipse.classpath.file.whenMerged { cp ->
|
|||||||
def file = new File(entry.path)
|
def file = new File(entry.path)
|
||||||
srcmap.put(file.getName().replace("-src.jar", "-dev.jar"), file)
|
srcmap.put(file.getName().replace("-src.jar", "-dev.jar"), file)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create file reference factory
|
// Create file reference factory
|
||||||
def fileref = new FileReferenceFactory()
|
def fileref = new FileReferenceFactory()
|
||||||
|
|
||||||
// Find all codechicken development jars
|
// Find all codechicken development jars
|
||||||
cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry ->
|
cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry ->
|
||||||
File srcmapping = new File(entry.path) // Initialize the srcmapping from the dev jar path
|
File srcmapping = new File(entry.path) // Initialize the srcmapping from the dev jar path
|
||||||
@ -99,20 +104,20 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev'
|
implementation('codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev') { transitive = false }
|
||||||
compileOnly 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:src'
|
compileOnly('codechicken:CodeChickenCore:1.7.10-1.0.4.29:src') { transitive = false }
|
||||||
|
|
||||||
implementation 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev'
|
|
||||||
compileOnly 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:src'
|
|
||||||
|
|
||||||
implementation 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev'
|
|
||||||
compileOnly 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:src'
|
|
||||||
|
|
||||||
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
implementation('codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev') { transitive = false }
|
||||||
|
compileOnly('codechicken:CodeChickenLib:1.7.10-1.1.3.140:src') { transitive = false }
|
||||||
|
|
||||||
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
|
implementation('codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev') { transitive = false }
|
||||||
|
compileOnly('codechicken:NotEnoughItems:1.7.10-1.0.3.74:src') { transitive = false }
|
||||||
|
|
||||||
compileOnly "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev"
|
compileOnly("inventorytweaks:InventoryTweaks:1.59-dev:deobf") { transitive = false }
|
||||||
|
|
||||||
|
compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api") { transitive = false }
|
||||||
|
|
||||||
|
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta.56-GTNH:dev") { transitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@ -123,7 +128,7 @@ processResources {
|
|||||||
// replace stuff in mcmod.info, nothing else
|
// replace stuff in mcmod.info, nothing else
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include 'mcmod.info'
|
include 'mcmod.info'
|
||||||
|
|
||||||
// replace version and mcversion
|
// replace version and mcversion
|
||||||
filesMatching('mcmod.info') {
|
filesMatching('mcmod.info') {
|
||||||
// replace version, mcversion and credits
|
// replace version, mcversion and credits
|
||||||
@ -133,7 +138,7 @@ processResources {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
// copy everything else, thats not the mcmod.info
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
@ -147,6 +152,27 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task sourceJar(type: Jar) {
|
||||||
|
from sourceSets.main.allJava
|
||||||
|
|
||||||
|
classifier "src"
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes 'FMLAT': 'HBM_at.cfg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task devJar(type: Jar) {
|
||||||
|
from(sourceSets.main.output) {
|
||||||
|
include "**"
|
||||||
|
}
|
||||||
|
classifier "dev"
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes 'FMLAT': 'HBM_at.cfg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task version {
|
task version {
|
||||||
doFirst {
|
doFirst {
|
||||||
println project.version
|
println project.version
|
||||||
@ -179,6 +205,49 @@ if(Files.exists(Paths.get("curseforge.properties"))) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Files.exists(Paths.get("maven.properties"))) {
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
release(MavenPublication) {
|
||||||
|
artifactId archivesBaseName
|
||||||
|
version version_name
|
||||||
|
|
||||||
|
from components.java
|
||||||
|
|
||||||
|
artifact sourceJar {
|
||||||
|
classifier "src"
|
||||||
|
}
|
||||||
|
|
||||||
|
artifact devJar {
|
||||||
|
classifier "dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
pom.withXml {
|
||||||
|
// NTM doesn't really feature any special runtime dependencies anyone would need, so blast those away
|
||||||
|
def node = asNode()
|
||||||
|
def dependencies = node.get("dependencies")
|
||||||
|
node.remove(dependencies)
|
||||||
|
node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name "Nuggies"
|
||||||
|
url "https://maven.ntmr.dev/releases"
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username mavenprops.username
|
||||||
|
password mavenprops.password
|
||||||
|
}
|
||||||
|
authentication {
|
||||||
|
basic(BasicAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Properties file parsing helper
|
// Properties file parsing helper
|
||||||
static def parseConfig(File config) {
|
static def parseConfig(File config) {
|
||||||
config.withReader {
|
config.withReader {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user