2
0

Gradle update.

This commit is contained in:
Maarten Billemont
2019-09-23 14:13:03 -04:00
parent d0cf57105a
commit d0dc393d70
26 changed files with 111 additions and 156 deletions

View File

@@ -2,8 +2,8 @@ import org.gradle.internal.jvm.Jvm
plugins {
id 'cpp-library'
id 'base'
id 'cpp-library'
}
description = 'Master Password Algorithm Implementation'
@@ -16,7 +16,7 @@ artifacts {
components.withType( ComponentWithRuntimeFile ) {
if (optimized)
from runtimeFile, {
into standardOperatingSystem( targetPlatform ) + '/' + standardArchitecture( targetPlatform )
into targetMachine.getOperatingSystemFamily().getName() + '/' + targetMachine.getArchitecture().getName()
}
}
}
@@ -25,6 +25,7 @@ artifacts {
library {
baseName.set( 'mpw' )
linkage.set( [Linkage.SHARED] )
source.from fileTree( 'src' )
// Reconfigure the toolchain from C++ to C.
toolChains {
@@ -42,75 +43,43 @@ library {
// Cross-compile for these host platforms.
// TODO: Cross-compiling, blocked by: https://github.com/gradle/gradle-native/issues/169 - CppLibraryPlugin.java:163
operatingSystems.set( [objects.named( OperatingSystemFamily, OperatingSystemFamily.LINUX ),
objects.named( OperatingSystemFamily, OperatingSystemFamily.MAC_OS ),
objects.named( OperatingSystemFamily, OperatingSystemFamily.WINDOWS )] )
// operatingSystems.set( [objects.named( OperatingSystemFamily, OperatingSystemFamily.LINUX ),
// objects.named( OperatingSystemFamily, OperatingSystemFamily.MAC_OS ),
// objects.named( OperatingSystemFamily, OperatingSystemFamily.WINDOWS )] )
targetMachines.set( [
machines.linux.x86_64,
machines.windows.x86, machines.windows.x86_64,
machines.macOS.x86_64
] )
components.withType( CppComponent ) {
cppSource.from fileTree( 'src' )
privateHeaders {
// JDK for JNI support.
from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
}
// JDK for JNI support.
privateHeaders.from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
binaries.whenElementFinalized {
project.dependencies {
def system = standardOperatingSystem( targetPlatform )
def system = targetMachine.getOperatingSystemFamily().getName()
// libsodium
archive.dependsOn project.tasks.maybeCreate( "build_libsodium-${system}", Exec ).configure {
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}"
privateHeaders.from "$rootDir/../lib/libsodium/build-${system}~/out/include"
add( linkLibraries.name, fileTree( "$rootDir/../lib/libsodium/build-${system}~/out/lib" ) )
commandLine 'bash', "$rootDir/lib/bin/build_libsodium-${system}"
privateHeaders.from "$rootDir/lib/libsodium/build-${system}~/out/include"
add( linkLibraries.name, fileTree( "$rootDir/lib/libsodium/build-${system}~/out/lib" ) )
}
clean.dependsOn project.tasks.maybeCreate( "clean_libsodium-${system}", Exec ).configure {
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}", 'clean'
commandLine 'bash', "$rootDir/lib/bin/build_libsodium-${system}", 'clean'
}
// libjson-c
/*archive.dependsOn project.tasks.maybeCreate( "build_libjson-c-${system}", Exec ).configure {
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}"
privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out/include"
add( linkLibraries.name, fileTree( "$rootDir/../lib/libjson-c/build-${system}~/out/lib" ) )
commandLine 'bash', "$rootDir/lib/bin/build_libjson-c-${system}"
privateHeaders.from "$rootDir/lib/libjson-c/build-${system}~/out/include"
add( linkLibraries.name, fileTree( "$rootDir/lib/libjson-c/build-${system}~/out/lib" ) )
}
clean.dependsOn project.tasks.maybeCreate( "clean_libjson-c-${system}", Exec ).configure {
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}", 'clean'
commandLine 'bash', "$rootDir/lib/bin/build_libjson-c-${system}", 'clean'
}*/
}
}
}
}
static String standardOperatingSystem(NativePlatform platform) {
OperatingSystem os = platform.getOperatingSystem()
if (os.isWindows())
return OperatingSystemFamily.WINDOWS
else if (os.isMacOsX())
return OperatingSystemFamily.MAC_OS
else if (os.isLinux())
return OperatingSystemFamily.LINUX
// Other systems will need to use a Linux compatibility layer.
return OperatingSystemFamily.LINUX
}
static String standardArchitecture(NativePlatform platform) {
Architecture arch = platform.getArchitecture()
if (arch.isArm())
return 'arm'
else if (arch.name.toLowerCase( Locale.ROOT ).startsWith( 'arm' ))
return 'arm64'
else if (arch.isAmd64())
return 'x86_64'
else if (arch.isI386())
return 'x86'
// Other systems will need to be compatible with the x86 architecture.
return 'x86'
}

View File

@@ -1,5 +1,6 @@
plugins {
id 'java-library'
id 'com.github.spotbugs' version '2.0.0'
}
description = 'Master Password Algorithm Implementation'
@@ -16,10 +17,8 @@ configurations {
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
api group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.5'
api group: 'org.jetbrains', name: 'annotations', version: '13.0'
api group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
api group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: '3.0.1'
api group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.8'
api group: 'org.jetbrains', name: 'annotations', version: '16.0.2'
lib project( path: ':masterpassword-core', configuration: 'default' )
}

View File

@@ -199,5 +199,11 @@ public final class Native {
return x86;
}
@Override
public String toString() {
return name().replace('_', '-' );
}
}
}

