11import org.jetbrains.kotlin.config.KotlinCompilerVersion
2+ import com.novoda.gradle.release.PublishExtension
23
34plugins {
45 id(" com.android.library" )
56 kotlin(" android" )
67 jacoco
78 id(" net.ltgt.errorprone" )
9+ maven
10+ id(Config .Deploy .novodaBintrayId)
11+ signing
812}
913
1014android {
@@ -23,7 +27,8 @@ android {
2327
2428 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
2529
26- versionName = " $version "
30+ versionName = project.version.toString()
31+ versionCode = Config .Sentry .buildVersionCode
2732
2833 buildConfigField(" String" , " SENTRY_CLIENT_NAME" , " \" ${Config .Sentry .SENTRY_CLIENT_NAME } \" " )
2934 }
@@ -74,11 +79,11 @@ dependencies {
7479 // libs
7580 implementation(Config .Libs .gson)
7681
77- compileOnly(Config .CompileOnly .noopen )
78- errorprone(Config .CompileOnly .noopenProne )
82+ compileOnly(Config .CompileOnly .nopen )
83+ errorprone(Config .CompileOnly .nopenChecker )
7984 errorprone(Config .CompileOnly .errorprone)
80- errorproneJavac(Config .CompileOnly .errorProneJavac )
81- compileOnly(Config .CompileOnly .annotations )
85+ errorproneJavac(Config .CompileOnly .errorProneJavac8 )
86+ compileOnly(Config .CompileOnly .jetbrainsAnnotations )
8287
8388 // tests
8489 testImplementation(kotlin(Config .kotlinStdLib, KotlinCompilerVersion .VERSION ))
@@ -89,3 +94,64 @@ dependencies {
8994 testImplementation(Config .TestLibs .androidxJunit)
9095 testImplementation(Config .TestLibs .mockitoKotlin)
9196}
97+
98+ // TODO: move thse blocks to parent gradle file, DRY
99+ configure<PublishExtension > {
100+ userOrg = Config .Sentry .userOrg
101+ groupId = project.group.toString()
102+ publishVersion = project.version.toString()
103+ desc = Config .Sentry .description
104+ website = Config .Sentry .website
105+ repoName = Config .Sentry .repoName
106+ setLicences(Config .Sentry .licence)
107+ issueTracker = Config .Sentry .issueTracker
108+ repository = Config .Sentry .repository
109+ dryRun = Config .Deploy .dryRun
110+ override = Config .Deploy .override
111+ // TODO: uncomment it to publish new version, waiting PR to be merged
112+ // sign = Config.Deploy.sign
113+ artifactId = " sentry-android-core"
114+ }
115+
116+ gradle.taskGraph.whenReady {
117+ allTasks.find {
118+ it.path == " :${project.name} ::generatePomFileForReleasePublication"
119+ }?.doLast {
120+ println (" delete file: " + file(" build/publications/release/pom-default.xml" ).delete())
121+ println (" Overriding pom-file to make sure we can sync to maven central!" )
122+
123+ maven.pom {
124+ withGroovyBuilder {
125+ " project" {
126+ " name" (project.name)
127+ " artifactId" (" sentry-android-core" )
128+ " packaging" (" aar" )
129+ " description" (Config .Sentry .description)
130+ " url" (Config .Sentry .website)
131+ " version" (project.version.toString())
132+
133+ " scm" {
134+ " url" (Config .Sentry .repository)
135+ " connection" (Config .Sentry .repository)
136+ " developerConnection" (Config .Sentry .repository)
137+ }
138+
139+ " licenses" {
140+ " license" {
141+ " name" (Config .Sentry .licence)
142+ }
143+ }
144+
145+ " developers" {
146+ " developer" {
147+ " id" (Config .Sentry .devUser)
148+ " name" (Config .Sentry .devName)
149+ " email" (Config .Sentry .devEmail)
150+ }
151+ }
152+ }
153+ }
154+
155+ }.writeTo(" build/publications/release/pom-default.xml" )
156+ }
157+ }
0 commit comments