Commit 3450b0d4 authored by Ricki Hirner's avatar Ricki Hirner

Don't do emulator checks (because we can only use shared runners at the moment); minor lint

parent 913105c5
......@@ -9,9 +9,10 @@ cache:
test:
script:
- (cd /sdk/emulator; ./emulator @test -no-audio -no-window & wait-for-emulator.sh)
- adb install src/androidTest/resources/org.dmfs.tasks_6880.apk
- ./gradlew check connectedCheck
# - (cd /sdk/emulator; ./emulator @test -no-audio -no-window & wait-for-emulator.sh)
# - adb install src/androidTest/resources/org.dmfs.tasks_6880.apk
# - ./gradlew check connectedCheck
- ./gradlew check
artifacts:
paths:
- build/outputs/lint-results-debug.html
......
......@@ -40,12 +40,6 @@ android {
buildConfigField "String", "version_ical4j", "\"$ical4j_version\""
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'AllowBackup'
disable 'InvalidPackage'
......
......@@ -46,6 +46,7 @@ class AndroidCalendarTest {
@After
fun shutdown() {
@Suppress("DEPRECATION")
if (Build.VERSION.SDK_INT >= 24)
provider.close()
else
......
......@@ -67,6 +67,7 @@ class AndroidEventTest {
fun shutdown() {
calendar.delete()
@Suppress("DEPRECATION")
if (Build.VERSION.SDK_INT >= 24)
provider.close()
else
......
......@@ -151,13 +151,13 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
/**
* Queries events from this calendar. Adds a WHERE clause that restricts the
* query to [Events.CALENDAR_ID] = [id].
* @param where selection
* @param whereArgs arguments for selection
* @param _where selection
* @param _whereArgs arguments for selection
* @return events from this calendar which match the selection
*/
fun queryEvents(where: String? = null, whereArgs: Array<String>? = null): List<T> {
val where = "(${where ?: "1"}) AND " + Events.CALENDAR_ID + "=?"
val whereArgs = (whereArgs ?: arrayOf()) + id.toString()
fun queryEvents(_where: String? = null, _whereArgs: Array<String>? = null): List<T> {
val where = "(${_where ?: "1"}) AND " + Events.CALENDAR_ID + "=?"
val whereArgs = (_whereArgs ?: arrayOf()) + id.toString()
val events = LinkedList<T>()
provider.query(eventsSyncURI(), null, where, whereArgs, null)?.use { cursor ->
......
......@@ -59,7 +59,8 @@ abstract class AndroidTaskList<out T: AndroidTask>(
info.put(TaskLists.ACCESS_LEVEL, 0)
Constants.log.info("Creating local task list: " + info.toString())
return provider.client.insert(TaskProvider.syncAdapterUri(provider.taskListsUri(), account), info)
return provider.client.insert(TaskProvider.syncAdapterUri(provider.taskListsUri(), account), info) ?:
throw CalendarStorageException("Couldn't create task list (empty result from provider)")
}
fun<T: AndroidTaskList<AndroidTask>> findByID(account: Account, provider: TaskProvider, factory: AndroidTaskListFactory<T>, id: Long): T {
......@@ -113,13 +114,13 @@ abstract class AndroidTaskList<out T: AndroidTask>(
/**
* Queries tasks from this task list. Adds a WHERE clause that restricts the
* query to [Tasks.LIST_ID] = [id].
* @param where selection
* @param whereArgs arguments for selection
* @param _where selection
* @param _whereArgs arguments for selection
* @return events from this task list which match the selection
*/
fun queryTasks(where: String? = null, whereArgs: Array<String>? = null): List<T> {
val where = "(${where ?: "1"}) AND ${Tasks.LIST_ID}=?"
val whereArgs = (whereArgs ?: arrayOf()) + id.toString()
fun queryTasks(_where: String? = null, _whereArgs: Array<String>? = null): List<T> {
val where = "(${_where ?: "1"}) AND ${Tasks.LIST_ID}=?"
val whereArgs = (_whereArgs ?: arrayOf()) + id.toString()
val tasks = LinkedList<T>()
provider.client.query(
......
......@@ -113,7 +113,7 @@ class TaskProvider private constructor(
class ProviderTooOldException(
val provider: ProviderName,
val installedVersionCode: Int,
installedVersionCode: Int,
val installedVersionName: String
): Exception("Package ${provider.packageName} has version $installedVersionName ($installedVersionCode), " +
"required: ${provider.minVersionName} (${provider.minVersionCode})")
......
......@@ -98,7 +98,7 @@ class TaskTest {
/* helpers */
private fun parseCalendar(fname: String, charset: Charset = Charsets.UTF_8): Task {
javaClass.classLoader.getResourceAsStream("tasks/$fname").use { stream ->
javaClass.classLoader!!.getResourceAsStream("tasks/$fname").use { stream ->
return Task.fromReader(InputStreamReader(stream, charset)).first()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment