Skip to content

Commit 51c803b

Browse files
Merge branch 'updates-and-spotbugs' into dev
2 parents 6ca723c + 906e231 commit 51c803b

File tree

12 files changed

+67
-123
lines changed

12 files changed

+67
-123
lines changed

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pipeline {
5454
"--tests io.objectbox.FunctionalTestSuite " +
5555
"--tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
5656
"--tests io.objectbox.rx.QueryObserverTest " +
57-
"assemble"
57+
"spotbugsMain assemble"
5858
}
5959
}
6060

@@ -92,7 +92,7 @@ pipeline {
9292
always {
9393
junit '**/build/test-results/**/TEST-*.xml'
9494
archiveArtifacts artifacts: 'tests/*/hs_err_pid*.log', allowEmptyArchive: true // Only on JVM crash.
95-
// currently unused: archiveArtifacts '**/build/reports/findbugs/*'
95+
recordIssues(tool: spotBugs(pattern: '**/build/reports/spotbugs/*.xml', useRankAsPriority: true))
9696

9797
googlechatnotification url: 'id:gchat_java', message: "${currentBuild.currentResult}: ${currentBuild.fullDisplayName}\n${env.BUILD_URL}",
9898
notifyFailure: 'true', notifyUnstable: 'true', notifyBackToNormal: 'true'

build.gradle

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Just too many sub projects, so each can reference rootProject.version
2-
version = ob_version
3-
41
buildscript {
52
ext {
63
// Typically, only edit those two:
@@ -11,32 +8,40 @@ buildscript {
118
def versionPostFixValue = project.findProperty('versionPostFix')
129
def versionPostFix = versionPostFixValue ? "-$versionPostFixValue" : ''
1310
ob_version = objectboxVersionNumber + (objectboxVersionRelease? "" : "$versionPostFix-SNAPSHOT")
14-
println "ObjectBox Java version $ob_version"
15-
16-
ob_expected_version = project.hasProperty('expectedVersion') ? project.property('expectedVersion') : 'UNDEFINED'
1711

18-
// Core version for tests
12+
// Native library version for tests
1913
// Be careful to diverge here; easy to forget and hard to find JNI problems
20-
ob_native_version = objectboxVersionNumber + (objectboxVersionRelease? "": "-dev-SNAPSHOT")
21-
14+
def nativeVersion = objectboxVersionNumber + (objectboxVersionRelease? "": "-dev-SNAPSHOT")
2215
def osName = System.getProperty("os.name").toLowerCase()
23-
objectboxPlatform = osName.contains('linux') ? 'linux'
16+
def objectboxPlatform = osName.contains('linux') ? 'linux'
2417
: osName.contains("windows")? 'windows'
2518
: osName.contains("mac")? 'macos'
2619
: 'unsupported'
20+
ob_native_dep = "io.objectbox:objectbox-$objectboxPlatform:$nativeVersion"
2721

28-
objectboxNativeDependency = "io.objectbox:objectbox-$objectboxPlatform:$ob_native_version"
29-
println "ObjectBox native dependency: $objectboxNativeDependency"
22+
junit_version = '4.13'
23+
24+
println "version=$ob_version"
25+
println "objectboxNativeDependency=$ob_native_dep"
3026
}
31-
ext.junit_version = '4.13'
3227

3328
repositories {
3429
mavenCentral()
3530
jcenter()
31+
maven {
32+
url "https://plugins.gradle.org/m2/"
33+
}
34+
}
35+
36+
dependencies {
37+
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.0.5"
3638
}
3739
}
3840

3941
allprojects {
42+
group = 'io.objectbox'
43+
version = ob_version
44+
4045
repositories {
4146
mavenCentral()
4247
jcenter()
@@ -95,34 +100,41 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
95100

96101
if (preferredRepo == 'local') {
97102
repository url: repositories.mavenLocal().url
98-
} else if (preferredRepo != null
103+
println "Uploading archives to mavenLocal()."
104+
} else if (preferredRepo != null
99105
&& project.hasProperty('preferredUsername')
100106
&& project.hasProperty('preferredPassword')) {
101107
configuration = configurations.deployerJars
108+
102109
// replace placeholders
103110
def repositoryUrl = preferredRepo
104111
.replace('__groupId__', project.group)
105112
.replace('__artifactId__', project.archivesBaseName)
106113
repository(url: repositoryUrl) {
107114
authentication(userName: preferredUsername, password: preferredPassword)
108115
}
109-
} else if (project.hasProperty('sonatypeUsername')
116+
117+
println "Uploading archives to $repositoryUrl."
118+
} else if (project.hasProperty('sonatypeUsername')
110119
&& project.hasProperty('sonatypePassword')) {
111120
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
121+
112122
def isSnapshot = version.endsWith('-SNAPSHOT')
113-
def sonatypeRepositoryUrl = isSnapshot ?
114-
"https://oss.sonatype.org/content/repositories/snapshots/"
123+
def sonatypeRepositoryUrl = isSnapshot
124+
? "https://oss.sonatype.org/content/repositories/snapshots/"
115125
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
116126
repository(url: sonatypeRepositoryUrl) {
117127
authentication(userName: sonatypeUsername, password: sonatypePassword)
118128
}
129+
130+
println "Uploading archives to $sonatypeRepositoryUrl."
119131
} else {
120-
println "Deployment settings missing/incomplete for ${project.name}."
132+
println "WARNING: preferredRepo NOT set, can not upload archives."
121133
}
122134

123135
pom.project {
124136
packaging 'jar'
125-
url 'http://objectbox.io'
137+
url 'https://objectbox.io'
126138

127139
scm {
128140
url 'https://github.com/objectbox/objectbox-java'
@@ -144,7 +156,7 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
144156

145157
organization {
146158
name 'ObjectBox Ltd.'
147-
url 'http://objectbox.io'
159+
url 'https://objectbox.io'
148160
}
149161
}
150162
}
@@ -153,36 +165,6 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
153165
}
154166
}
155167

156-
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
157-
task installAll {
158-
group 'deploy'
159-
dependsOn ':objectbox-java-api:install'
160-
dependsOn ':objectbox-java:install'
161-
dependsOn ':objectbox-kotlin:install'
162-
dependsOn ':objectbox-rxjava:install'
163-
doLast {
164-
println("Installed version $version")
165-
}
166-
}
167-
168-
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
169-
task deployAll {
170-
group 'deploy'
171-
dependsOn ':objectbox-java-api:uploadArchives'
172-
dependsOn ':objectbox-java:uploadArchives'
173-
dependsOn ':objectbox-kotlin:uploadArchives'
174-
dependsOn ':objectbox-rxjava:uploadArchives'
175-
}
176-
177-
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
178-
task verifyVersion {
179-
group 'verify'
180-
dependsOn ':objectbox-java:verifyVersion'
181-
doLast {
182-
assert ob_expected_version == version
183-
}
184-
}
185-
186168
wrapper {
187169
distributionType = Wrapper.DistributionType.ALL
188170
}

gradle/wrapper/gradle-wrapper.jar

3.01 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154154
else
155155
eval `echo args$i`="\"$arg\""
156156
fi
157-
i=$((i+1))
157+
i=`expr $i + 1`
158158
done
159159
case $i in
160-
(0) set -- ;;
161-
(1) set -- "$args0" ;;
162-
(2) set -- "$args0" "$args1" ;;
163-
(3) set -- "$args0" "$args1" "$args2" ;;
164-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
160+
0) set -- ;;
161+
1) set -- "$args0" ;;
162+
2) set -- "$args0" "$args1" ;;
163+
3) set -- "$args0" "$args1" "$args2" ;;
164+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170170
esac
171171
fi
172172

