Skip to content

Commit

Permalink
Merge pull request #2107 from bugsnag/PLAT-13038/build-rework
Browse files Browse the repository at this point in the history
Replaced the buildSrc plugin with discrete build files
  • Loading branch information
lemnik authored Nov 27, 2024
2 parents 01ada61 + 7f86a25 commit dc76620
Show file tree
Hide file tree
Showing 19 changed files with 529 additions and 385 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@396bb3e45325a47dd9ef434068033c6d5bb0d11a #v3.27.3
# uses: github/codeql-action/autobuild@396bb3e45325a47dd9ef434068033c6d5bb0d11a #v3.27.3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -84,6 +84,9 @@ jobs:
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
run: |
echo "Run, Build Application using script"
./gradlew --no-daemon assemble
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@396bb3e45325a47dd9ef434068033c6d5bb0d11a #v3.27.3
Expand Down
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()
14 changes: 10 additions & 4 deletions bugsnag-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
plugins {
id("bugsnag-build-plugin")
id("com.android.library")
load(Versions.Plugins.AGP)
load(Versions.Plugins.licenseCheck)
}

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 {
Expand Down
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()
Loading

0 comments on commit dc76620

Please sign in to comment.