Skip to content

Commit

Permalink
Publish shadow jar
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCreosote committed Apr 24, 2024
1 parent 5a8528c commit ed2ceca
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 46 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Authentication Service MKII release notes

## 0.7.1

* Publishes a shadow jar on jitpack.io for supporting tests in other repos.

## 0.7.0

* BACKWARDS INCOMPATIBILITY - the auth server now logs to stdout vs. syslog.
Expand Down
67 changes: 34 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@ plugins {
id 'java'
id 'war'
id 'jacoco'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '4.1.1'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

group = 'com.github.kbase'

repositories {
mavenCentral()

maven {
name = "Clojars"
url = "https://repo.clojars.org/"
}
maven {
name = "JitPack"
url = 'https://jitpack.io'
}
}
// Warning - these values are hard coded in AuthController.java
def JAR_TEMPLATE_DIR = 'kbase_auth2_templates'
Expand Down Expand Up @@ -132,23 +144,17 @@ java -cp build/classes/java/main:\$CLASSPATH us.kbase.auth2.cli.AuthCLI \$@
}
}

def fromURL = { url, name ->
File file = new File("$buildDir/download/${name}.jar")
file.parentFile.mkdirs()
if (!file.exists()) {
new URL(url).withInputStream { downloadStream ->
file.withOutputStream { fileOut ->
fileOut << downloadStream
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
artifactId = "auth2-test-shadow-all"
}
}
files(file.absolutePath)
}

dependencies {

// ### General application dependencies ###

/* Notes on exclusions:
* Bizarrely, the glassfish verison of inject has a dependency on v1 inject, which
* causes problems when trying to build the fat jar
Expand All @@ -167,6 +173,20 @@ dependencies {
implementation 'org.mongodb:mongodb-driver-sync:4.11.1'
implementation 'org.mongodb:bson-record-codec:4.11.1'
implementation 'org.mongodb:bson:4.11.1'
implementation('com.github.kbase:java_common:0.3.0') {
exclude group: 'net.java.dev.jna' // breaks shadow jar
exclude group: 'org.eclipse.jetty.aggregate' // ugh, java common pollutes everything
exclude group: 'com.fasterxml.jackson.core' // breaks everything if we upgrade
exclude group: 'javax.servlet', module: 'servlet-api' // 2.5 vs 3.1 below
// I have no idea why, but including the auth client in the build causes the shadow
// jar to fail to start correctly. It shouldn't be a problem, but it is
exclude group: 'com.github.kbase', module: 'auth2_client_java'
}
implementation 'ch.qos.logback:logback-classic:1.1.2'
implementation 'org.slf4j:slf4j-api:1.7.25'
// TODO DEPS Need to rework the java common logger to not use syslog4j at all since it's
// abandonware and has a ton of CVEs, even in the newer versions.
implementation "org.syslog4j:syslog4j:0.9.46"
implementation 'com.github.spullara.mustache.java:compiler:0.9.3'
implementation 'com.nulab-inc:zxcvbn:1.2.2'
implementation 'nl.basjes.parse.useragent:yauaa:1.3'
Expand All @@ -192,28 +212,6 @@ dependencies {
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'


// ### Logging dependencies ###
implementation fromURL(
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.2.0.jar',
'kbase-common-0.2.0'
)
implementation 'ch.qos.logback:logback-classic:1.1.2'
implementation 'org.slf4j:slf4j-api:1.7.25'
// Syslog4j 0.9.46 doesn't appear to be available on Maven. It apparently lives in
// a JetBrains artifact server, but that's too much trouble and there's only one version there
// anyway.
// https://mvnrepository.com/artifact/org.jetbrains/syslog4j/0.9.46
// Need to rework the java common logger to not use syslog4j at all since it's abandonware
// and has a ton of CVEs, even in the newer versions.
implementation fromURL(
'https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar',
'syslog4j-0.9.46'
)
// needed for syslog4j
implementation 'joda-time:joda-time:2.3'

// ### Test ###

testImplementation 'commons-io:commons-io:2.4'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10'
testImplementation 'junit:junit:4.12'
Expand All @@ -229,6 +227,9 @@ dependencies {
testImplementation 'de.danielbechler:java-object-diff:0.94'
testImplementation 'org.jsoup:jsoup:1.10.2'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation('com.github.kbase:java_test_utilities:0.1.0') {
exclude group: 'com.fasterxml.jackson.core' // upgrading breaks stuff
}
}

task showTestClassPath {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/us/kbase/auth2/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
public class Version {

/** The version of the KBase Auth2 service. */
public static final String VERSION = "0.7.0";
public static final String VERSION = "0.7.1";

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import us.kbase.auth2.cryptutils.RandomDataGenerator;
import us.kbase.auth2.lib.storage.mongo.MongoStorage;
import us.kbase.common.test.controllers.mongo.MongoController;
import us.kbase.testutils.controllers.mongo.MongoController;

public class MongoStorageTestManager {

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/us/kbase/test/auth2/TestCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import us.kbase.auth2.lib.TemporarySessionData;
import us.kbase.auth2.lib.UserName;
import us.kbase.auth2.lib.token.TemporaryToken;
import us.kbase.common.test.TestException;
import us.kbase.testutils.TestException;

public class TestCommon {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package us.kbase.test.auth2.authcontroller;

import static us.kbase.common.test.controllers.ControllerCommon.findFreePort;
import static us.kbase.common.test.controllers.ControllerCommon.makeTempDirs;
import static us.kbase.testutils.controllers.ControllerCommon.findFreePort;
import static us.kbase.testutils.controllers.ControllerCommon.makeTempDirs;
import static us.kbase.test.auth2.TestConfigurator.MONGO_HOST_KEY;
import static us.kbase.test.auth2.TestConfigurator.MONGO_DB_KEY;
import static us.kbase.test.auth2.TestConfigurator.MONGO_TEMPLATES_KEY;
Expand All @@ -27,7 +27,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;

import us.kbase.common.test.TestException;
import us.kbase.testutils.TestException;
import us.kbase.test.auth2.StandaloneAuthServer;

/** Q&D utility to run the auth server in test mode for use in testing rigs. Expected to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import us.kbase.auth2.cryptutils.RandomDataGenerator;
import us.kbase.auth2.lib.storage.mongo.MongoStorage;
import us.kbase.common.test.controllers.mongo.MongoController;
import us.kbase.test.auth2.MongoStorageTestManager;
import us.kbase.testutils.controllers.mongo.MongoController;

public class MongoStorageTester {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
import us.kbase.auth2.service.AuthStartupConfig;
import us.kbase.auth2.service.LoggingFilter;
import us.kbase.auth2.service.SLF4JAutoLogger;
import us.kbase.common.test.RegexMatcher;
import us.kbase.test.auth2.MongoStorageTestManager;
import us.kbase.test.auth2.StandaloneAuthServer;
import us.kbase.test.auth2.TestCommon;
import us.kbase.testutils.RegexMatcher;
import us.kbase.test.auth2.StandaloneAuthServer.ServerThread;

public class LoggingFilterTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
import us.kbase.auth2.lib.token.TokenName;
import us.kbase.auth2.lib.token.TokenType;
import us.kbase.auth2.service.AuthExternalConfig;
import us.kbase.common.test.RegexMatcher;
import us.kbase.test.auth2.MockIdentityProviderFactory;
import us.kbase.test.auth2.MongoStorageTestManager;
import us.kbase.test.auth2.TestCommon;
import us.kbase.testutils.RegexMatcher;

public class ServiceTestUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
public class ServiceCommonTest {

public static final String SERVICE_NAME = "Authentication Service";
public static final String SERVER_VER = "0.7.0";
public static final String SERVER_VER = "0.7.1";
public static final String GIT_ERR =
"Missing git commit file gitcommit, should be in us.kbase.auth2";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
import us.kbase.auth2.lib.user.AuthUser;
import us.kbase.auth2.lib.user.LocalUser;
import us.kbase.auth2.lib.user.NewUser;
import us.kbase.common.test.RegexMatcher;
import us.kbase.test.auth2.MapBuilder;
import us.kbase.test.auth2.MockIdentityProviderFactory;
import us.kbase.test.auth2.MongoStorageTestManager;
import us.kbase.test.auth2.StandaloneAuthServer;
import us.kbase.test.auth2.TestCommon;
import us.kbase.test.auth2.StandaloneAuthServer.ServerThread;
import us.kbase.test.auth2.service.ServiceTestUtils;
import us.kbase.testutils.RegexMatcher;

public class LoginTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import org.mockito.ArgumentMatcher;

import us.kbase.common.test.RegexMatcher;
import us.kbase.testutils.RegexMatcher;


public class PKCEChallengeMatcher implements ArgumentMatcher<String> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import org.mockito.ArgumentMatcher;

import us.kbase.common.test.RegexMatcher;
import us.kbase.testutils.RegexMatcher;


public class StateMatcher implements ArgumentMatcher<String> {

Expand Down

0 comments on commit ed2ceca

Please sign in to comment.