Skip to content

Commit db3ba26

Browse files
authored
Modernize build infra + updated nullability from SDK (#74)
1 parent 8dbefcc commit db3ba26

27 files changed

+410
-366
lines changed

.buildscript/deploy_snapshot.sh

-26
This file was deleted.

.github/workflows/ci.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
# Only run push on main
5+
push:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- '**/*.md'
10+
# Always run on PRs
11+
pull_request:
12+
branches: [ main ]
13+
merge_group:
14+
15+
concurrency:
16+
group: 'ci-${{ github.head_ref }}-${{ github.workflow }}'
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Gradle Wrapper Validation
27+
uses: gradle/wrapper-validation-action@v1
28+
29+
- name: Install JDK
30+
uses: actions/setup-java@v3
31+
with:
32+
distribution: 'zulu'
33+
java-version: '19'
34+
35+
- name: Build and run tests
36+
id: gradle
37+
uses: gradle/gradle-build-action@v2
38+
with:
39+
arguments: check
40+
gradle-home-cache-cleanup: true
41+
cache-read-only: false
42+
43+
- name: (Fail-only) Upload build reports
44+
if: failure()
45+
uses: actions/upload-artifact@v3
46+
with:
47+
name: reports
48+
path: |
49+
**/build/reports/**
50+
51+
- name: Publish snapshot (main branch only)
52+
if: github.repository == 'inflationx/viewpump' && github.ref == 'refs/heads/main'
53+
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPEUSERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPEPASSWORD }} --no-configuration-cache

.travis.yml

-27
This file was deleted.

ViewPumpSample/.gitignore

-1
This file was deleted.

ViewPumpSample/build.gradle

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
apply plugin: 'com.android.application'
1+
plugins {
2+
alias(libs.plugins.agp.application)
3+
}
24

35
android {
4-
compileSdkVersion 28
5-
buildToolsVersion "28.0.3"
6+
compileSdk 33
7+
namespace = "io.github.inflationx.viewpump.sample"
68

79
defaultConfig {
810
minSdkVersion 14
9-
targetSdkVersion 28
11+
targetSdkVersion 33
1012
versionCode 1
1113
versionName "1"
1214
}
@@ -20,29 +22,24 @@ android {
2022
debug {
2123
matchingFallbacks = ['release']
2224
minifyEnabled true
23-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25+
proguardFiles getDefaultProguardFile('proguard-android.txt')
2426
}
2527
release {
2628
minifyEnabled true
27-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29+
proguardFiles getDefaultProguardFile('proguard-android.txt')
2830
}
2931
}
3032

3133
lintOptions {
3234
// we don't need to be indexed by firebase and we don't have a custom icon for our sample app
3335
disable 'GoogleAppIndexingWarning', 'MissingApplicationIcon'
34-
textOutput 'stdout'
3536
textReport System.getenv('CI') == 'true'
3637
}
3738
}
3839

3940
dependencies {
4041
implementation project(':viewpump')
41-
implementation 'androidx.appcompat:appcompat:1.0.2'
42-
43-
implementation 'com.jakewharton:butterknife:10.0.0'
44-
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
42+
implementation libs.androidx.appcompat
4543

46-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
47-
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
44+
debugImplementation libs.leakcanary.android
4845
}

ViewPumpSample/proguard-rules.pro

-29
This file was deleted.

ViewPumpSample/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest
3-
package="io.github.inflationx.viewpump.sample"
43
xmlns:android="http://schemas.android.com/apk/res/android">
54

65
<application
@@ -10,7 +9,7 @@
109
android:theme="@style/AppTheme">
1110
<activity
1211
android:name="io.github.inflationx.viewpump.sample.MainActivity"
13-
android:label="@string/app_name">
12+
android:exported="true">
1413
<intent-filter>
1514
<action android:name="android.intent.action.MAIN"/>
1615

build.gradle

+17-48
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,24 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
buildscript {
3-
repositories {
4-
maven {
5-
url "https://maven.google.com"
6-
content {
7-
includeGroupByRegex "com\\.android.*"
8-
includeGroupByRegex "androidx.*"
9-
}
10-
}
11-
maven {
12-
url "https://repo.maven.apache.org/maven2/"
13-
content {
14-
includeGroupByRegex "org\\.jetbrains.*"
15-
}
16-
}
17-
mavenCentral()
18-
jcenter()
19-
maven {
20-
// For maven publish plugin until 0.9.0 is released
21-
url "https://oss.sonatype.org/content/repositories/snapshots/"
22-
}
23-
}
24-
dependencies {
25-
classpath 'com.android.tools.build:gradle:3.3.2'
26-
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21'
27-
classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18'
28-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0-SNAPSHOT'
29-
}
1+
plugins {
2+
alias(libs.plugins.kotlin.jvm) apply false
3+
alias(libs.plugins.kotlin.android) apply false
4+
alias(libs.plugins.agp.application) apply false
5+
alias(libs.plugins.agp.library) apply false
6+
alias(libs.plugins.dokka) apply false
7+
alias(libs.plugins.mavenPublish) apply false
308
}
319

3210
allprojects {
33-
repositories {
34-
maven {
35-
url "https://maven.google.com"
36-
content {
37-
includeGroupByRegex "com\\.android.*"
38-
includeGroupByRegex "androidx.*"
11+
pluginManager.withPlugin("java") {
12+
java {
13+
toolchain {
14+
languageVersion.set(
15+
JavaLanguageVersion.of(libs.versions.jdk.get().removeSuffix("-ea").toInt())
16+
)
3917
}
4018
}
41-
maven {
42-
url "https://repo.maven.apache.org/maven2/"
43-
content {
44-
includeGroupByRegex "org\\.jetbrains.*"
45-
includeGroupByRegex "com\\.jakewharton.*"
46-
includeGroupByRegex "com\\.squareup.*"
47-
includeGroupByRegex "junit.*"
48-
includeGroupByRegex "org\\.assertj.*"
49-
includeGroupByRegex "org\\.mockito.*"
50-
}
19+
20+
tasks.withType(JavaCompile) {
21+
options.release = 8
5122
}
52-
mavenCentral()
53-
jcenter()
5423
}
55-
}
24+
}

gradle.properties

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ POM_SCM_CONNECTION=scm:[email protected]:InflationX/ViewPump.git
1010
POM_SCM_DEV_CONNECTION=scm:[email protected]:InflationX/ViewPump.git
1111

1212
POM_LICENCE_NAME=The Apache Software License, Version 2.0
13-
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
13+
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
1414
POM_LICENCE_DIST=repo
1515

1616
POM_DEVELOPER_ID=InflationX
1717
POM_DEVELOPER_NAME=InflationX
1818
POM_DEVELOPER_EMAIL=
1919

20-
# https://developer.android.com/topic/libraries/support-library/androidx-overview
2120
android.useAndroidX=true
22-
android.enableJetifier=true

gradle/libs.versions.toml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[versions]
2+
agp = "7.4.2"
3+
dokka = "1.8.10"
4+
jdk = "19"
5+
kotlin = "1.8.10"
6+
leakcanary = "2.10"
7+
mavenPublish = "0.25.1"
8+
9+
[plugins]
10+
agp-application = { id = "com.android.application", version.ref = "agp" }
11+
agp-library = { id = "com.android.library", version.ref = "agp" }
12+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
13+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
14+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
15+
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
16+
17+
[libraries]
18+
androidx-annotation="androidx.annotation:annotation:1.6.0"
19+
androidx-appcompat="androidx.appcompat:appcompat:1.6.1"
20+
androidx-test-runner="androidx.test:runner:1.5.2"
21+
assertj="org.assertj:assertj-core:3.24.2"
22+
junit="junit:junit:4.13.2"
23+
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" }
24+
mockito="org.mockito:mockito-core:4.11.0"

gradle/wrapper/gradle-wrapper.jar

5.85 KB
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)