@@ -175,14 +175,9 @@ save () {
175175
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176176
echo " "
177177
}
178-
APP_ARGS=$(save "$@")
178+
APP_ARGS=`save "$@"`
179179

180180
# Collect all arguments for the java command, following the shell quoting and substitution rules
181181
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182182

183-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185-
cd "$(dirname "$0")"
186-
fi
187-
188183
exec "$JAVACMD" "$@"

gradlew.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

objectbox-java-api/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
apply plugin: 'java'
22

3-
group = 'io.objectbox'
4-
version= rootProject.version
5-
63
sourceCompatibility = JavaVersion.VERSION_1_8
74
targetCompatibility = JavaVersion.VERSION_1_8
85

objectbox-java/build.gradle

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
apply plugin: 'java'
2-
apply plugin: 'findbugs'
3-
4-
group = 'io.objectbox'
5-
version= rootProject.version
2+
apply plugin: "com.github.spotbugs"
63

74
sourceCompatibility = JavaVersion.VERSION_1_8
85
targetCompatibility = JavaVersion.VERSION_1_8
96

10-
tasks.withType(FindBugs) {
11-
reports {
12-
xml.enabled false
13-
html.enabled true
14-
}
15-
ignoreFailures = true
16-
}
17-
187
dependencies {
198
compile fileTree(include: ['*.jar'], dir: 'libs')
209
compile project(':objectbox-java-api')
@@ -23,6 +12,10 @@ dependencies {
2312
compile 'com.google.code.findbugs:jsr305:3.0.2'
2413
}
2514

15+
spotbugs {
16+
ignoreFailures = true
17+
}
18+
2619
javadoc {
2720
// Hide internal API from javadoc artifact.
2821
exclude("**/io/objectbox/Cursor.java")
@@ -143,23 +136,3 @@ uploadArchives {
143136
}
144137
}
145138
}
146-
147-
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
148-
task verifyVersion {
149-
group 'verify'
150-
doLast {
151-
// verify version in Boxstore.java
152-
File storeFile = file('src/main/java/io/objectbox/BoxStore.java')
153-
def versionLine = storeFile.filterLine { line ->
154-
line.contains("String VERSION =")
155-
}.toString()
156-
157-
if (versionLine == null || versionLine.empty) {
158-
throw new GradleException('Could not find VERSION in ObjectStore.cpp')
159-
}
160-
161-
// matches snippet like '12.34.56'
162-
def boxStoreVersion = versionLine.find("\\d+\\.\\d+\\.\\d+")
163-
assert ob_expected_version == boxStoreVersion
164-
}
165-
}

objectbox-kotlin/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
group = 'io.objectbox'
2-
version= rootProject.version
3-
41
buildscript {
52
ext.javadocDir = "$buildDir/docs/javadoc"
63
ext.kotlin_version = '1.3.61'

objectbox-rxjava/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
apply plugin: 'java'
22

3-
group = 'io.objectbox'
4-
version= rootProject.version
5-
63
sourceCompatibility = JavaVersion.VERSION_1_8
74
targetCompatibility = JavaVersion.VERSION_1_8
85

0 commit comments

Comments
 (0)