View File

@@ -1,7 +1,8 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'com.github.spotbugs' version '2.0.0'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}
description = 'Master Password GUI'
@@ -31,7 +32,7 @@ shadowJar {
storepass: System.getenv( 'STORE_PW' ),
keypass: System.getenv( 'KEY_PW_DESKTOP' ),
preservelastmodified: 'true',
signedJar: "${rootDir}/../public/site/${project.name}-${project.version}.jar" )
signedJar: "${rootDir}/public/site/${project.name}-${project.version}.jar" )
}
}

View File

@@ -1,22 +1,19 @@
plugins {
id 'java-library'
id 'net.ltgt.apt' version '0.9'
id 'com.github.spotbugs' version '2.0.0'
}
description = 'Master Password Site Model'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.5'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.8'
implementation 'com.github.spotbugs:spotbugs-annotations:4.0.0-beta4'
api project( ':masterpassword-algorithm' )
api group: 'joda-time', name: 'joda-time', version: '2.4'
api group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.5'
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.5'
api group: 'com.google.code.findbugs', name: 'findbugs-annotations', version: '3.0.1'
compileOnly group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
apt group: 'com.google.auto.value', name: 'auto-value', version: '1.2'
api group: 'joda-time', name: 'joda-time', version: '2.10'
api group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.8'
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.8'
testImplementation group: 'org.testng', name: 'testng', version: '6.8.5'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'

View File

@@ -29,7 +29,7 @@ public abstract class Changeable {
}
changeExecutor.submit( () -> {
synchronized (changeExecutor) {
synchronized (mutex) {
if (grouping != Grouping.APPLY)
return;
changed = false;

View File

@@ -1,17 +1,21 @@
plugins {
id 'java'
id 'com.github.spotbugs' version '2.0.0'
}
description = 'Master Password Test Suite'
dependencies {
implementation group: 'com.lyndir.lhunath.opal', name: 'opal-system', version: '1.7-p2'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
implementation project( ':masterpassword-algorithm' )
implementation project( ':masterpassword-model' )
testImplementation group: 'org.testng', name: 'testng', version: '6.8.5'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
runtime group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.1'
}
test.useTestNG()