Skip to content

Commit

Permalink
build: update to Gradle 8
Browse files Browse the repository at this point in the history
...and use gradle-nexus publish-plugin.
  • Loading branch information
stempler committed Oct 20, 2023
1 parent 2799206 commit 38e2242
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 151 deletions.
208 changes: 60 additions & 148 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5'
}
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id "signing"
id "groovy"
id "eclipse"
id "maven-publish"
}

apply plugin: 'groovy'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'


repositories {
mavenCentral()
}

group = 'org.standardout'
version = '1.9.0-SNAPSHOT'
version = '2.0.0-SNAPSHOT'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand All @@ -37,75 +28,25 @@ dependencies {
implementation 'biz.aQute.bnd:biz.aQute.bndlib:5.2.0'
implementation 'org.osgi:osgi.core:6.0.0'
implementation 'commons-io:commons-io:2.4'
implementation 'de.undercouch:gradle-download-task:3.1.1'
implementation 'de.undercouch:gradle-download-task:5.5.0'
implementation localGroovy()
}

wrapper {
gradleVersion = '5.3'
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = '8.4'
}

// package groovydoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'groovydoc') {
from groovydoc.destinationDir
classifier = 'javadoc'
archiveClassifier = 'javadoc'
}

// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}

// define artifacts for upload
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}

def configurePom(def pom) {
// ensure correct artifact ID
pom.artifactId = 'bnd-platform'

// pom file details
pom.project {
name 'bnd-platform'
packaging 'jar'
description 'Build OSGi bundles and Eclipse Update Sites from existing JARs, e.g. from Maven repositories (Plugin for Gradle)'
url 'https://github.com/stempler/bnd-platform'

scm {
url 'scm:git:https://github.com/stempler/bnd-platform.git'
connection 'scm:git:https://github.com/stempler/bnd-platform.git'
developerConnection 'scm:git:https://github.com/stempler/bnd-platform.git'
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

developers {
developer {
id 'stempler'
name 'Simon Templer'
email '[email protected]'
}
}
}
}

// sign all artifacts
signing {
required {
// NOTE: skipping does only work if no gradle properties specifying the key are present
gradle.taskGraph.hasTask('uploadArchives')
}
sign configurations.archives
archiveClassifier = 'sources'
}

// groovydoc task work-around
Expand All @@ -120,85 +61,56 @@ dependencies {
jansi 'org.fusesource.jansi:jansi:1.11'
}

// bintray

bintray { // task bintrayUpload
user = project.getProperty('bintrayUser')
key = project.getProperty('bintrayApiKey')

configurations = ['archives']

dryRun = false
publish = !project.version.endsWith('-SNAPSHOT')
pkg {
def githubUrl = 'https://github.com/stempler/bnd-platform'
repo = 'gradle-plugins'
name = 'bnd-platform'
desc = 'Build OSGi bundles and p2 repositories / Eclipse Update Sites from existing libraries and their dependencies, e.g. from Maven repositories. Useful for instance for creating a target platform for Eclipse/Equinox or Maven Tycho build from third party dependencies.'
websiteUrl = githubUrl
issueTrackerUrl = "$githubUrl/issues"
vcsUrl = "${githubUrl}.git"
licenses = ['Apache-2.0']
labels = ['gradle', 'bnd', 'osgi', 'p2', 'eclipse', 'tycho']
publicDownloadNumbers = true
// version descriptor
version {
name = project.version
attributes = ['gradle-plugin': "org.standardout.bnd-platform:${project.group}:bnd-platform"]
}
nexusPublishing {
repositories {
sonatype()
}

}

publishing {
repositories {
maven {
url = this.version.endsWith('-SNAPSHOT') ? 'https://oss.sonatype.org/content/repositories/snapshots' : 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username = this.hasProperty('sonatypeUsername') ? sonatypeUsername : ''
password = this.hasProperty('sonatypePassword') ? sonatypePassword : ''
}
}
}
publications {
MyPublication(MavenPublication) {
from components.java
groupId "${group}"
artifactId 'bnd-platform'
version "${version}"

artifact packageSources
artifact packageJavadoc

pom {
name = 'bnd-platform'
packaging = 'jar'
description = 'Build OSGi bundles and Eclipse Update Sites from existing JARs, e.g. from Maven repositories (Plugin for Gradle)'
url = 'https://github.com/stempler/bnd-platform'

scm {
url = 'scm:git:https://github.com/stempler/bnd-platform.git'
connection = 'scm:git:https://github.com/stempler/bnd-platform.git'
developerConnection = 'scm:git:https://github.com/stempler/bnd-platform.git'
}

licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}

developers {
developer {
id = 'stempler'
name = 'Simon Templer'
email = '[email protected]'
}
}
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
groupId "${group}"
artifactId 'bnd-platform'
version "${version}"

artifact packageSources
artifact packageJavadoc

pom {
name = 'bnd-platform'
packaging = 'jar'
description = 'Build OSGi bundles and Eclipse Update Sites from existing JARs, e.g. from Maven repositories (Plugin for Gradle)'
url = 'https://github.com/stempler/bnd-platform'

scm {
url = 'scm:git:https://github.com/stempler/bnd-platform.git'
connection = 'scm:git:https://github.com/stempler/bnd-platform.git'
developerConnection = 'scm:git:https://github.com/stempler/bnd-platform.git'
}

licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}

developers {
developer {
id = 'stempler'
name = 'Simon Templer'
email = '[email protected]'
}
}
}
}
}
}

// sign all artifacts
signing {
sign publishing.publications.mavenJava
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 17 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down

0 comments on commit 38e2242

Please sign in to comment.