Skip to content

Commit

Permalink
Merge branch 'master' into #770-windows-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Sloox authored Sep 17, 2020
2 parents 5028caf + 88bd2de commit 8c7953b
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
object Versions {

// https://github.com/Guardsquare/proguard
const val PROGUARD = "7.0.0"

// https://github.com/bugsnag/bugsnag-java/releases
const val BUGSNAG = "3.6.1"

Expand Down Expand Up @@ -126,6 +130,8 @@ object Libs {

const val JANSI = "org.fusesource.jansi:jansi:${Versions.JANSI}"

const val PROGUARD = "com.guardsquare:proguard-gradle:${Versions.PROGUARD}"

//region Plugins
const val DETEKT_FORMATTING = "io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.DETEKT}"
//endregion
Expand Down
40 changes: 40 additions & 0 deletions test_runner/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ shadowJar.apply {
exclude(dependency(Libs.TRUTH))
exclude(dependency(Libs.MOCKK))
exclude(dependency(Libs.JUNIT))
exclude(dependency(Libs.PROGUARD))
exclude(dependency(Libs.DETEKT_FORMATTING))
}
}
Expand Down Expand Up @@ -257,6 +258,28 @@ dependencies {
implementation(Libs.JANSI)
}

// Fix Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.hash.Hashing.crc32c()Lcom/google/common/hash/HashFunction;
// https://stackoverflow.com/a/45286710
configurations.all {
resolutionStrategy {
force("com.google.guava:guava:25.1-jre")
force(Libs.KOTLIN_REFLECT)
exclude(group = "com.google.guava", module = "guava-jdk5")
}
}

buildscript {
repositories {
mavenLocal()
jcenter()
google()
}
dependencies {
classpath(Libs.PROGUARD)
}
}


tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
Expand All @@ -270,6 +293,23 @@ tasks.create("updateFlank", Exec::class.java) {
commandLine = listOf("./bash/update_flank.sh")
}

tasks.create("applyProguard", proguard.gradle.ProGuardTask::class.java) {
dependsOn("updateFlank")
description = "Apply proguard to flank and create a minimized jar"
dontwarn()
injars("./build/libs/flank.jar")
outjars("./build/libs/flank-proguard.jar")
libraryjars("${System.getProperty("java.home")}/lib/rt.jar")
libraryjars("./build/libs/flank-sources.jar")
configuration("./proguard/config.pro")
doLast {
copy {
from(file("$buildDir/libs/flank-proguard.jar"))
into(file("./bash/"))
}
}
}

// begin --- ASCII doc generation ---
val generateCliAsciiDoc by tasks.registering(JavaExec::class) {
dependsOn(tasks.classes)
Expand Down
70 changes: 70 additions & 0 deletions test_runner/proguard/config.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-dontobfuscate
-allowaccessmodification
-keepattributes SourceFile, LineNumberTable
-dontwarn
-verbose
-dontoptimize
-dontnote kotlin.**
-dontnote kotlinx.**
-dontnote com.google.gson.**
-dontnote proguard.configuration.ConfigurationLogger

-keep class ftl.Main {
public static void main(java.lang.String[]);
}

#Kotlin
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}

-keep class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keep class kotlinx.coroutines.CoroutineExceptionHandler {}
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {}

# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembernames class kotlinx.** {
volatile <fields>;
}

# Proguard configuration for Jackson 2.x
-keep class com.fasterxml.jackson.databind.ObjectMapper {
public <methods>;
protected <methods>;
}
-keep class com.fasterxml.jackson.databind.ObjectWriter {
public ** writeValueAsString(**);
}
-keepnames class com.fasterxml.jackson.** { *; }
-keep class kotlin.Metadata { *; }
-keep class kotlin.reflect.** { *; }

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class com.bugsnag.android.NativeInterface { *; }
-keep class com.bugsnag.android.Breadcrumb { *; }
-keep class com.bugsnag.android.Breadcrumbs { *; }
-keep class com.bugsnag.android.Breadcrumbs$Breadcrumb { *; }
-keep class com.bugsnag.android.BreadcrumbType { *; }
-keep class com.bugsnag.android.Severity { *; }
-keep class com.bugsnag.android.ndk.BugsnagObserver { *; }
# Picocli
-keep class picocli.** { *; }
-keep interface picocli.** { *; }

#ftl
-keep class ftl.** { *; }
-keep interface ftl.** { *; }

#google auth
-keep class com.google.auth.** { *; }
-keep interface com.google.auth.** { *; }

#ctc wstx
-keep class com.ctc.wstx.** { *; }
-keep interface com.ctc.wstx.** { *; }

0 comments on commit 8c7953b

Please sign in to comment.