Merge pull request #899 from nextcloud/fixCI

Fix CI
This commit is contained in:
Tobias Kaminsky 2020-09-29 08:58:16 +02:00 committed by GitHub
commit 3170aebab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 11 deletions

View File

@ -17,16 +17,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.github.spotbugs.snom.SpotBugsTask
apply plugin: 'com.android.application'
//apply plugin: 'findbugs'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.spotbugs'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlinx-serialization'
def taskRequest = getGradle().getStartParameter().getTaskRequests().toString()
if (taskRequest.contains("Gplay") || taskRequest.contains("findbugs") ||
if (taskRequest.contains("Gplay") || taskRequest.contains("spotbugs") ||
taskRequest.contains("lint")) {
apply from: 'gplay.gradle'
}
@ -151,6 +153,26 @@ android {
htmlOutput file("$project.buildDir/reports/lint/lint.html")
disable 'MissingTranslation'
}
android.applicationVariants.all { variant ->
String variantName = variant.name
String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1)
tasks.register("spotbugs${capVariantName}Report", SpotBugsTask) {
ignoreFailures = true // should continue checking
effort = "max"
reportLevel = "medium"
classes = fileTree("${project.rootDir}/app/build/intermediates/javac/${variantName}/classes/com/nextcloud/talk/")
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
reports {
xml.enabled = false
html {
enabled = true
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
}
}
}
}
}
ext {
@ -325,4 +347,7 @@ dependencies {
})
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'com.github.Kennyc1012:BottomSheet:2.4.1'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'
}

View File

@ -81,6 +81,11 @@
android:name="android.max_aspect"
android:value="10" />
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities=".workmanager-init"
android:exported="false"
tools:node="remove" />
<activity
android:name=".activities.MainActivity"

View File

@ -31,14 +31,18 @@ buildscript {
maven {
url 'https://jitpack.io'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
maven {
url 'https://maven.mozilla.org/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

View File

@ -11,7 +11,7 @@
ruby scripts/analysis/lint-up.rb $1 $2 $3
lintValue=$?
./gradlew assembleGplay app:findbugs
./gradlew assembleGplayDebug spotbugsGplayDebugReport
# exit codes:
# 0: count was reduced
@ -22,9 +22,9 @@ echo "Branch: $3"
if [ $3 = "master" ]; then
echo "New findbugs result for master at: https://www.kaminsky.me/nc-dev/talk-findbugs/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/master.html --upload-file app/build/reports/findbugs/findbugs.html
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/master.html --upload-file app/build/reports/spotbugs/spotbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/findbugs/findbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/findbugs.html
if [ $lintValue -ne 1 ]; then
@ -40,7 +40,7 @@ else
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-lint/$6.html --upload-file app/build/reports/lint/lint.html
echo "New findbugs results at https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html"
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/$6.html --upload-file app/build/reports/findbugs/findbugs.html
curl 2>/dev/null -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/$6.html --upload-file app/build/reports/spotbugs/spotbugs.html
# delete all old comments
oldComments=$(curl 2>/dev/null -u $1:$2 -X GET https://api.github.com/repos/nextcloud/talk-android/issues/$7/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) ' | grep true | tr -d "\"" | cut -f1 -d"|")
@ -56,8 +56,8 @@ else
lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/talk-lint/master.html'>Master</a></td><td><a href='https://www.kaminsky.me/nc-dev/talk-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/findbugs/findbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://nextcloud.kaminsky.me/s/oaof9LtJHibyRGx/download | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/talk-findbugs/findbugs.html | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
curl -u $1:$2 -X POST https://api.github.com/repos/nextcloud/talk-android/issues/$7/comments -d "{ \"body\" : \"$lintResult $findbugsResultNew $findbugsResultOld \" }"
if [ $lintValue -eq 2 ]; then

View File

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 4 errors and 238 warnings</span>
<span class="mdl-layout-title">Lint Report: 11 errors and 561 warnings</span>