Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release setup update #3040

Merged
merged 6 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: Weld Core release
release:
current-version: 5.1.2.Final
next-version: 5.1.3-SNAPSHOT
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Weld Core Release

on:
pull_request:
types:
- closed
paths:
- '.github/project.yml'

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{github.event.pull_request.merged == true}}
env:
GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}}
steps:
- name: Retrieve project metadata
id: metadata
uses: radcortez/project-metadata-action@master
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{secrets.RELEASE_TOKEN}}

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
server-id: 'sonatype-nexus-staging'
server-username: 'MAVEN_DEPLOY_USERNAME'
server-password: 'MAVEN_DEPLOY_TOKEN'
gpg-private-key: ${{secrets.MAVEN_GPG_PRIVATE_KEY}}
gpg-passphrase: 'MAVEN_GPG_PASSPHRASE'

- name: Maven release ${{steps.metadata.outputs.current-version}}
env:
MAVEN_DEPLOY_USERNAME: ${{secrets.MAVEN_DEPLOY_USERNAME}}
MAVEN_DEPLOY_TOKEN: ${{secrets.MAVEN_DEPLOY_TOKEN}}
MAVEN_GPG_PASSPHRASE: ${{secrets.MAVEN_GPG_PASSPHRASE}}
run: |
export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED"
java -version
git config --global user.name "Weld CI"
git config --global user.email "[email protected]"
git checkout -b release
mvn release:prepare --batch-mode -Drelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -Dtag=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
git checkout ${{github.base_ref}}
git rebase release
mvn -B release:perform -Drelease
git push
git push --tags
cd dist
git checkout ${{steps.metadata.outputs.current-version}}
gradle -PweldVersion=${{steps.metadata.outputs.current-version}} -PweldPath=${GITHUB_WORKSPACE}
- name: Upload dist ZIP file
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist/weld-*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ tests-arquillian/src/test/resources/org/jboss/weld/tests/contexts/conversation/e
.externalToolBuilders
bin
examples/se/numberguess/dependency-reduced-pom.xml
dist/.gradle
dist/weld-*
16 changes: 16 additions & 0 deletions dist/BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Requirements
==============
- gradle
- maven
- sed
- java

Running build
================
You can run build by executing single "gradle" command and you will be asked for required attributes or you can provide them e.g:

gradle -PweldVersion=5.1.2.Final -PweldPath=/home/user/weld

You can also specify additional optional "readme" attribute which will override preface text in README file in created Weld distribution zip e.g:

gradle -PweldVersion=5.1.2.Final -PweldPath=/home/user/weld -Preadme="This is cutting edge CDI X.Y prototype implementation"
61 changes: 61 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Weld
====

What is it?
------------

{CUSTOM_TEXT}: Contexts and Dependency Injection
for the Jakarta EE Platform which is the Java standard for dependency injection and
contextual lifecycle management and one of the most important and popular parts
of the Jakarta EE platform.

Weld is integrated into many Jakarta EE application servers such as WildFly,
JBoss Enterprise Application Platform, GlassFish, Liberty, and others.
Weld can also be used in a Servlet-only environment (Tomcat, Jetty) or plain
Java SE environment.

See http://weld.cdi-spec.org for more details.

Contents of distribution
------------------------

doc/

API Docs and reference guide. Open doc/en-US/html_single/index.html in your browser for instructions on how to get started using Weld and the facilities offered by CDI.

examples/

The Weld examples. See examples/README.md for more details.
In addition, the examples are described in more detail in the reference guide

artifacts/weld

Weld binary, source and javadoc jars

artifacts/cdi

CDI API binary, source and javadoc jars

Licensing
---------

This distribution, as a whole, is licensed under the terms of the ASL 2.0, Version 2.0 (see LICENSE.txt).

The various components in this JAR are each licensed under an open source
license that permits you to copy, modify, and distribute the code in both
binary and source code form. In some cases those licenses impose
requirements on you when you redistribute the code. Please refer to the
license information contained in the source code of each of the components
for the specific license applicable to that component.

