Skip to content

Commit

Permalink
Format Gradle files
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Jan 20, 2023
1 parent d513958 commit af2a9a5
Show file tree
Hide file tree
Showing 13 changed files with 2,327 additions and 2,209 deletions.
1,833 changes: 947 additions & 886 deletions build.gradle

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions checker-qual-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
evaluationDependsOn(':checker-qual')

task copySources(type: Copy) {
description 'Copy checker-qual source to checker-qual-android'
description 'Copy checker-qual source to checker-qual-android'

includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
delete file('src')
}
from files('../checker-qual/src/main')
include '**/*.java'
exclude '**/SignednessUtilExtra.java'
into file('src/main')
includeEmptyDirs = false
doFirst {
// Delete the directory in case a previously copied file should no longer be in checker-qual
delete file('src')
}
from files('../checker-qual/src/main')
include '**/*.java'
exclude '**/SignednessUtilExtra.java'
into file('src/main')

// Not read only because "replaceAnnotations" tasks writes to the files.
fileMode(0666)
dirMode(0777)
// Not read only because "replaceAnnotations" tasks writes to the files.
fileMode(0666)
dirMode(0777)
}

sourcesJar.dependsOn(copySources)

/**
* Types annotated with runtime annotations are always kept in the main dex by the default Android Gradle plugin.
* Using the standard Checker Framework annotations can lead to main dex overflows;
* users of the Checker Framework may find themselves unable to build their Android apps.
* By contrast, class-retention annotations are stripped out before packaging by all build systems as a convention.
*/
* Types annotated with runtime annotations are always kept in the main dex by the default Android Gradle plugin.
* Using the standard Checker Framework annotations can lead to main dex overflows;
* users of the Checker Framework may find themselves unable to build their Android apps.
* By contrast, class-retention annotations are stripped out before packaging by all build systems as a convention.
*/
task replaceAnnotations {
doLast {
fileTree(dir: 'src', include: '**/*.java').each {
it.text = it.text.replaceAll('RetentionPolicy.RUNTIME', 'RetentionPolicy.CLASS')
}
doLast {
fileTree(dir: 'src', include: '**/*.java').each {
it.text = it.text.replaceAll('RetentionPolicy.RUNTIME', 'RetentionPolicy.CLASS')
}
}
}
replaceAnnotations.dependsOn copySources

compileJava.dependsOn replaceAnnotations

clean {
delete file('src')
delete file('src')
}

apply from: rootProject.file('gradle-mvn-push.gradle')

/** Adds information to the publication for uploading to Maven repositories. */
final checkerQualAndroidPom(publication) {
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Qual Android'
description = 'checker-qual-android contains annotations (type qualifiers) that a programmer\n' +
'writes to specify Java code for type-checking by the Checker Framework.\n' +
'\n' +
'The checker-qual-android artifact is identical to the checker-qual\n' +
'artifact, except that in checker-qual-android annotations have classfile\n' +
'retention. The default Android Gradle plugin retains types annotated with\n' +
'runtime annotations in the main dex, but strips out class-retention\n' +
'annotations.\n'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Qual Android'
description = 'checker-qual-android contains annotations (type qualifiers) that a programmer\n' +
'writes to specify Java code for type-checking by the Checker Framework.\n' +
'\n' +
'The checker-qual-android artifact is identical to the checker-qual\n' +
'artifact, except that in checker-qual-android annotations have classfile\n' +
'retention. The default Android Gradle plugin retains types annotated with\n' +
'runtime annotations in the main dex, but strips out class-retention\n' +
'annotations.\n'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}
publishing {
publications {
checkerQualAndroid(MavenPublication) {
checkerQualAndroidPom it
}
publications {
checkerQualAndroid(MavenPublication) {
checkerQualAndroidPom it
}
}
}
signing {
sign publishing.publications.checkerQualAndroid
sign publishing.publications.checkerQualAndroid
}
60 changes: 30 additions & 30 deletions checker-qual/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
// Create OSGI bundles
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.3.1'
// Don't add implementation dependencies; checker-qual.jar should have no dependencies.
}
repositories {
mavenCentral()
}
dependencies {
// Create OSGI bundles
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.3.1'
// Don't add implementation dependencies; checker-qual.jar should have no dependencies.
}
}

plugins {
id 'java-library'
id 'java-library'
}

apply plugin: 'biz.aQute.bnd.builder'

jar {
manifest {
attributes('Export-Package': '*')
}
manifest {
attributes('Export-Package': '*')
}
}

apply from: rootProject.file('gradle-mvn-push.gradle')

/** Adds information to the publication for uploading to Maven repositories. */
final checkerQualPom(publication) {
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Qual'
description = 'checker-qual contains annotations (type qualifiers) that a programmer\n' +
'writes to specify Java code for type-checking by the Checker Framework.\n'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Qual'
description = 'checker-qual contains annotations (type qualifiers) that a programmer\n' +
'writes to specify Java code for type-checking by the Checker Framework.\n'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}

publishing {
publications {
checkerQual(MavenPublication) {
checkerQualPom it
}
publications {
checkerQual(MavenPublication) {
checkerQualPom it
}
}
}

signing {
sign publishing.publications.checkerQual
sign publishing.publications.checkerQual
}
42 changes: 21 additions & 21 deletions checker-util/build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
plugins {
id 'java-library'
id 'java-library'
}

dependencies {
api project(':checker-qual')
// Don't add implementation dependencies; checker-util.jar should have no dependencies.
api project(':checker-qual')
// Don't add implementation dependencies; checker-util.jar should have no dependencies.

testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}

apply from: rootProject.file('gradle-mvn-push.gradle')

/** Adds information to the publication for uploading to Maven repositories. */
final checkerUtilPom(publication) {
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Util'
description = 'checker-util contains utility classes for programmers to use at run time.'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
sharedPublicationConfiguration(publication)
publication.from components.java
publication.pom {
name = 'Checker Util'
description = 'checker-util contains utility classes for programmers to use at run time.'
licenses {
license {
name = 'The MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}

publishing {
publications {
checkerUtil(MavenPublication) {
checkerUtilPom it
}
publications {
checkerUtil(MavenPublication) {
checkerUtilPom it
}
}
}

signing {
sign publishing.publications.checkerUtil
sign publishing.publications.checkerUtil
}
Loading

0 comments on commit af2a9a5

Please sign in to comment.