Skip to content

Commit

Permalink
Merge pull request #27 from trydofor/develop
Browse files Browse the repository at this point in the history
AssertState.notNull no stacktrace
  • Loading branch information
trydofor authored Mar 2, 2024
2 parents 3ba7bce + 12364ff commit d17c370
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 62 deletions.
50 changes: 41 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ on:
type: boolean
required: false
deployOssrh:
description: 'deploy to ossrh?'
description: 'deploy to oss-repo?'
default: true
type: boolean
required: false
deployAltrh:
description: 'deploy to alt-repo?'
default: true
type: boolean
required: false
Expand Down Expand Up @@ -101,8 +106,12 @@ jobs:
echo "MVN_COVERAGE=$_cov" >> "$GITHUB_OUTPUT"
_drh=${{ inputs.deployOssrh || github.event_name == 'release' }}
echo "- MVN_DEPLOYRH=$_drh" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_DEPLOYRH=$_drh" >> "$GITHUB_OUTPUT"
echo "- MVN_DEPLOY_OSSRH=$_drh" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_DEPLOY_OSSRH=$_drh" >> "$GITHUB_OUTPUT"
_drp=${{ ( inputs.deployAltrh || github.event_name == 'release' ) && secrets.MVN_ALT_USER != '' }}
echo "- MVN_DEPLOY_ALTRH=$_drp" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_DEPLOY_ALTRH=$_drp" >> "$GITHUB_OUTPUT"
_qod=${{ inputs.applyQodanaScan || 'false' }}
echo "- QODANA_SCAN=$_qod" >> "$GITHUB_STEP_SUMMARY"
Expand All @@ -125,6 +134,11 @@ jobs:
<username>${MVN_OSS_USER}</username>
<password>${MVN_OSS_PASS}</password>
</server>
<server>
<id>altrh</id>
<username>${MVN_ALT_USER}</username>
<password>${MVN_ALT_PASS}</password>
</server>
</servers>
</settings>
EOF
Expand All @@ -151,23 +165,41 @@ jobs:

## import gpp private key
- name: Import GPG key
if: steps.settings.outputs.MVN_DEPLOYRH == 'true'
if: steps.settings.outputs.MVN_DEPLOY_OSSRH == 'true' || steps.settings.outputs.MVN_DEPLOY_ALTRH == 'true'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.MVN_GPG_SKEY }}
passphrase: ${{ secrets.MVN_GPG_PASS }}

## maven deploy
- name: Deploy ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: steps.settings.outputs.MVN_DEPLOYRH == 'true'
## maven deploy ossrh
- name: Deploy OSS ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: steps.settings.outputs.MVN_DEPLOY_OSSRH == 'true'
run: >
mvn
-P 'ossrh'
-P 'deploy,ossrh'
${{ steps.settings.outputs.MVN_REVISION }}
-Dgpg.passphrase=${MVN_GPG_PASS}
clean deploy
deploy
env:
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
MVN_GPG_PASS: ${{ secrets.MVN_GPG_PASS }}
MVN_OSS_USER: ${{ secrets.MVN_OSS_USER }}
MVN_OSS_PASS: ${{ secrets.MVN_OSS_PASS }}

## maven deploy altrh
- name: Deploy ALT ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: steps.settings.outputs.MVN_DEPLOY_ALTRH == 'true'
run: >
mvn
-P 'deploy,altrh'
${{ steps.settings.outputs.MVN_REVISION }}
-Dgpg.passphrase=${MVN_GPG_PASS}
deploy
env:
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
MVN_GPG_PASS: ${{ secrets.MVN_GPG_PASS }}
## export MVN_ALT_REPO=https://packages.trydofor.com/maven/repository/devops/
MVN_ALT_USER: ${{ secrets.MVN_ALT_USER }}
MVN_ALT_PASS: ${{ secrets.MVN_ALT_PASS }}
MVN_ALT_REPO: ${{ secrets.MVN_ALT_REPO }}
MVN_ALT_SNAP: ${{ secrets.MVN_ALT_SNAP }}
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</issueManagement>

