Skip to content

Commit

Permalink
[TEMP-NOT FOR PROD] remove "android" build; temporarily create a task…
Browse files Browse the repository at this point in the history
… for CircleCI to call whilst setting up the replacement android lint task.

Necessary because gradle does not support targeting kotlin at both android and the jvm in the same build, so to introduce `com.android.lint`, the `com.android.library` plugin must be removed.
  • Loading branch information
jack-bolles committed Aug 9, 2023
1 parent 3ac3968 commit eb71ddd
Showing 1 changed file with 58 additions and 76 deletions.
134 changes: 58 additions & 76 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ buildscript {
* If `android` is true, the project will be configured as an Android rather than a Java library. This isn't used
* for building archives (such as an APK), but is useful for performing Android checks like lint.
*/
if (!project.hasProperty("android")) {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'me.champeau.jmh'
} else {
apply plugin: 'com.android.library'
}
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'me.champeau.jmh'

repositories {
google()
Expand Down Expand Up @@ -77,81 +73,56 @@ tasks.register('installLocal') {
}
}

if (!project.hasProperty("android")) {
jar {
archiveBaseName = 'javarosa'
// Be sure to update version in pom.xml to match
// snapshot release = x.x.x-SNAPSHOT
// production release = x.x.x
archiveVersion = '4.3.0-SNAPSHOT'
archiveFileName = "${archiveBaseName}-${archiveVersion}.jar"

manifest {
attributes 'Manifest-Version': "$jar.archiveVersion"
}
}
jar {
archiveBaseName = 'javarosa'
// Be sure to update version in pom.xml to match
// snapshot release = x.x.x-SNAPSHOT
// production release = x.x.x
archiveVersion = '4.3.0-SNAPSHOT'
archiveFileName = "${archiveBaseName}-${archiveVersion}.jar"

// TODO: does not build UML diagrams
javadoc {
failOnError = false
manifest {
attributes 'Manifest-Version': "$jar.archiveVersion"
}
}

jacocoTestReport {
reports {
xml.required = true
}
// TODO: does not build UML diagrams
javadoc {
failOnError = false
}

jacocoTestReport {
reports {
xml.required = true
}
}

// Required to use fileExtensions property in checkstyle file
checkstyle {
toolVersion = '7.6.1'
}
checkstyle {
toolVersion = '7.6.1'
}

jmhJar.doFirst {
new File("build/resources/test").mkdirs()
}
jmhJar.doFirst {
new File("build/resources/test").mkdirs()
}

jmh {
excludes = ["(BenchmarkTemplate)"]
threads = 1
fork = 1
warmup = '2s'
warmupIterations = 10
warmupBatchSize = 1
warmupForks = 1
iterations = 20
timeOnIteration = '2s'
timeUnit = 's'
benchmarkMode = ['avgt', 'ss']
includeTests = true
resultFormat = 'CSV'
forceGC = true

duplicateClassesStrategy = DuplicatesStrategy.WARN
}
} else {
android {
namespace 'com.example'

compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
}
}
}
jmh {
excludes = ["(BenchmarkTemplate)"]
threads = 1
fork = 1
warmup = '2s'
warmupIterations = 10
warmupBatchSize = 1
warmupForks = 1
iterations = 20
timeOnIteration = '2s'
timeUnit = 's'
benchmarkMode = ['avgt', 'ss']
includeTests = true
resultFormat = 'CSV'
forceGC = true

duplicateClassesStrategy = DuplicatesStrategy.WARN
}

dependencies {
Expand All @@ -174,4 +145,15 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'net.sf.kxml:kxml2:2.3.0'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
}
}


abstract class lintDebug extends DefaultTask {
@TaskAction
def analyseLint() {
println 'THIS IS NOT THE TASK YOU WANT. LOOK AT ../reports/lint-results.html'
}
}

// Temporary target so as not to break the CircleCI build. This task will be superseded by the 'lint' task in the main build.
tasks.register('lintDebug', lintDebug)

0 comments on commit eb71ddd

Please sign in to comment.