Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions android-stub/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'conventions.common'
id 'conventions.jvm'
}

description = 'Conscrypt: Android-Stub'

dependencies {
Expand Down
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
plugins {
alias(libs.plugins.android.library)
id 'conventions.common'
id 'conventions.versionprops'
id 'conventions.boringssl'
id 'conventions.android'
}

description = 'Conscrypt: Android'
Expand Down
3 changes: 2 additions & 1 deletion benchmark-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.android.library)
id 'conventions.common'
id 'conventions.android'
}

description = 'Conscrypt: Android Benchmarks'
Expand Down
5 changes: 5 additions & 0 deletions benchmark-base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'conventions.common'
id 'conventions.jvm'
}

description = 'Conscrypt: Base library for benchmarks'

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions benchmark-graphs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'conventions.common'
}

apply plugin: 'application'

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions benchmark-jmh/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
plugins {
id 'conventions.common'
id 'conventions.jvm'
alias libs.plugins.jmh
}

Expand Down
24 changes: 24 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
`kotlin-dsl`
`java-gradle-plugin`
id("groovy-gradle-plugin")
}

repositories {
mavenCentral()
google()
gradlePluginPortal()
}

// Annoyingly, build-logic is pre-built before the rest of the subprojects and so cannot
// make use of the version catalogue in libs.versions.toml.
dependencies {
// AGP
implementation("com.android.tools.build:gradle:7.4.2")
implementation("biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0")
implementation("com.google.gradle:osdetector-gradle-plugin:1.7.3")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.3.0")
implementation("org.ajoberstar.grgit:grgit-gradle:5.3.3")
implementation("com.dorongold.plugins:task-tree:3.0.0")
implementation(gradleApi())
}
12 changes: 12 additions & 0 deletions build-logic/src/main/groovy/conventions.android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id "com.android.library"
}

repositories {
google()
}

ext {
// Needs to be binary compatible with androidMinSdkVersion
androidMinJavaVersion = JavaVersion.VERSION_1_8
}
19 changes: 19 additions & 0 deletions build-logic/src/main/groovy/conventions.boringssl.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id 'org.ajoberstar.grgit'
}

def boringHome = (project.findProperty('boringsslHome') ?: System.getenv('BORINGSSL_HOME'))
if (!boringHome) {
throw new GradleException("boringsslHome not set. Provide -PboringsslHome or \$BORINGSSL_HOME.")
}

def boringInclude = file("${boringHome}/include").absolutePath
if (!file(boringInclude).exists()) {
throw new GradleException("BoringSSL include dir not found: ${boringInclude}")
}

ext {
boringsslHome = boringHome
boringsslIncludeDir = boringInclude
boringSslVersion = org.ajoberstar.grgit.Grgit.open(dir: boringHome).head().id
}
26 changes: 26 additions & 0 deletions build-logic/src/main/groovy/conventions.common.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id 'jacoco'
id 'net.ltgt.errorprone'
id 'com.dorongold.task-tree'
}

group = "org.conscrypt"

repositories {
mavenCentral()
}

jacoco {
toolVersion = libs.versions.jacoco
}

configurations {
jacocoAnt
jacocoAgent
}

dependencies {
jacocoAnt libs.jacoco.ant
jacocoAgent libs.jacoco.agent
errorprone libs.errorprone
}
31 changes: 31 additions & 0 deletions build-logic/src/main/groovy/conventions.cpp.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id 'cpp'
}

model {
toolChains {
visualCpp(VisualCpp)
// Prefer Clang over Gcc (order here matters!)
clang(Clang) {
// Gradle 7.x still seems to get confused about toolchains on Mac
// so explicitly add -arch args.
target("osx_aarch64") {
cppCompiler.withArguments { args ->
args << "-arch" << "arm64"
}
linker.withArguments { args ->
args << "-arch" << "arm64"
}
}
target("osx_x86-64") {
cppCompiler.withArguments { args ->
args << "-arch" << "x86_64"
}
linker.withArguments { args ->
args << "-arch" << "x86_64"
}
}
}
gcc(Gcc)
}
}
69 changes: 69 additions & 0 deletions build-logic/src/main/groovy/conventions.jvm.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
plugins {
id 'com.google.osdetector'
id 'java-library'
}


java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

[tasks.named("compileJava"), tasks.named("compileTestJava")].forEach { t ->
t.configure {
options.compilerArgs += ["-Xlint:all", "-Xlint:-options", '-Xmaxwarns', '9999999']
options.encoding = "UTF-8"
options.release = 8

if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
options.compilerArgs += ["-Werror"]
}
}
}

tasks.named("compileTestJava").configure {
// serialVersionUID is basically guaranteed to be useless in our tests
options.compilerArgs += ["-Xlint:-serial"]
}

tasks.named("jar").configure {
manifest {
attributes('Implementation-Title': name,
'Implementation-Version': archiveVersion,
'Built-By': System.getProperty('user.name'),
'Built-JDK': System.getProperty('java.version'),
'Source-Compatibility': sourceCompatibility,
'Target-Compatibility': targetCompatibility)
}
}

javadoc.options {
encoding = 'UTF-8'
links 'https://docs.oracle.com/en/java/javase/21/docs/api/java.base/'
}

tasks.register("javadocJar", Jar) {
archiveClassifier = 'javadoc'
from javadoc
}

tasks.register("sourcesJar", Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

// At a test failure, log the stack trace to the console so that we don't
// have to open the HTML in a browser.
test {
testLogging {
exceptionFormat = 'full'
showExceptions true
showCauses true
showStackTraces true
showStandardStreams = true
}
// Enable logging for all conscrypt classes while running tests.
systemProperty 'java.util.logging.config.file', "${rootDir}/test_logging.properties"
maxHeapSize = '1500m'
}
12 changes: 12 additions & 0 deletions build-logic/src/main/groovy/conventions.versionprops.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import org.gradle.util.VersionNumber

tasks.register("generateProperties", WriteProperties) {
ext {
parsedVersion = VersionNumber.parse(version)
}
property("org.conscrypt.version.major", parsedVersion.getMajor())
property("org.conscrypt.version.minor", parsedVersion.getMinor())
property("org.conscrypt.version.patch", parsedVersion.getMicro())
property("org.conscrypt.boringssl.version", boringSslVersion)
outputFile "build/generated/resources/org/conscrypt/conscrypt.properties"
}
Loading
Loading