Weld URLs
---------

Home Page: http://weld.cdi-spec.org

Downloads: http://weld.cdi-spec.org/download/

Mailing Lists: https://lists.jboss.org/mailman/listinfo/weld-dev

Source Code: http://github.com/weld
191 changes: 191 additions & 0 deletions dist/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
apply plugin: "java"

def File weldDir
def String releaseVersion
def String examplesDir
def String cdiArtifactsDir
def String weldArtifactsDir
def String cdiApiDocsDir
def String finalName
def String distDir
def String docDir
def String defaultReadmePreface
def console = System.console()

task setup {
if (!project.hasProperty("weldPath"))
weldDir = file(console.readLine("\n Path to Weld Core source directory: \n"))
else
weldDir = new File(weldPath)

if(!project.hasProperty("weldVersion"))
releaseVersion = new String(console.readLine("\n Weld Core Version (used to locate built Weld jars): \n"))
else
releaseVersion = weldVersion

if (!weldDir.exists())
throw new FileNotFoundException("Cannot find " + weldDir.absolutePath);

if (releaseVersion.equals(""))
throw new IllegalArgumentException("You must specify valid Weld version.")

println "Using " + weldDir.toString() + " as Weld Core source directory."
println "Using " + releaseVersion + " as Weld Core version."

finalName = "weld-".concat(releaseVersion)
distDir = project.projectDir.absolutePath + "/" + finalName
examplesDir = distDir.concat("/examples")
cdiArtifactsDir = distDir.concat("/artifacts/cdi")
weldArtifactsDir = distDir.concat("/artifacts/weld")
docDir = distDir.concat("/doc")
cdiApiDocsDir = docDir.concat("/apidocs/cdi")
}

// create dependencies (including javadoc and sources artifacts) according given coords and version
def dep(coords, version = null) {
def coord = "$coords:$version"
def result = [dependencies.create(coord)]
result << dependencies.create("$coord:javadoc")
result << dependencies.create("$coord:sources")
result
}

task cleanDir(type: Delete, dependsOn: setup) {

delete fileTree(dir: weldDir.getAbsolutePath(), includes: ["**/target/", ".project", ".classpath", ".wtpmodules"])
delete distDir
delete "build"
delete finalName.concat(".zip")
doLast {
new File(distDir).mkdirs()
new File(examplesDir).mkdirs()
new File(cdiArtifactsDir).mkdirs()
new File(weldArtifactsDir).mkdirs()
new File(cdiApiDocsDir).mkdirs()
}
}

task copyFiles(type: Copy, dependsOn: cleanDir) {

from project.projectDir.absolutePath
into distDir
include "README.md"
include "LICENSE.txt"
}

task copyExamples(type: Copy, dependsOn: copyFiles) {

from fileTree(dir: weldDir.getAbsolutePath().concat("/examples"), excludes: ["**/target", "**/.settings", "**/.project"])
into examplesDir
}

repositories {
mavenCentral()
maven {
url "https://repository.jboss.org/nexus/content/groups/public/"
}
maven {
url "https://repository.jboss.org/nexus/content/repositories/staging"
}
maven {
url "https://oss.sonatype.org/content/groups/staging"
}
// Maven Local repo is here so that this script can be built even on just SNAPSHOTS
mavenLocal()
}

dependencies {
implementation dep("org.jboss.weld:weld-core-impl", releaseVersion)
implementation dep("org.jboss.weld.environment:weld-environment-common", releaseVersion)
implementation dep("org.jboss.weld.se:weld-se-core", releaseVersion)
implementation dep("org.jboss.weld.module:weld-ejb", releaseVersion)
implementation dep("org.jboss.weld.module:weld-jsf", releaseVersion)
implementation dep("org.jboss.weld.module:weld-jta", releaseVersion)
implementation dep("org.jboss.weld.module:weld-web", releaseVersion)

implementation dep("org.jboss.weld.se:weld-se-shaded", releaseVersion)
implementation dep("org.jboss.weld.servlet:weld-servlet-shaded", releaseVersion)
implementation dep("org.jboss.weld.servlet:weld-servlet-core", releaseVersion)

// listed only because we need to download javadoc and sources artifacts too
implementation dep("jakarta.enterprise:jakarta.enterprise.cdi-api")
implementation dep("org.jboss.weld:weld-api")
implementation dep("org.jboss.weld:weld-spi")
}