<properties>
<revision>2.7.0-SNAPSHOT</revision>
<revision>2.7.1-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -336,7 +336,7 @@
</build>
</profile>
<profile>
<id>ossrh</id>
<id>deploy</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
Expand All @@ -359,6 +359,13 @@
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ossrh</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand All @@ -384,5 +391,14 @@
</repository>
</distributionManagement>
</profile>
<profile>
<id>altrh</id>
<properties>
<!--suppress UnresolvedMavenProperty -->
<altReleaseDeploymentRepository>altrh::${MVN_ALT_REPO}</altReleaseDeploymentRepository>
<!--suppress UnresolvedMavenProperty -->
<altSnapshotDeploymentRepository>altrh::${MVN_ALT_SNAP}</altSnapshotDeploymentRepository>
</properties>
</profile>
</profiles>
</project>
34 changes: 17 additions & 17 deletions src/main/java/pro/fessional/mirana/best/AssertArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void isTrue(boolean b, @NotNull String msg, Object... args) {

@Contract("false, _, _ -> fail")
public static void isTrue(boolean b, @NotNull CodeEnum code, Object... args) {
if (!b) throw new BadArgsException(false, code, args);
if (!b) throw new BadArgsException(code, args);
}

//
Expand All @@ -46,7 +46,7 @@ public static void isFalse(boolean b, @NotNull String msg, Object... args) {

@Contract("true, _, _ -> fail")
public static void isFalse(boolean b, @NotNull CodeEnum code, Object... args) {
if (b) throw new BadArgsException(false, code, args);
if (b) throw new BadArgsException(code, args);
}

//
Expand All @@ -62,7 +62,7 @@ public static void isNull(@Nullable Object b, @NotNull String msg, Object... arg

@Contract("!null, _, _ -> fail")
public static void isNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) {
if (b != null) throw new BadArgsException(false, code, args);
if (b != null) throw new BadArgsException(code, args);
}

//
Expand All @@ -78,7 +78,7 @@ public static void notNull(@Nullable Object b, @NotNull String msg, Object... ar

@Contract("null, _, _ -> fail")
public static void notNull(@Nullable Object b, @NotNull CodeEnum code, Object... args) {
if (b == null) throw new BadArgsException(false, code, args);
if (b == null) throw new BadArgsException(code, args);
}

// ////
Expand All @@ -91,7 +91,7 @@ public static void isEmpty(@Nullable CharSequence c, @NotNull String msg, Object
}

public static void isEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) {
if (c != null && c.length() > 0) throw new BadArgsException(false, code, args);
if (c != null && c.length() > 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -107,7 +107,7 @@ public static void notEmpty(@Nullable CharSequence c, @NotNull String msg, Objec

@Contract("null, _, _ -> fail")
public static void notEmpty(@Nullable CharSequence c, @NotNull CodeEnum code, Object... args) {
if (c == null || c.length() == 0) throw new BadArgsException(false, code, args);
if (c == null || c.length() == 0) throw new BadArgsException(code, args);
}

// ////
Expand All @@ -120,7 +120,7 @@ public static void isEmpty(@Nullable Collection<?> c, @NotNull String msg, Objec
}

public static void isEmpty(@Nullable Collection<?> c, @NotNull CodeEnum code, Object... args) {
if (c != null && !c.isEmpty()) throw new BadArgsException(false, code, args);
if (c != null && !c.isEmpty()) throw new BadArgsException(code, args);
}

//
Expand All @@ -136,7 +136,7 @@ public static void notEmpty(@Nullable Collection<?> c, @NotNull String msg, Obje

@Contract("null, _, _ -> fail")
public static void notEmpty(@Nullable Collection<?> c, @NotNull CodeEnum code, Object... args) {
if (c == null || c.isEmpty()) throw new BadArgsException(false, code, args);
if (c == null || c.isEmpty()) throw new BadArgsException(code, args);
}

// ////
Expand All @@ -149,7 +149,7 @@ public static void isEmpty(@Nullable Map<?, ?> c, @NotNull String msg, Object...
}

public static void isEmpty(@Nullable Map<?, ?> c, @NotNull CodeEnum code, Object... args) {
if (c != null && !c.isEmpty()) throw new BadArgsException(false, code, args);
if (c != null && !c.isEmpty()) throw new BadArgsException(code, args);
}

//
Expand All @@ -165,7 +165,7 @@ public static void notEmpty(@Nullable Map<?, ?> c, @NotNull String msg, Object..

@Contract("null, _, _ -> fail")
public static void notEmpty(@Nullable Map<?, ?> c, @NotNull CodeEnum code, Object... args) {
if (c == null || c.isEmpty()) throw new BadArgsException(false, code, args);
if (c == null || c.isEmpty()) throw new BadArgsException(code, args);
}

// ////
Expand All @@ -178,7 +178,7 @@ public static void isEmpty(@Nullable Object[] c, @NotNull String msg, Object...
}

public static void isEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) {
if (c != null && c.length > 0) throw new BadArgsException(false, code, args);
if (c != null && c.length > 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -194,7 +194,7 @@ public static void notEmpty(@Nullable Object[] c, @NotNull String msg, Object...

@Contract("null, _, _ -> fail")
public static void notEmpty(@Nullable Object[] c, @NotNull CodeEnum code, Object... args) {
if (c == null || c.length == 0) throw new BadArgsException(false, code, args);
if (c == null || c.length == 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -210,7 +210,7 @@ public static <T extends Comparable<T>> void aEqb(@Nullable T a, @Nullable T b,

public static <T extends Comparable<T>> void aEqb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) {
if (a == null && b == null) return;
if (a == null || !a.equals(b)) throw new BadArgsException(false, code, args);
if (a == null || !a.equals(b)) throw new BadArgsException(code, args);
}

//
Expand All @@ -226,7 +226,7 @@ public static <T extends Comparable<T>> void aGeb(@Nullable T a, @Nullable T b,

public static <T extends Comparable<T>> void aGeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) {
if (a == null && b == null) return;
if (a == null || b == null || a.compareTo(b) < 0) throw new BadArgsException(false, code, args);
if (a == null || b == null || a.compareTo(b) < 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -239,7 +239,7 @@ public static <T extends Comparable<T>> void aGtb(@Nullable T a, @Nullable T b,
}

public static <T extends Comparable<T>> void aGtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) {
if (a == null || b == null || a.compareTo(b) <= 0) throw new BadArgsException(false, code, args);
if (a == null || b == null || a.compareTo(b) <= 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -255,7 +255,7 @@ public static <T extends Comparable<T>> void aLeb(@Nullable T a, @Nullable T b,

public static <T extends Comparable<T>> void aLeb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) {
if (a == null && b == null) return;
if (a == null || b == null || a.compareTo(b) > 0) throw new BadArgsException(false, code, args);
if (a == null || b == null || a.compareTo(b) > 0) throw new BadArgsException(code, args);
}

//
Expand All @@ -268,6 +268,6 @@ public static <T extends Comparable<T>> void aLtb(@Nullable T a, @Nullable T b,
}

public static <T extends Comparable<T>> void aLtb(@Nullable T a, @Nullable T b, @NotNull CodeEnum code, Object... args) {
if (a == null || b == null || a.compareTo(b) >= 0) throw new BadArgsException(false, code, args);
if (a == null || b == null || a.compareTo(b) >= 0) throw new BadArgsException(code, args);
}
}
Loading

0 comments on commit d17c370

Please sign in to comment.