Skip to content

Commit

Permalink
build: Move to publishing with gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonIT committed Jan 4, 2024
1 parent f7de0fd commit 02e7449
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 176 deletions.
10 changes: 0 additions & 10 deletions .maven.settings

This file was deleted.

16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Box2DLights

[![GitHub Actions Build Status](https://img.shields.io/github/actions/workflow/status/libgdx/box2dlights/gradle.yml?branch=master&label=GitHub%20Actions)](https://github.com/libgdx/libgdx/actions?query=workflow%3A%22Build+and+Publish%22)

[![Latest Version](https://img.shields.io/nexus/r/com.badlogicgames.box2dlights/box2dlights?nexusVersion=2&server=https%3A%2F%2Foss.sonatype.org&label=Version)](https://search.maven.org/artifact/com.badlogicgames.box2dlights/box2dlights)
[![Snapshots](https://img.shields.io/nexus/s/com.badlogicgames.box2dlights/box2dlights?server=https%3A%2F%2Foss.sonatype.org&label=Snapshots)](https://oss.sonatype.org/#nexus-search;gav~com.badlogicgames.box2dlights~box2dlights~~~~kw,versionexpand)

[![screenshot](http://img.youtube.com/vi/lfT8ajGbzk0/0.jpg)](http://www.youtube.com/watch?v=lfT8ajGbzk0)

Kalle Hameleinen's Box2DLights is a 2D lighting framework that uses [box2d](http://box2d.org/) for raycasting and OpenGL ES 2.0 for rendering. This library is intended to be used with [libgdx](http://libgdx.com).
Expand Down
53 changes: 50 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ sourceSets {
java {
srcDirs = ["src"]
}
resources {
srcDirs = ["res"]
}
}
test {
java {
Expand All @@ -15,17 +18,61 @@ sourceSets {
}
}

ext.gdxVersion = "1.9.11"
version = "1.6-SNAPSHOT"
ext {
gdxVersion = "1.9.11"

isReleaseBuild = {
return project.hasProperty("RELEASE")
}

getReleaseRepositoryUrl = {
return project.hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

getSnapshotRepositoryUrl = {
return project.hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

getRepositoryUsername = {
return project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

getRepositoryPassword = {
return project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
}

version project.getProperty('version') + (isReleaseBuild() ? "" : "-SNAPSHOT")

java {
sourceCompatibility = 1.7
targetCompatibility = 1.7

withJavadocJar()
withSourcesJar()
}

repositories {
mavenLocal()
mavenCentral()
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

tasks.withType(Test).configureEach {
systemProperty 'file.encoding', 'UTF-8'
}

dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}

apply from: rootProject.file('publish.gradle')
26 changes: 0 additions & 26 deletions build.xml

This file was deleted.

12 changes: 12 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
group=com.badlogicgames.box2dlights
version=1.6
POM_DESCRIPTION=2D real-time lighting using box2d
POM_NAME=Box2dlights
POM_URL=https://github.com/libgdx/box2dlights
POM_ISSUE_URL=https://github.com/libgdx/box2dlights/issues
POM_SCM_URL=https://github.com/libgdx/box2dlights
POM_SCM_CONNECTION=scm:git:https://github.com/libgdx/box2dlights.git
POM_SCM_DEV_CONNECTION=scm:git:https://github.com/libgdx/box2dlights.git
POM_LICENCE_NAME=Apache Licence 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0
POM_LICENCE_DIST=repo
121 changes: 0 additions & 121 deletions pom.xml

This file was deleted.

72 changes: 72 additions & 0 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL
issueManagement {
url = POM_ISSUE_URL
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}
developers {
developer {
id = "Developers"
url = "https://github.com/libgdx/box2dlights/graphs/contributors"
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
}
}
}

repositories {
maven {
url = version.endsWith('SNAPSHOT') ? getSnapshotRepositoryUrl() : getReleaseRepositoryUrl()

if (getRepositoryUsername() || getRepositoryPassword())
{
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}
}

signing {
useGpgCmd()
sign publishing.publications.mavenJava
}

//Simply using "required" in signing block doesn't work because taskGraph isn't ready yet.
gradle.taskGraph.whenReady {
tasks.withType(Sign).tap {
configureEach {
onlyIf { isReleaseBuild() }
}
}
}
File renamed without changes.

0 comments on commit 02e7449

Please sign in to comment.