Skip to content

Commit 64049fc

Browse files
authored
Remove subprojects logic in favour of convention plugins. (#1386)
* Remove subprojects logic in favour of convention plugins. Should be a no-op for Gradle builds and definitely a no-op everywhere else. I didn't manage to test signing still works but will do at some point. No changes in the logic of what is applied to each project and I've kept the convention plugins in Groovy for now for ease of review. This is unfortunately a slightly large change but should be straightforward to review and unlocks the path to other, smaller, incremental gradle improvements. Planned next steps (in no particular order): * Move the NativeBuildInfo logic to a plugin and support ARM Linux. * Simplify boringssl and property file logic * Migrate to a recent Gradle * Use recent Gradle toolchain logic to simplify native builds * Simplify JVM task logic * Typos. * Add missing evaluationDependsOn. This was a latent bug all along. When Android SDK is present, android/build.gradle already contains this so openjdk was getting it that way. No idea why it was working on non-SDK builds though... Note, this is fugly, but it's what we have right now. Once this PR lands, I will do a smaller follow-up change which untangles the constants dependency a bit, and when we get to Gradle 9 we can migrate to "proper" C++ toolchains. * Fix local uberjar publishing. Missing boringssl convention plugin. Also needs explicit mavenLocal() repository, which we should refactor later to prevent any release accidents. Tidied up the boringssl convention plugin a bit while I was here.
1 parent 9ccfd92 commit 64049fc

23 files changed

Lines changed: 276 additions & 205 deletions

android-stub/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
plugins {
2+
id 'conventions.common'
3+
id 'conventions.jvm'
4+
}
5+
16
description = 'Conscrypt: Android-Stub'
27

38
dependencies {

android/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
plugins {
2-
alias(libs.plugins.android.library)
2+
id 'conventions.common'
3+
id 'conventions.versionprops'
4+
id 'conventions.boringssl'
5+
id 'conventions.android'
36
}
47

58
description = 'Conscrypt: Android'

benchmark-android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
alias(libs.plugins.android.library)
2+
id 'conventions.common'
3+
id 'conventions.android'
34
}
45

56
description = 'Conscrypt: Android Benchmarks'

benchmark-base/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
plugins {
2+
id 'conventions.common'
3+
id 'conventions.jvm'
4+
}
5+
16
description = 'Conscrypt: Base library for benchmarks'
27

38
dependencies {

benchmark-graphs/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
plugins {
2+
id 'conventions.common'
3+
}
4+
15
apply plugin: 'application'
26

37
dependencies {

benchmark-jmh/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
plugins {
2+
id 'conventions.common'
3+
id 'conventions.jvm'
24
alias libs.plugins.jmh
35
}
46

build-logic/build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
plugins {
2+
`kotlin-dsl`
3+
`java-gradle-plugin`
4+
id("groovy-gradle-plugin")
5+
}
6+
7+
repositories {
8+
mavenCentral()
9+
google()
10+
gradlePluginPortal()
11+
}
12+
13+
// Annoyingly, build-logic is pre-built before the rest of the subprojects and so cannot
14+
// make use of the version catalogue in libs.versions.toml.
15+
dependencies {
16+
// AGP
17+
implementation("com.android.tools.build:gradle:7.4.2")
18+
implementation("biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0")
19+
implementation("com.google.gradle:osdetector-gradle-plugin:1.7.3")
20+
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.3.0")
21+
implementation("org.ajoberstar.grgit:grgit-gradle:5.3.3")
22+
implementation("com.dorongold.plugins:task-tree:3.0.0")
23+
implementation(gradleApi())
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plugins {
2+
id "com.android.library"
3+
}
4+
5+
repositories {
6+
google()
7+
}
8+
9+
ext {
10+
// Needs to be binary compatible with androidMinSdkVersion
11+
androidMinJavaVersion = JavaVersion.VERSION_1_8
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
plugins {
2+
id 'org.ajoberstar.grgit'
3+
}
4+
5+
def boringHome = (project.findProperty('boringsslHome') ?: System.getenv('BORINGSSL_HOME'))
6+
if (!boringHome) {
7+
throw new GradleException("boringsslHome not set. Provide -PboringsslHome or \$BORINGSSL_HOME.")
8+
}
9+
10+
def boringInclude = file("${boringHome}/include").absolutePath
11+
if (!file(boringInclude).exists()) {
12+
throw new GradleException("BoringSSL include dir not found: ${boringInclude}")
13+
}
14+
15+
ext {
16+
boringsslHome = boringHome
17+
boringsslIncludeDir = boringInclude
18+
boringSslVersion = org.ajoberstar.grgit.Grgit.open(dir: boringHome).head().id
19+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
plugins {
2+
id 'jacoco'
3+
id 'net.ltgt.errorprone'
4+
id 'com.dorongold.task-tree'
5+
}
6+
7+
group = "org.conscrypt"
8+
9+
repositories {
10+
mavenCentral()
11+
}
12+
13+
jacoco {
14+
toolVersion = libs.versions.jacoco
15+
}
16+
17+
configurations {
18+
jacocoAnt
19+
jacocoAgent
20+
}
21+
22+
dependencies {
23+
jacocoAnt libs.jacoco.ant
24+
jacocoAgent libs.jacoco.agent
25+
errorprone libs.errorprone
26+
}

0 commit comments

Comments
 (0)