From 02e744917d2de4a2c1fe909e364d3cd39630b85b Mon Sep 17 00:00:00 2001 From: SimonIT Date: Thu, 4 Jan 2024 13:59:40 +0100 Subject: [PATCH] build: Move to publishing with gradle --- .maven.settings | 10 --- .travis.yml | 16 ---- README.md | 6 ++ build.gradle | 53 +++++++++++++- build.xml | 26 ------- gradle.properties | 12 +++ pom.xml | 121 ------------------------------- publish.gradle | 72 ++++++++++++++++++ {src => res}/Box2DLights.gwt.xml | 0 9 files changed, 140 insertions(+), 176 deletions(-) delete mode 100644 .maven.settings delete mode 100644 .travis.yml delete mode 100644 build.xml create mode 100644 gradle.properties delete mode 100644 pom.xml create mode 100644 publish.gradle rename {src => res}/Box2DLights.gwt.xml (100%) diff --git a/.maven.settings b/.maven.settings deleted file mode 100644 index 70e7d57..0000000 --- a/.maven.settings +++ /dev/null @@ -1,10 +0,0 @@ - - - - sonatype-nexus-snapshots - ${env.SONATYPE_USERNAME} - ${env.SONATYPE_PASSWORD} - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 27ff5cc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: java -branches: - only: - - master -cache: - directories: - - $HOME/.m2 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - lftp -script: - - mvn clean deploy --settings .maven.settings - - lftp sftp://$UPLOADER_USER:$UPLOADER_PASSWORD@$UPLOADER_HOST -e "mkdir uploads/box2dlights; mput target/*.jar -O uploads/box2dlights; bye" \ No newline at end of file diff --git a/README.md b/README.md index d633644..44b87e2 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/build.gradle b/build.gradle index 0f14a4f..bda36fa 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,9 @@ sourceSets { java { srcDirs = ["src"] } + resources { + srcDirs = ["res"] + } } test { java { @@ -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" -} \ No newline at end of file +} + +apply from: rootProject.file('publish.gradle') diff --git a/build.xml b/build.xml deleted file mode 100644 index 01bab46..0000000 --- a/build.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..8b37a08 --- /dev/null +++ b/gradle.properties @@ -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 diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 8772b03..0000000 --- a/pom.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - 4.0.0 - - org.sonatype.oss - oss-parent - 5 - - - com.badlogicgames.box2dlights - box2dlights - jar - 1.6-SNAPSHOT - - Box2dlights - 2D real-time lighting using box2d - http://github.com/libgdx/box2dlights - - https://github.com/libgdx/box2dlights/issues - - - - - Apache Licence 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - - - - Developers - http://code.google.com/p/libgdx/people/list - - - - - scm:git:https://github.com/libgdx/box2dlights.git - scm:git:https://github.com/libgdx/box2dlights.git - http://github.com/libgdx/box2dlights - - - - - gdx-nightlies - https://oss.sonatype.org/content/repositories/snapshots/ - - - - - UTF-8 - 1.6.2 - - - - src - test - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - generate-resources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.6 - 1.6 - true - true - - - - - - - - com.badlogicgames.gdx - gdx - ${gdx.version} - compile - true - - - com.badlogicgames.gdx - gdx-platform - natives-desktop - ${gdx.version} - test - - - com.badlogicgames.gdx - gdx-backend-lwjgl - ${gdx.version} - test - - - com.badlogicgames.gdx - gdx-box2d - ${gdx.version} - compile - - - com.badlogicgames.gdx - gdx-box2d-platform - ${gdx.version} - natives-desktop - test - - - diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000..ad999db --- /dev/null +++ b/publish.gradle @@ -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() } + } + } +} diff --git a/src/Box2DLights.gwt.xml b/res/Box2DLights.gwt.xml similarity index 100% rename from src/Box2DLights.gwt.xml rename to res/Box2DLights.gwt.xml