Update CI

This commit is contained in:
Matthieu 2022-12-31 14:30:57 +01:00
parent 04244bacff
commit e27224725d
8 changed files with 167 additions and 63 deletions

View File

@ -1,4 +1,4 @@
image: registry.gitlab.com/fdroid/ci-images-client
image: registry.gitlab.com/fdroid/fdroidserver:buildserver-bullseye
variables:
GIT_SUBMODULE_STRATEGY: recursive
@ -6,16 +6,42 @@ variables:
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
.base:
before_script:
- test -e /etc/apt/sources.list.d/bullseye-backports.list
|| echo "deb http://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list
- apt update
- apt-get -qy install -t bullseye-backports --no-install-recommends git sdkmanager
- test -n "$ANDROID_HOME" || source /etc/profile.d/bsenv.sh
- export cmdline_tools_latest="$ANDROID_HOME/cmdline-tools/latest/bin"
- test -e $cmdline_tools_latest && export PATH="$cmdline_tools_latest:$PATH"
- export GRADLE_USER_HOME=$PWD/.gradle
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
- apt-get update || apt-get update
- apt-get install -y openjdk-17-jdk-headless
- update-alternatives --auto java
after_script:
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
cache:
paths:
- .gradle/wrapper
- .gradle/caches
# Basic android and gradle stuff
# Check linting
lintDebug:
extends: .base
interruptible: true
stage: build
script:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
- ./gradlew checkLicenses
- ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint --write-verification-metadata sha256
- git diff --quiet gradle/verification-metadata.xml || (echo 'Verification of dependencies failed!' && exit 1)
artifacts:
@ -26,14 +52,12 @@ lintDebug:
# Make Project
assembleDebug:
extends: .base
interruptible: true
stage: build
tags:
- server_artectrex
script:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
- ./gradlew assembleDebug
artifacts:
paths:
@ -41,15 +65,14 @@ assembleDebug:
# Run all tests, if any fails, interrupt the pipeline (fail it)
debugTests:
extends: .base
interruptible: true
stage: test
script:
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
- ./gradlew -Pci --console=plain :app:testDebug -x lint
.connected-template: &connected-template
extends: .base
allow_failure: true
stage: test
script:
@ -58,9 +81,6 @@ debugTests:
- adb devices
- adb shell input keyevent 82 &
# Switch to right java version for building the app
- apt-get update || apt-get update
- apt-get install -y openjdk-11-jdk-headless
- update-alternatives --auto java
- ./gradlew connectedStagingAndroidTest --info || (adb -e logcat -d > logcat.txt; exit 1)
artifacts:
paths:

View File

