Skip to content

Commit

Permalink
Rename class to classifier in the -maven-release extra function to be…
Browse files Browse the repository at this point in the history
… consistent with Archive

---
 Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>

Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>
  • Loading branch information
pkriens committed Jun 12, 2023
1 parent d31e205 commit a895b30
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 9 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: "CI Build"

on:
push:
branches-ignore:
- "dependabot/**"
paths:
- "**"
- "!docs/**"
- "!.github/**"
- ".github/**/*ci*"
pull_request:
paths:
- "**"
- "!docs/**"
- "!.github/**"
- ".github/**/*ci*"

env:
LC_ALL: en_US.UTF-8
GRADLE_OPTS: >-
-Dorg.gradle.parallel=true
MAVEN_OPTS: >-
-Dhttp.keepAlive=false
-Dmaven.wagon.http.pool=false
-Dmaven.wagon.http.retryHandler.count=3
defaults:
run:
shell: bash

permissions:
contents: read

jobs:
build:
strategy:
fail-fast: ${{ (github.repository != 'bndtools/bnd') || ((github.ref != 'refs/heads/master') && (github.ref != 'refs/heads/next')) || (github.event_name == 'pull_request') }}
matrix:
os:
- "ubuntu-latest"
java:
- "8"
- "11"
- "18"
runner:
- "xvfb-run --auto-servernum {0}"
include:
- os: "ubuntu-latest"
java: "17"
runner: "xvfb-run --auto-servernum {0}"
canonical: ${{ (github.repository == 'bndtools/bnd') && ((github.ref == 'refs/heads/classic') || (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/next')) && (github.event_name != 'pull_request') }}
fetch-depth: "0"
- os: "windows-latest"
java: "17"
runner: "{0}"
name: Build JDK${{ matrix.java }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@ebacdc22ef6c2cfb85ee5ded8f2e640f4c776dd5
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

- name: Git Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
- name: Set up Gradle
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef
- name: Build
id: build
run: |
${{ format(matrix.runner, './.github/scripts/ci-build.sh') }}
- name: Configure settings.xml for Publish
if: ${{ matrix.canonical }}
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
server-id: bndtools.jfrog.io
server-username: JFROG_USERNAME
server-password: JFROG_PASSWORD
- name: Publish
id: publish
if: ${{ matrix.canonical }}
run: |
./.github/scripts/ci-publish.sh
env:
CANONICAL: ${{ matrix.canonical }}
JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }}
JFROG_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
- name: Upload Test Reports
if: ${{ always() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure')) }}
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: Build_JDK${{ matrix.java }}_${{ matrix.os }}-test-reports
path: |
*/generated/test-reports/*/TEST-*.xml
maven/*/target/surefire-reports/TEST-*.xml
gradle-plugins/*/build/test-results/*/TEST-*.xml
3 changes: 3 additions & 0 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ public interface Constants {
String METATYPE_ANNOTATIONS_OPTIONS = "-metatypeannotations-options";
String MANIFEST = "-manifest";
String MAVEN_RELEASE = "-maven-release";
String MAVEN_RELEASE_CLASSIFIER = "classifier";
String MAVEN_RELEASE_EXTRA = "extra";
String MAVEN_RELEASE_PATH = "path";
String MAVEN_DEPENDENCIES = "-maven-dependencies";
String MAVEN_SCOPE = "-maven-scope";
String PROFILE = "-profile";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private void doExtra(PutOptions options, ReleaseDTO instructions, IPom pom, Rele
String path = extra.path;
String parts[] = Strings.extension(path);
String ext = parts == null ? ".unknown" : parts[1];
String clazz = extra.clazz;
String clazz = extra.classifier;
File file = new File(path);
if (!file.isFile())
reporter.error("-release-maven.extra contains a path to a file that does not exist: %s",
Expand Down Expand Up @@ -440,7 +440,7 @@ private ReleaseDTO getReleaseDTO(Processor context) {

Attrs javadoc = p.remove("javadoc");
if (javadoc != null) {
release.javadoc.path = javadoc.remove("path");
release.javadoc.path = javadoc.remove(Constants.MAVEN_RELEASE_PATH);
release.javadoc.force = Boolean.parseBoolean(javadoc.remove("force"));
if (NONE.equals(release.javadoc.path)) {
release.javadoc = null;
Expand Down Expand Up @@ -481,20 +481,20 @@ private ReleaseDTO getReleaseDTO(Processor context) {
}


int clazz = 0;
int classifier = 0;

for (Iterator<Entry<String, Attrs>> it = p.entrySet()
.iterator(); it.hasNext();) {

Entry<String, Attrs> e = it.next();
String key = Processor.removeDuplicateMarker(e.getKey());
switch (key) {
case "extra" -> {
case Constants.MAVEN_RELEASE_EXTRA -> {
ExtraDTO extra = new ExtraDTO();
extra.clazz = e.getValue()
.getOrDefault("class", "class-" + clazz++);
extra.classifier = e.getValue()
.getOrDefault(Constants.MAVEN_RELEASE_CLASSIFIER, "classifier-" + classifier++);
String path = e.getValue()
.get("path");
.get(Constants.MAVEN_RELEASE_PATH);

boolean preprocess = false;

Expand All @@ -507,7 +507,7 @@ private ReleaseDTO getReleaseDTO(Processor context) {
path = context.getFile(path)
.getAbsolutePath();
} else {
reporter.warning("The -maven-release instruction has an extra without the path attribute: %s",
reporter.warning("The -maven-release instruction has an 'extra' without the path attribute: %s",
e);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class SourceDTO extends DTO {

public static class ExtraDTO extends DTO {
public String path;
public String clazz;
public String classifier;
public boolean preprocess;
public Map<String, String> options = new HashMap<>();
}
Expand Down

0 comments on commit a895b30

Please sign in to comment.