Skip to content
Open
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
21 changes: 0 additions & 21 deletions ndk/Makefile

This file was deleted.

75 changes: 0 additions & 75 deletions ndk/README.md

This file was deleted.

143 changes: 3 additions & 140 deletions ndk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import groovy.util.Node
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
Expand All @@ -12,25 +8,16 @@ plugins {
`java-library`
id("com.diffplug.spotless") version "6.25.0" apply true
id("io.gitlab.arturbosch.detekt") version "1.19.0"
`maven-publish`
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.0"
}

buildscript {
repositories {
google()
}
dependencies {
classpath("com.android.tools.build:gradle:8.7.3")
classpath(kotlin("gradle-plugin", version = "1.8.0"))
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
// dokka is required by gradle-maven-publish-plugin.
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.10")
classpath("net.ltgt.gradle:gradle-errorprone-plugin:3.0.1")

// legacy pre-prefab support
// https://github.com/howardpang/androidNativeBundle
classpath("io.github.howardpang:androidNativeBundle:1.1.4")
classpath("com.android.tools.build:gradle:9.2.0")
classpath(kotlin("gradle-plugin", version = "2.3.10"))
classpath("net.ltgt.gradle:gradle-errorprone-plugin:4.1.0")
}
}

Expand Down Expand Up @@ -74,62 +61,6 @@ subprojects {
}
}

if (!name.contains("sample")) {
apply<DistributionPlugin>()

val sep = File.separator

configure<DistributionContainer> {
getByName("main").contents {
// non android modules
from("build${sep}libs")
from("build${sep}publications${sep}maven")
// android modules
from("build${sep}outputs${sep}aar") {
include("*-release*")
}
from("build${sep}publications${sep}release")
}

// craft only uses zip archives
forEach { dist ->
if (dist.name == DistributionPlugin.MAIN_DISTRIBUTION_NAME) {
tasks.getByName("distTar").enabled = false
} else {
tasks.getByName(dist.name + "DistTar").enabled = false
}
}
}

val distZipProvider =
project.layout.buildDirectory
.dir("distributions").map { it.file("${project.name}-${project.version}.zip") }

tasks.named("distZip").configure {
dependsOn("publishToMavenLocal")
doLast {
val distZip = distZipProvider.get().asFile
require(distZip.exists()) { "Distribution file does not exist: ${distZip.absolutePath}" }
require(distZip.length() > 0L) { "Distribution file is empty: ${distZip.absolutePath}" }
}
}

afterEvaluate {
apply<MavenPublishPlugin>()

configure<MavenPublishPluginExtension> {
// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts)
releaseSigningEnabled = false
}

@Suppress("UnstableApiUsage")
configure<MavenPublishBaseExtension> {
assignAarTypes()
}
}
}

apply<SpotlessPlugin>()
}

Expand All @@ -152,71 +83,3 @@ spotless {
ktlint()
}
}

private val androidLibs =
setOf(
"lib",
)

private val androidXLibs =
listOf(
"androidx.core:core",
)

/*
* Adapted from https://github.com/androidx/androidx/blob/c799cba927a71f01ea6b421a8f83c181682633fb/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt#L524-L549
*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Workaround for https://github.com/gradle/gradle/issues/3170
@Suppress("UnstableApiUsage")
fun MavenPublishBaseExtension.assignAarTypes() {
pom {
withXml {
val dependencies =
asNode().children().find {
it is Node && it.name().toString().endsWith("dependencies")
} as Node?

dependencies?.children()?.forEach { dep ->
if (dep !is Node) {
return@forEach
}
val group =
dep.children().firstOrNull {
it is Node && it.name().toString().endsWith("groupId")
} as? Node
val groupValue = group?.children()?.firstOrNull() as? String

val artifactId =
dep.children().firstOrNull {
it is Node && it.name().toString().endsWith("artifactId")
} as? Node
val artifactIdValue = artifactId?.children()?.firstOrNull() as? String

if (artifactIdValue in androidLibs) {
dep.appendNode("type", "aar")
} else if ("$groupValue:$artifactIdValue" in androidXLibs) {
dep.appendNode("type", "aar")
}
}
}
}
}

apiValidation {
ignoredProjects.addAll(listOf("sample"))
}
43 changes: 2 additions & 41 deletions ndk/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,8 @@ org.gradle.parallel=true
# AndroidX required by AGP >= 3.6.x
android.useAndroidX=true

# Release information, used for maven publishing
# Release information
versionName=0.14.2

# disable renderscript, it's enabled by default
android.defaults.buildfeatures.renderscript=false

# disable shader compilation, it's enabled by default
android.defaults.buildfeatures.shaders=false

# disable aidl files, it's enabled by default
android.defaults.buildfeatures.aidl=false

# disable Resource Values generation
android.defaults.buildfeatures.resvalues=false

# disable automatically adding Kotlin stdlib to compile dependencies
kotlin.stdlib.default.dependency=false

# TODO: Enable Prefab https://android-developers.googleblog.com/2020/02/native-dependencies-in-android-studio-40.html
# android.enablePrefab=true
# android.prefabVersion=1.0.0

# publication pom properties
POM_NAME=Sentry SDK
POM_DESCRIPTION=SDK for sentry.io
POM_URL=https://github.com/getsentry/sentry-native
POM_SCM_URL=https://github.com/getsentry/sentry-native
POM_SCM_CONNECTION=scm:git:git://github.com/getsentry/sentry-native.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/getsentry/sentry-native.git

POM_LICENCE_NAME=MIT
POM_LICENCE_URL=http://www.opensource.org/licenses/mit-license.php

POM_DEVELOPER_ID=getsentry
POM_DEVELOPER_NAME=Sentry Team and Contributors
POM_DEVELOPER_URL=https://github.com/getsentry/

POM_ARTIFACT_ID=sentry-native-ndk

systemProp.org.gradle.internal.http.socketTimeout=120000

android.nonTransitiveRClass=true

android.suppressUnsupportedCompileSdk=34
android.suppressUnsupportedCompileSdk=35
2 changes: 1 addition & 1 deletion ndk/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading