Skip to content

Commit

Permalink
chore(build): replaced the buildSrc plugin with a simplified Versions…
Browse files Browse the repository at this point in the history
… object and moved the build structure down into the individual modules
  • Loading branch information
lemnik committed Nov 18, 2024
1 parent f5513a6 commit 3131afd
Show file tree
Hide file tree
Showing 18 changed files with 527 additions and 384 deletions.
92 changes: 70 additions & 22 deletions bugsnag-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,77 @@ import kotlinx.validation.ApiValidationExtension
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id("bugsnag-build-plugin")
loadDefaultPlugins()
}

bugsnagBuildOptions {
usesNdk = true
android {
compileSdk = Versions.Android.Build.compileSdkVersion
namespace = "com.bugsnag.android.core"

// pick up dsl-json by adding to the default sourcesets
android {
sourceSets {
named("main") {
java.srcDirs("dsl-json/library/src/main/java")
}
named("test") {
java.srcDirs(
"dsl-json/library/src/test/java",
"src/sharedTest/java"
)
}
named("androidTest") {
java.srcDirs(
"src/sharedTest/java"
)
}
defaultConfig {
minSdk = Versions.Android.Build.minSdkVersion
ndkVersion = Versions.Android.Build.ndk

consumerProguardFiles("proguard-rules.pro")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

externalNativeBuild.cmake.arguments += BugsnagDefaults.cmakeArguments

configureAbis(ndk.abiFilters)
}

lint {
isAbortOnError = true
isWarningsAsErrors = true
isCheckAllWarnings = true
baseline(File(project.projectDir, "lint-baseline.xml"))
disable("GradleDependency", "NewerVersionAvailable")
}

buildFeatures {
aidl = false
renderScript = false
shaders = false
resValues = false
buildConfig = false
}

compileOptions {
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}

testOptions {
unitTests {
isReturnDefaultValues = true
}
}

sourceSets {
named("main") {
java.srcDirs("dsl-json/library/src/main/java")
}

named("test") {
java.srcDirs(
"dsl-json/library/src/test/java",
"src/sharedTest/java"
)
}
named("androidTest") {
java.srcDirs(
"src/sharedTest/java"
)
}
}

externalNativeBuild.cmake.path = project.file("CMakeLists.txt")
externalNativeBuild.cmake.version = Versions.Android.Build.cmakeVersion
}

apply(plugin = "com.android.library")
apply(plugin = "org.jetbrains.dokka")
dependencies {
addCommonModuleDependencies()
}

tasks.getByName<DokkaTask>("dokkaHtml") {
dokkaSourceSets {
Expand All @@ -47,3 +89,9 @@ tasks.getByName<DokkaTask>("dokkaHtml") {
plugins.withId("org.jetbrains.kotlinx.binary-compatibility-validator") {
project.extensions.getByType(ApiValidationExtension::class.java).ignoredPackages.add("com.bugsnag.android.repackaged.dslplatform.json")
}

apply(from = rootProject.file("gradle/detekt.gradle"))
apply(from = rootProject.file("gradle/license-check.gradle"))
apply(from = rootProject.file("gradle/release.gradle"))

configureCheckstyle()
16 changes: 12 additions & 4 deletions bugsnag-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
plugins {
id("bugsnag-build-plugin")
id("com.android.library")
load(Versions.Plugins.AGP)
load(Versions.Plugins.checkstyle)
}

bugsnagBuildOptions {
compilesCode = false
android {
compileSdk = Versions.Android.Build.compileSdkVersion
namespace = "com.bugsnag.android"

defaultConfig {
minSdk = Versions.Android.Build.minSdkVersion
ndkVersion = Versions.Android.Build.ndk
}
}

dependencies {
add("api", project(":bugsnag-android-core"))
add("api", project(":bugsnag-plugin-android-anr"))
add("api", project(":bugsnag-plugin-android-ndk"))
}

configureCheckstyle()
2 changes: 1 addition & 1 deletion bugsnag-benchmarks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.android.library"
id "androidx.benchmark"
id "androidx.benchmark" version "1.1.1"
id "kotlin-android"
}

Expand Down
67 changes: 62 additions & 5 deletions bugsnag-plugin-android-anr/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,70 @@
plugins {
id("bugsnag-build-plugin")
loadDefaultPlugins()
}

bugsnagBuildOptions {
usesNdk = true
}
android {
compileSdk = Versions.Android.Build.compileSdkVersion
namespace = "com.bugsnag.android.anr"

defaultConfig {
minSdk = Versions.Android.Build.minSdkVersion
ndkVersion = Versions.Android.Build.ndk

consumerProguardFiles("proguard-rules.pro")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

externalNativeBuild.cmake.arguments += listOf(
"-DANDROID_CPP_FEATURES=exceptions",
"-DANDROID_STL=c++_static"
)

configureAbis(ndk.abiFilters)
}

lint {
isAbortOnError = true
isWarningsAsErrors = true
isCheckAllWarnings = true
baseline(File(project.projectDir, "lint-baseline.xml"))
disable("GradleDependency", "NewerVersionAvailable")
}

buildFeatures {
aidl = false
renderScript = false
shaders = false
resValues = false
buildConfig = false
}

apply(plugin = "com.android.library")
compileOptions {
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}

testOptions {
unitTests {
isReturnDefaultValues = true
}
}

sourceSets {
named("test") {
java.srcDir(SHARED_TEST_SRC_DIR)
}
}

externalNativeBuild.cmake.path = project.file("CMakeLists.txt")
externalNativeBuild.cmake.version = Versions.Android.Build.cmakeVersion
}

dependencies {
addCommonModuleDependencies()
add("api", project(":bugsnag-android-core"))
}

apply(from = rootProject.file("gradle/detekt.gradle"))
apply(from = rootProject.file("gradle/license-check.gradle"))
apply(from = rootProject.file("gradle/release.gradle"))

configureCheckstyle()
70 changes: 61 additions & 9 deletions bugsnag-plugin-android-exitinfo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,66 @@
plugins {
id("bugsnag-build-plugin")
id("com.android.library")
id("com.google.protobuf") version "0.9.4"
loadDefaultPlugins()
load(Versions.Plugins.protobuf)
}

android {
compileSdk = Versions.Android.Build.compileSdkVersion
namespace = "com.bugsnag.android.exitinfo"

defaultConfig {
minSdk = Versions.Android.Build.minSdkVersion
ndkVersion = Versions.Android.Build.ndk

consumerProguardFiles("proguard-rules.pro")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

lint {
isAbortOnError = true
isWarningsAsErrors = true
isCheckAllWarnings = true
baseline(File(project.projectDir, "lint-baseline.xml"))
disable("GradleDependency", "NewerVersionAvailable")
}

buildFeatures {
aidl = false
renderScript = false
shaders = false
resValues = false
buildConfig = false
}

compileOptions {
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}

testOptions {
unitTests {
isReturnDefaultValues = true
}
}

sourceSets {
named("test") {
java.srcDir(SHARED_TEST_SRC_DIR)
}
}

libraryVariants.configureEach {
processJavaResourcesProvider {
exclude("**/*.proto")
}
}
}

dependencies {
addCommonModuleDependencies()
api(project(":bugsnag-android-core"))
implementation("com.google.protobuf:protobuf-javalite:3.24.2")
}

android.libraryVariants.configureEach {
processJavaResourcesProvider {
exclude("**/*.proto")
}
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.24.2"
Expand All @@ -31,3 +77,9 @@ protobuf {
}

apiValidation.ignoredPackages += "com.bugsnag.android.repackaged.server.os"

apply(from = rootProject.file("gradle/detekt.gradle"))
apply(from = rootProject.file("gradle/license-check.gradle"))
apply(from = rootProject.file("gradle/release.gradle"))

configureCheckstyle()
70 changes: 64 additions & 6 deletions bugsnag-plugin-android-ndk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,67 @@
plugins {
id("bugsnag-build-plugin")
loadDefaultPlugins()
}

bugsnagBuildOptions {
usesNdk = true
publishesPrefab = "bugsnag-ndk"
}
android {
compileSdk = Versions.Android.Build.compileSdkVersion
namespace = "com.bugsnag.android.ndk"

defaultConfig {
minSdk = Versions.Android.Build.minSdkVersion
ndkVersion = Versions.Android.Build.ndk

consumerProguardFiles("proguard-rules.pro")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

externalNativeBuild.cmake.arguments += BugsnagDefaults.cmakeArguments

configureAbis(ndk.abiFilters)
}

apply(plugin = "com.android.library")
lint {
isAbortOnError = true
isWarningsAsErrors = true
isCheckAllWarnings = true
baseline(File(project.projectDir, "lint-baseline.xml"))
disable("GradleDependency", "NewerVersionAvailable")
}

buildFeatures {
aidl = false
renderScript = false
shaders = false
resValues = false
buildConfig = false
}

compileOptions {
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}

testOptions {
unitTests {
isReturnDefaultValues = true
}
}

sourceSets {
named("test") {
java.srcDir(SHARED_TEST_SRC_DIR)
}
}

buildFeatures.prefabPublishing = true
prefab.create("bugsnag-ndk") {
headers = "src/main/jni/include"
}

externalNativeBuild.cmake.path = project.file("CMakeLists.txt")
externalNativeBuild.cmake.version = Versions.Android.Build.cmakeVersion
}

dependencies {
addCommonModuleDependencies()
add("api", project(":bugsnag-android-core"))
}

Expand All @@ -24,3 +76,9 @@ afterEvaluate {
}
}
}

apply(from = rootProject.file("gradle/detekt.gradle"))
apply(from = rootProject.file("gradle/license-check.gradle"))
apply(from = rootProject.file("gradle/release.gradle"))

configureCheckstyle()
Loading

0 comments on commit 3131afd

Please sign in to comment.