// helper function which returns version of transitive dependency according the given artifactId
def getVersion(artifactId) {
def result = null
configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact art ->
def id = art.moduleVersion.id
if (id.name.equals(artifactId))
result = id.version
}
result
}

task adjustReadme(type: Exec, dependsOn: copyExamples) {

workingDir distDir
commandLine "sed"
if(!project.hasProperty("readme"))
defaultReadmePreface = "Weld is the reference implementation of CDI ".concat(getVersion("jakarta.enterprise.cdi-api"))
else
defaultReadmePreface = readme

args "-i", "s/{CUSTOM_TEXT}/$defaultReadmePreface/", "README.md"
}

task copyCdiArtifacts(type: Copy, dependsOn: adjustReadme) {

from configurations.runtimeClasspath.findAll { dep -> dep.name.contains("cdi") }
into cdiArtifactsDir

def cdiVersion = getVersion("jakarta.enterprise.cdi-api")
// rename jars - remove version
rename { String fileName ->
fileName.replace("-".concat(cdiVersion), "")
}
}

task copyWeldArtifacts(type: Copy, dependsOn: copyCdiArtifacts) {

from configurations.runtimeClasspath.findAll { dep -> dep.name.contains("weld") }
into weldArtifactsDir

def weldApiVersion = getVersion("weld-api")
// rename jars - remove version
rename { String fileName ->
fileName.replace("-".concat(releaseVersion), "").replace("-".concat(weldApiVersion), "")
}
}

task extractCdiApiDoc(type: Copy, dependsOn: copyWeldArtifacts) {

from zipTree(cdiArtifactsDir.concat("/jakarta.enterprise.cdi-api-javadoc.jar"))
into cdiApiDocsDir
}

task buildDocs(type: Exec, dependsOn: extractCdiApiDoc) {

workingDir weldDir.path.concat("/docs/reference")
commandLine "mvn"
args "clean", "compile"
}

task copyDocs(type: Copy, dependsOn: buildDocs){

from weldDir.path.concat("/docs/reference/target/docbook")
into docDir
}

task zipDist(type: Zip, dependsOn: copyDocs){
from (file(distDir)){
into finalName
}
archiveBaseName = finalName
archiveExtension = "zip"
destinationDirectory = file(project.projectDir.absolutePath)
}

defaultTasks 'zipDist'
12 changes: 4 additions & 8 deletions environments/se/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<sourceFileExcludes>
<!-- Skip module-info as multiple would be included -->
<sourceFileExclude>**/module-info.java</sourceFileExclude>
</sourceFileExcludes>
<includeDependencySources>true</includeDependencySources>
<dependencySourceIncludes>
<dependencySourceInclude>org.jboss.weld:*</dependencySourceInclude>
<dependencySourceInclude>org.jboss.weld.se:*</dependencySourceInclude>
<dependencySourceInclude>jakarta.enterprise:*</dependencySourceInclude>
<dependencySourceInclude>jakarta.inject:*</dependencySourceInclude>
</dependencySourceIncludes>
<additionalDependencies>
<additionalDependency>
Expand All @@ -144,12 +146,6 @@
<artifactId>bcel</artifactId>
<version>${apache.bcel.version}</version>
</additionalDependency>
<!-- Temporary until there is release with https://github.com/eclipse-ee4j/cdi/pull/449 -->
<additionalDependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
<version>4.0.0-RC2</version>
</additionalDependency>
</additionalDependencies>
</configuration>
<executions>
Expand Down
Loading
Loading