@ -1,16 +1,18 @@
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
id "com.cookpad.android.plugin.license-tools" version "1.2.8"
id "com.mikepenz.aboutlibraries.plugin" version "10.5.2"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: "kotlin-parcelize"
// Force latest version of Jacoco, initially done to resolve https://github.com/jacoco/jacoco/issues/1155
jacoco.toolVersion = "0.8.7"
@ -25,6 +27,7 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
@ -236,6 +239,8 @@ dependencies {
implementation 'me.relex:circleindicator:2.1.6'
implementation "com.mikepenz:aboutlibraries-core:10.5.2"
/**
* Not in release, so not mentioned in licenses list
*/

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,9 @@
package org.pixeldroid.app.settings
import android.os.Bundle
import com.google.gson.Gson
import com.mikepenz.aboutlibraries.Libs
import org.pixeldroid.app.R
import org.pixeldroid.app.databinding.OpenSourceLicenseBinding
import org.pixeldroid.app.settings.licenseObjects.Libraries
import org.pixeldroid.app.settings.licenseObjects.OpenSourceItem
import org.pixeldroid.app.utils.BaseThemedWithBarActivity
/**
@ -30,12 +28,14 @@ class LicenseActivity: BaseThemedWithBarActivity() {
}
private fun setupRecyclerView() {
val text: String = applicationContext.assets.open("licenses.json")
val aboutLibsJson: String = applicationContext.resources.openRawResource(R.raw.aboutlibraries)
.bufferedReader().use { it.readText() }
val listObj: List<OpenSourceItem> = Gson().fromJson(text, Libraries::class.java).libraries
val libs = Libs.Builder()
.withJson(aboutLibsJson)
.build()
val adapter = OpenSourceLicenseAdapter(listObj)
val adapter = OpenSourceLicenseAdapter(libs)
binding.openSourceLicenseRecyclerView.adapter = adapter
}
}

View File

@ -6,10 +6,11 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.entity.Library
import org.pixeldroid.app.databinding.OpenSourceItemBinding
import org.pixeldroid.app.settings.licenseObjects.OpenSourceItem
class OpenSourceLicenseAdapter(private val openSourceItems: List<OpenSourceItem>) :
class OpenSourceLicenseAdapter(private val openSourceItems: Libs) :
RecyclerView.Adapter<OpenSourceLicenseAdapter.OpenSourceLicenceViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OpenSourceLicenceViewHolder
@ -19,43 +20,35 @@ class OpenSourceLicenseAdapter(private val openSourceItems: List<OpenSourceItem>
}
override fun onBindViewHolder(holder: OpenSourceLicenceViewHolder, position: Int) {
val item = openSourceItems[position]
val item = openSourceItems.libraries[position]
holder.bind(item)
}
override fun getItemCount(): Int = openSourceItems.size
override fun getItemCount(): Int = openSourceItems.libraries.size
class OpenSourceLicenceViewHolder(val binding: OpenSourceItemBinding) :
RecyclerView.ViewHolder(binding.root) {
@SuppressLint("SetTextI18n")
fun bind(item: OpenSourceItem) {
fun bind(item: Library) {
with(binding) {
if (!item.libraryName.isNullOrEmpty()) {
if (item.name.isNotEmpty()) {
title.isVisible = true
title.text = "${item.libraryName}"
title.text = item.name
} else {
title.isVisible = false
}
val license = item.license
if (license != null) {
val licenseUrl = item.licenseUrl?.let { " (${it} )" } ?: ""
copyright.isVisible = true
copyright.apply {
text = "$license$licenseUrl"
movementMethod = LinkMovementMethod.getInstance()
}
} else {
copyright.isVisible = false
val license = item.licenses.firstOrNull()
val licenseName = license?.name ?: ""
val licenseUrl = license?.url?.let { " (${it} )" } ?: ""
copyright.isVisible = true
copyright.apply {
text = "$licenseName$licenseUrl"
movementMethod = LinkMovementMethod.getInstance()
}
if (item.url != null || item.copyrightHolder != null) {
val licenseUrl = item.url?.let { " (${it} )" } ?: ""
url.isVisible = true
url.apply {
text = "${item.copyrightHolder ?: ""}$licenseUrl"
movementMethod = LinkMovementMethod.getInstance()
}
} else {
url.isVisible = false
url.isVisible = true
url.apply {
text = "${item.developers.firstOrNull()?.name ?: ""} ${item.website}"
movementMethod = LinkMovementMethod.getInstance()
}
}
}

View File

@ -1,5 +0,0 @@
package org.pixeldroid.app.settings.licenseObjects
data class Libraries(
val libraries: List<OpenSourceItem>
)

View File

@ -1,10 +0,0 @@
package org.pixeldroid.app.settings.licenseObjects
data class OpenSourceItem(
val libraryName: String?,
val copyrightHolder: String?,
val url: String?,
val license: String?,
val licenseUrl: String?,
)

View File

@ -235,6 +235,9 @@
<artifact name="camera-camera2-1.2.0.module">
<sha256 value="096ee4c475af5e0f695637696d310cce0fdb74db7c2319bc538b9c27a8a5d321" origin="Generated by Gradle"/>
</artifact>
<artifact name="camera-camera2-1.2.0.pom">
<sha256 value="ae88195fc55b1cc5ffe6613aca3e57d10212f98c89787a722869076d9e2aac06" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.camera" name="camera-core" version="1.1.0">
<artifact name="camera-core-1.1.0.aar">
@ -254,6 +257,9 @@
<artifact name="camera-core-1.2.0.module">
<sha256 value="cbe32874c1f3701ac1c3d85f67c2fbd27f0838bb9408c3513e7adbd957980a20" origin="Generated by Gradle"/>
</artifact>
<artifact name="camera-core-1.2.0.pom">
<sha256 value="1cf0bb2e47f6d669f7a2e705d48060286e3c8ca0a304fa82af5cbb081bcbcccf" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.camera" name="camera-lifecycle" version="1.1.0">
<artifact name="camera-lifecycle-1.1.0.aar">
@ -273,6 +279,9 @@
<artifact name="camera-lifecycle-1.2.0.module">
<sha256 value="26ead4268d4a3d376e7fbd8d750ee1d72cdd97042455d92e9acc62495c9f81a7" origin="Generated by Gradle"/>
</artifact>
<artifact name="camera-lifecycle-1.2.0.pom">
<sha256 value="303291b0721de4e81fb20b222aacf49081fc13e16a7101a277af896440250979" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.camera" name="camera-view" version="1.1.0">
<artifact name="camera-view-1.1.0.aar">
@ -292,6 +301,9 @@
<artifact name="camera-view-1.2.0.module">
<sha256 value="a9b9f060b0356a73fa0b5ac50b6728c3197d846c11398ea402c1f200666a3bd4" origin="Generated by Gradle"/>
</artifact>
<artifact name="camera-view-1.2.0.pom">
<sha256 value="1ee8cf67bd25723c915d853e5e21eb74f158b5ad028ba6bbc9280e21dfe74b1a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.cardview" name="cardview" version="1.0.0">
<artifact name="cardview-1.0.0.aar">
@ -534,6 +546,9 @@
<artifact name="databinding-adapters-8.0.0-alpha10.module">
<sha256 value="dd7f56555737db4a6d496dfd51f17ffb12a163908f80adccd7e1d48347cd8345" origin="Generated by Gradle"/>
</artifact>
<artifact name="databinding-adapters-8.0.0-alpha10.pom">
<sha256 value="d505f5e8401481b30b1516572a7d6101e773205704487e712fa6e4df8a772a98" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.databinding" name="databinding-common" version="7.3.1">
<artifact name="databinding-common-7.3.1.jar">
@ -700,6 +715,9 @@
<artifact name="databinding-ktx-8.0.0-alpha10.module">
<sha256 value="9bca0924c7e8f76a8a26f4607cba4de4806ee53f729c3a288ddcf6d4dd822cd0" origin="Generated by Gradle"/>
</artifact>
<artifact name="databinding-ktx-8.0.0-alpha10.pom">
<sha256 value="160f252acccd73fb15dc907c443722347b609fd2603a1d99eec48f9028dde119" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.databinding" name="databinding-runtime" version="7.3.1">
<artifact name="databinding-runtime-7.3.1.aar">
@ -746,6 +764,9 @@
<artifact name="databinding-runtime-8.0.0-alpha10.module">
<sha256 value="9059fbc9431cd548c063ce71864d2a0b8f2979e33f969e56f4e53b10c37d46ee" origin="Generated by Gradle"/>
</artifact>
<artifact name="databinding-runtime-8.0.0-alpha10.pom">
<sha256 value="597b4a1beced0c2170daa455cdf3d292690d0bca1beeaa4f17e0d1387ee84cf6" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.databinding" name="viewbinding" version="7.3.1">
<artifact name="viewbinding-7.3.1.aar">
@ -792,6 +813,9 @@
<artifact name="viewbinding-8.0.0-alpha10.module">
<sha256 value="b5d00f210786272015cfee16867d4b1fe36502bb9f64bec9cac6939bf5f462a9" origin="Generated by Gradle"/>
</artifact>
<artifact name="viewbinding-8.0.0-alpha10.pom">
<sha256 value="811761a6c9fe8080bb65f821d6392d22d1aa76596eea327efab39d9cdd035f7d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.documentfile" name="documentfile" version="1.0.0">
<artifact name="documentfile-1.0.0.aar">
@ -936,6 +960,9 @@
<artifact name="fragment-1.5.5.module">
<sha256 value="eb7e7828fe8bbcd990fa44fbd0022b63b316abc76fc54dca5f1644f9d8558dee" origin="Generated by Gradle"/>
</artifact>
<artifact name="fragment-1.5.5.pom">
<sha256 value="1d8a34982df04172c91ea81ae9c55f46d101acfe5a90b84289d2dd587b71ccef" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.fragment" name="fragment-ktx" version="1.5.4">
<artifact name="fragment-ktx-1.5.4.aar">
@ -955,6 +982,9 @@
<artifact name="fragment-ktx-1.5.5.module">
<sha256 value="dc33a288b47e603176ecdea89a1660b1f7783a9423d4cba1dccf805cbd83f168" origin="Generated by Gradle"/>
</artifact>
<artifact name="fragment-ktx-1.5.5.pom">
<sha256 value="991f6aa00e95aa14709f001db3e381b9c20cb855eaf3a0c44bf63195e56d1b15" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.gridlayout" name="gridlayout" version="1.0.0">
<artifact name="gridlayout-1.0.0.aar">
@ -4882,6 +4912,33 @@
<sha256 value="a520e23acd8d19a8daa7287494ca7fe89040df56643095d783ea27187f107cd8" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz" name="aboutlibraries-core" version="10.5.2">
<artifact name="aboutlibraries-core-10.5.2.module">
<sha256 value="cc0c33082d4795961bc7fba39a22019017300984bf669c91dc004ab40b53acc3" origin="Generated by Gradle"/>
</artifact>
<artifact name="aboutlibraries-core-metadata-10.5.2.jar">
<sha256 value="a49b5ce2454535805028cf2697e5d6b4258db67f1051bf92caa10ca80ec2b093" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz" name="aboutlibraries-core-android" version="10.5.2">
<artifact name="aboutlibraries-core-android-10.5.2.module">
<sha256 value="0789422579a015747ff60c3cbc3ae2e7e598217cc2acf2ec47175bb803ba3eac" origin="Generated by Gradle"/>
</artifact>
<artifact name="aboutlibraries-core-release.aar">
<sha256 value="8967fe0990e193b25a241696cb5f86ce749b8891331f2aee9b46d11f49acc066" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz" name="aboutlibraries-core-android-debug" version="10.5.2">
<artifact name="aboutlibraries-core-android-debug-10.5.2.module">
<sha256 value="b1d0eb084cdf5e43de799024549dad8e3d3a0e1c767c17c51732e3b76f9712f1" origin="Generated by Gradle"/>
</artifact>
<artifact name="aboutlibraries-core-android-debug-10.5.2.pom">
<sha256 value="86d97f3d1f6863418f87b6fb01792f0fca368fd8ff58d1d5c55fb904db6072a9" origin="Generated by Gradle"/>
</artifact>
<artifact name="aboutlibraries-core-debug.aar">
<sha256 value="6378d419ad7b3d6ad52e94ff6bd98657a97f0a54c90883e4e4219a710243f23c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz" name="fastadapter" version="5.6.0">
<artifact name="fastadapter-5.6.0.aar">
<sha256 value="6f6924ec1a788e54f8b7c2ce64866abe5dbb08f9cccea5a9abfaac1ae8a6bc83" origin="Generated by Gradle"/>
@ -4981,6 +5038,19 @@
<sha256 value="e44ed0578661e824decfaa5c1366e1cf1f1e54f829b502bb0ddc57cbefe327b0" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz.aboutlibraries.plugin" name="aboutlibraries-plugin" version="10.5.2">
<artifact name="aboutlibraries-plugin-10.5.2.jar">
<sha256 value="f0bcd7b557318d6adcb710219ad175b04108be88dec6493faa8d3d7e0fc7c899" origin="Generated by Gradle"/>
</artifact>
<artifact name="aboutlibraries-plugin-10.5.2.pom">
<sha256 value="0cce1c7b6ef59d7303814f731acc893dee4fe970a61cbdc41f75b08a7e1cbc3e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.mikepenz.aboutlibraries.plugin" name="com.mikepenz.aboutlibraries.plugin.gradle.plugin" version="10.5.2">
<artifact name="com.mikepenz.aboutlibraries.plugin.gradle.plugin-10.5.2.pom">
<sha256 value="7ffbfd8386830632b9cb49e0af9bb002f0cdd9b9f3ec2f0a2237ab6fe96bfa1a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.nhaarman.mockitokotlin2" name="mockito-kotlin" version="2.2.0">
<artifact name="mockito-kotlin-2.2.0.jar">
<sha256 value="75b58d04f72748b564f5acfe646bc9c8b04d1eba02fff3225a0e667fd370d2f7" origin="Generated by Gradle"/>
@ -5865,6 +5935,11 @@
<sha256 value="bc10624e0623f36577fac5639ca2936d3240ed152fb6d8d533ab4d270543491c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache" name="apache" version="7">
<artifact name="apache-7.pom">
<sha256 value="1397ce1db433adc9f223dbf07496d133681448751f4ae29e58f68e78fb4b6c25" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache" name="apache" version="9">
<artifact name="apache-9.pom">
<sha256 value="4946e60a547c8eda69f3bc23c5b6f0dadcf8469ea49b1d1da7de34aecfcf18dd" origin="Generated by Gradle"/>
@ -6030,6 +6105,14 @@
<sha256 value="a67538865ae0f3744b21e91ca47d461054737c552d1ff29da714c860c992d5bb" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.ivy" name="ivy" version="2.5.0">
<artifact name="ivy-2.5.0.jar">
<sha256 value="2f4c835b52311df922f8a8eb057843de5485088b234ccd03e478b9066b5e6bfc" origin="Generated by Gradle"/>
</artifact>
<artifact name="ivy-2.5.0.pom">
<sha256 value="516106ddc6a4fc14445e5ea309710faba423d4591ed7667fff5f8c074ace2f18" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.bitbucket.b_c" name="jose4j" version="0.7.0">
<artifact name="jose4j-0.7.0.jar">
<sha256 value="eb14f69c0395d4a106c6c46fe6dff080c4608ccabc99b1f03933d374383d9bbe" origin="Generated by Gradle"/>
@ -7094,6 +7177,22 @@
<sha256 value="52d84bd1dbff23b674806670de4e757985b2c54f41cadca48846e667d1d44ffd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-core" version="1.4.0">
<artifact name="kotlinx-serialization-core-1.4.0.module">
<sha256 value="5f4c675a8f7763baca9b87dd0f29f6b2e09d044c5b70ec5c889aff4712e07196" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlinx-serialization-core-metadata-1.4.0-all.jar">
<sha256 value="56bb309b07ef710ba302c58f80f94c5e17b5013a86497032f64e535bffaaa510" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-json" version="1.4.0">
<artifact name="kotlinx-serialization-json-1.4.0.module">
<sha256 value="b5e0f5d53c6c44a4e8342127e4cffea521529b246bbdb17de721cbc397bd75ad" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlinx-serialization-json-metadata-1.4.0-all.jar">
<sha256 value="409b6d870b42b4c105dc8d1261bae32655210620e44c947dbd608ce4dbf5b232" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.json" name="json" version="20180813">
<artifact name="json-20180813.jar">
<sha256 value="518080049ba83181914419d11a25d9bc9833a2d729b6a6e7469fa52851356da8" origin="Generated by Gradle"/>
@ -7274,6 +7373,9 @@
<artifact name="android-media-editor-1.4.module">
<sha256 value="c35b56e0f49ebfda3379efe357d0a5dabdb9ebf36a7076c680a1c924c1cd03a7" origin="Generated by Gradle"/>
</artifact>
<artifact name="android-media-editor-1.4.pom">
<sha256 value="ea5722708e6ed387ecf333bf24abf6501dcde17934e55822082212c7a76d08f9" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.reactivestreams" name="reactive-streams" version="1.0.3">
<artifact name="reactive-streams-1.0.3.pom">