Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Enable SonarCloud #88

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
cedb97c
Create Github Actions
pablisco Dec 16, 2019
998eb18
Add stacktrace
pablisco Dec 16, 2019
e4aadfc
Upgraded build scripts
pablisco Dec 16, 2019
2412cf6
Create .sonarcloud.properties
pablisco Dec 16, 2019
05c3c73
Update .sonarcloud.properties
pablisco Dec 16, 2019
af6124f
Update .sonarcloud.properties
pablisco Dec 16, 2019
44aeace
Migrated scripts to kts
pablisco Dec 16, 2019
1ab35c3
Merge branch 'github-actions-ci' into sonar-setup
pablisco Dec 16, 2019
d6a3529
updated to use sonarcloud action
pablisco Dec 16, 2019
5e97f4a
detached demo from main project and fix build
pablisco Dec 16, 2019
241b213
fix layout of yaml
pablisco Dec 16, 2019
0d1c66d
Merge branch 'update-gradle-to-kts' into sonar-setup
pablisco Dec 17, 2019
d4562f7
Updated actions to use the gradle plugin instead of the action
pablisco Dec 17, 2019
b866c55
Update ci.yml
zegnus Dec 17, 2019
56791d6
Create gradle.properties
zegnus Dec 17, 2019
3629309
Create Github Actions (#87)
zegnus Dec 17, 2019
9f20f2c
Merge remote-tracking branch 'origin/develop' into update-gradle-to-kts
zegnus Dec 17, 2019
a5157d4
ammend cache path
zegnus Dec 17, 2019
6aca0cf
use clone 1 level for checkout
zegnus Dec 17, 2019
ccc9f7f
Merge remote-tracking branch 'origin/develop' into sonar-setup
zegnus Dec 17, 2019
04e90ce
ammend cache pattern path
zegnus Dec 17, 2019
08141de
fix resource linking issue
pablisco Dec 17, 2019
afddff1
Merge branch 'update-gradle-to-kts' into sonar-setup
pablisco Dec 17, 2019
b5062ab
Add ci job to run demo tests
pablisco Dec 17, 2019
5673566
Add ci job to run demo tests
pablisco Dec 17, 2019
822c010
Merge branch 'update-gradle-to-kts' into sonar-setup
pablisco Dec 17, 2019
e57dec4
fix yml file
pablisco Dec 17, 2019
1cdc144
Merge branch 'update-gradle-to-kts' into sonar-setup
pablisco Dec 17, 2019
7c2c506
restore sonar checks
pablisco Dec 17, 2019
5d48d65
remove ApplicationTest
pablisco Dec 17, 2019
579c5fb
add sonar cube properties
pablisco Dec 17, 2019
576130c
change settings to use internal sonarqube
pablisco Dec 17, 2019
863c5fb
Updated to use sonarcloud
pablisco Dec 19, 2019
8f05894
Updated sonar logins
pablisco Dec 19, 2019
0f09691
add no daemon to sonarqube
pablisco Dec 19, 2019
97cb6b1
Update gradle to kts (#89)
zegnus Dec 19, 2019
a232d14
Merge branch 'develop' into sonar-setup
pablisco Dec 20, 2019
3bbd255
Update details for sonarqube.io
pablisco Dec 20, 2019
ae3ae8a
revert fancy plugin import
pablisco Dec 20, 2019
3625b08
updated sonarqube to 2.8
pablisco Dec 20, 2019
a3bcf66
change sonar token on ci
pablisco Dec 20, 2019
bc80117
remove depth limit
pablisco Dec 20, 2019
936ea0c
Add build to sonarqube
pablisco Dec 20, 2019
ca23e4c
remove unused import from dependencies script
pablisco Dec 20, 2019
217a043
merge checks
pablisco Dec 20, 2019
780afbc
add test reports to sonar
pablisco Dec 20, 2019
1e30945
trigger new build
pablisco Dec 20, 2019
b9f5a6e
fix paths and add jacoco for java projects
zegnus Dec 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
pull_request:
push:
branches:
- master

env:
GRADLE_USER_HOME: .gradle
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v1

- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Cache dependencies
uses: actions/cache@v1
with:
path: .gradle/caches
key: gradle-cache-${{ hashFiles('**/*.gradle*') }}
restore-keys: gradle-cache

- name: Run Checks
run: ./gradlew build check test jacocoTestReport jacocoTestCoverageVerification sonarqube --no-daemon
42 changes: 0 additions & 42 deletions android/build.gradle

This file was deleted.

42 changes: 42 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
plugins {
id("com.android.library")
id("bintray-release")
jacoco
}

repositories {
google()
jcenter()
}

android {
compileSdkVersion(Versions.AndroidSdk.compile)

defaultConfig {
minSdkVersion(Versions.AndroidSdk.min)
versionCode = 1
}
}

dependencies {
implementation(Libraries.App.supportAppCompat)
api(project(":java"))

testImplementation(Libraries.Test.jUnit)
}

publish {
userOrg = "novoda"
groupId = "com.novoda"
artifactId = "notils-android"
publishVersion = project.version as String
desc = "Never again need a .utils. package yur scurvy Android sea dogs!"
website = "https://github.com/novoda/NoTils"
}

tasks.withType(Test::class.java) {
reports {
html.isEnabled = true
html.destination = file("${buildDir}/reports/jacoco")
}
}

This file was deleted.

8 changes: 5 additions & 3 deletions android/src/main/java/com/novoda/notils/caster/Fragments.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package com.novoda.notils.caster;

import androidx.fragment.app.FragmentManager;

public final class Fragments {

private Fragments() {
}

/**
* Simpler version of {@link android.support.v4.app.FragmentManager#findFragmentById(int)}} which infers the target type.
* Simpler version of {@link FragmentManager#findFragmentById(int)}} which infers the target type.
*/
@SuppressWarnings("unchecked")
public static <T> T findFragmentById(android.support.v4.app.FragmentManager fragmentManager, int fragmentId) {
public static <T> T findFragmentById(FragmentManager fragmentManager, int fragmentId) {
return (T) fragmentManager.findFragmentById(fragmentId);
}

@SuppressWarnings("unchecked")
public static <T> T findFragmentByTag(android.support.v4.app.FragmentManager fragmentManager, String fragmentTag) {
public static <T> T findFragmentByTag(FragmentManager fragmentManager, String fragmentTag) {
return (T) fragmentManager.findFragmentByTag(fragmentTag);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import android.content.Context;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.support.v4.widget.CursorAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;

import androidx.cursoradapter.widget.CursorAdapter;

public abstract class CursorListAdapter<T> implements ListAdapter {

private final CursorAdapter wrappedAdapter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.novoda.notils.devicedetection;

import android.support.annotation.IntDef;
import android.util.SparseArray;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import androidx.annotation.IntDef;

public class DeviceDetection {

public static final int INTEL = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.novoda.notils.fragment;

import android.app.Activity;
import android.support.v4.app.Fragment;

import com.novoda.notils.caster.Classes;

import androidx.fragment.app.Fragment;

public class ListenableSupportFragment<L> extends Fragment {

private L listener;
Expand Down
20 changes: 0 additions & 20 deletions build.gradle

This file was deleted.

76 changes: 76 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath(Libraries.Build.androidGradle)
classpath(Libraries.Build.bintrayRelease)
}
}

plugins {
id("org.sonarqube") version "2.8"
jacoco
}

sonarqube {
androidVariant = "debug"

properties {
property("sonar.projectName", "NoTils")
property("sonar.projectDescription", "Never again need a .utils. package yur scurvy Java sea dogs!")
property("sonar.projectKey", "novoda_notils")
property("sonar.organization", "novoda")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.login", System.getenv("SONAR_TOKEN"))
property("sonar.scm.provider", "git")
property("sonar.coverage.jacoco.xmlReportPaths", xmlJacocoReportPaths)
property("sonar.junit.reportPaths", xmlTestReportPaths)
property("sonar.sourceEncoding", "UTF-8")
}
}

subprojects {
sonarqube {
properties {
property("sonar.sources", "src/main/java")
property("sonar.tests", "src/test/java")
}
}
}

val Project.xmlTestReportPaths
get() = allprojects.flatMap { it.xmlTestReportFolders }.joinToString(",")

val Project.xmlTestReportFolders
get() = tasks
.map { it.name }
.filter { it.startsWith("test") }
.map { taskName -> "${project.buildDir}/test-results/$taskName/" }

val Project.xmlJacocoReportPaths
get() = allprojects.flatMap { it.xmlJacocoReportFolders }.joinToString(",")

val Project.xmlJacocoReportFolders
get() = tasks
.map { it.name }
.filter { it.startsWith("test") }
.map { taskName -> "${project.buildDir}/reports/jacoco/$taskName/jacocoTestReport.xml" }

allprojects {
version = "3.1.5"
repositories {
jcenter()
mavenCentral()
google()
}
}

jacoco {
toolVersion = "0.8.5"
}

tasks.withType(Test::class.java) {
finalizedBy("jacocoTestReport")
}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}
27 changes: 27 additions & 0 deletions buildSrc/src/main/kotlin/dependencies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import org.gradle.api.JavaVersion

object Versions {
val sourceCompatibility = JavaVersion.VERSION_1_7
val targetCompatibility = JavaVersion.VERSION_1_7

object AndroidSdk {
const val compile = 29
const val min = 14
}
}

object Libraries {

object Build {
const val androidGradle = "com.android.tools.build:gradle:3.5.3"
const val bintrayRelease = "com.novoda:bintray-release:0.9"
}

object App {
const val supportAppCompat = "androidx.appcompat:appcompat:1.1.0"
}

object Test {
const val jUnit = "junit:junit:4.12"
}
}
38 changes: 0 additions & 38 deletions demo/build.gradle

This file was deleted.

Loading