Apply changes to build scripts and ensure android API 10 compat for non-sqlite modules

This commit is contained in:
Paul Schaub 2022-03-01 15:39:02 +01:00
parent 67403d9201
commit 7b297d5fb5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
6 changed files with 50 additions and 30 deletions

View file

@ -37,18 +37,6 @@ allprojects {
onlyIf { !sourceSets.main.allSource.files.isEmpty() } onlyIf { !sourceSets.main.allSource.files.isEmpty() }
} }
// For library modules, enable android api compatibility check
if (it.name != 'cli') {
// animalsniffer
apply plugin: 'ru.vyarus.animalsniffer'
dependencies {
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:2.3.3_r2@signature"
}
animalsniffer {
sourceSets = [sourceSets.main]
}
}
// checkstyle // checkstyle
checkstyle { checkstyle {
toolVersion = '8.18' toolVersion = '8.18'
@ -74,7 +62,6 @@ allprojects {
slf4jVersion = '1.7.32' slf4jVersion = '1.7.32'
logbackVersion = '1.2.9' logbackVersion = '1.2.9'
junitVersion = '5.8.2' junitVersion = '5.8.2'
sopJavaVersion = '1.2.0'
rootConfigDir = new File(rootDir, 'config') rootConfigDir = new File(rootDir, 'config')
gitCommit = getGitCommit() gitCommit = getGitCommit()
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI')) isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
@ -145,15 +132,15 @@ subprojects {
artifact javadocJar artifact javadocJar
artifact testsJar artifact testsJar
pom { pom {
name = 'PGPainless' name = 'Cert-D-Java'
description = 'Simple to use OpenPGP API for Java based on Bouncycastle' description = 'Shared PGP Certificate Directory for Java'
url = 'https://github.com/pgpainless/pgpainless' url = 'https://github.com/pgpainless/cert-d-java'
inceptionYear = '2018' inceptionYear = '2022'
scm { scm {
url = 'https://github.com/pgpainless/pgpainless' url = 'https://github.com/pgpainless/cert-d-java'
connection = 'scm:https://github.com/pgpainless/pgpainless' connection = 'scm:https://github.com/pgpainless/cert-d-java'
developerConnection = 'scm:git://github.com/pgpainless/pgpainless.git' developerConnection = 'scm:git://github.com/pgpainless/cert-d-java.git'
} }
licenses { licenses {

View file

@ -12,7 +12,12 @@ repositories {
mavenCentral() mavenCentral()
} }
apply plugin: 'ru.vyarus.animalsniffer'
dependencies { dependencies {
// animal sniffer
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:2.3.3_r2@signature"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
@ -25,6 +30,10 @@ dependencies {
api project(":pgp-certificate-store") api project(":pgp-certificate-store")
} }
animalsniffer {
sourceSets = [sourceSets.main]
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }

View file

@ -5,7 +5,6 @@
package pgp.cert_d; package pgp.cert_d;
import java.io.File; import java.io.File;
import java.nio.file.Paths;
public class BaseDirectoryProvider { public class BaseDirectoryProvider {
@ -26,21 +25,38 @@ public class BaseDirectoryProvider {
String STORE_NAME = "pgp.cert.d"; String STORE_NAME = "pgp.cert.d";
if (osName.contains("win")) { if (osName.contains("win")) {
// %APPDATA%\Roaming\pgp.cert.d // %APPDATA%\Roaming\pgp.cert.d
return Paths.get(System.getenv("APPDATA"), "Roaming", STORE_NAME).toFile(); String app_data = System.getenv("APPDATA");
if (app_data == null) {
throw new AssertionError("Cannot determine APPDATA directory.");
}
File roaming = new File(app_data, "Roaming");
return new File(roaming, STORE_NAME);
} }
if (osName.contains("nux")) { if (osName.contains("nux")) {
// $XDG_DATA_HOME/pgp.cert.d // $XDG_DATA_HOME/pgp.cert.d
String xdg_data_home = System.getenv("XDG_DATA_HOME"); String xdg_data_home = System.getenv("XDG_DATA_HOME");
if (xdg_data_home != null) { if (xdg_data_home != null) {
return Paths.get(xdg_data_home, STORE_NAME).toFile(); return new File(xdg_data_home, STORE_NAME);
}
String user_home = System.getProperty("user.home");
if (user_home == null) {
throw new AssertionError("Cannot determine user.home directory.");
} }
// $HOME/.local/share/pgp.cert.d // $HOME/.local/share/pgp.cert.d
return Paths.get(System.getProperty("user.home"), ".local", "share", STORE_NAME).toFile(); File local = new File(user_home, ".local");
File share = new File(local, "share");
return new File(share, STORE_NAME);
} }
if (osName.contains("mac")) { if (osName.contains("mac")) {
return Paths.get(System.getenv("HOME"), "Library", "Application Support", STORE_NAME).toFile(); String home = System.getenv("HOME");
if (home == null) {
throw new AssertionError("Cannot determine HOME directory.");
}
File library = new File(home, "Library");
File applicationSupport = new File(library, "Application Support");
return new File(applicationSupport, STORE_NAME);
} }
throw new IllegalArgumentException("Unknown OS " + osName); throw new IllegalArgumentException("Unknown OS " + osName);

View file

@ -12,7 +12,12 @@ repositories {
mavenCentral() mavenCentral()
} }
apply plugin: 'ru.vyarus.animalsniffer'
dependencies { dependencies {
// animal sniffer
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:2.3.3_r2@signature"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
@ -21,6 +26,10 @@ dependencies {
testImplementation "ch.qos.logback:logback-classic:$logbackVersion" testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
} }
animalsniffer {
sourceSets = [sourceSets.main]
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }

View file

@ -4,7 +4,7 @@
rootProject.name = 'cert-d-java' rootProject.name = 'cert-d-java'
include 'pgpainless-core', include 'pgp-cert-d-java',
'pgpainless-sop', 'pgp-cert-d-java-jdbc-sqlite-lookup',
'pgpainless-cli' 'pgp-certificate-store'

View file

@ -4,10 +4,9 @@
allprojects { allprojects {
ext { ext {
shortVersion = '1.1.2' shortVersion = '0.1.0'
isSnapshot = true isSnapshot = true
minAndroidSdk = 10 minAndroidSdk = 10
javaSourceCompatibility = 1.8 javaSourceCompatibility = 1.8
bouncyCastleVersion = '1.70'
} }
} }