Skip to content

Commit

Permalink
Modernize build infra + updated nullability from SDK (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Mar 29, 2023
1 parent 8dbefcc commit db3ba26
Show file tree
Hide file tree
Showing 27 changed files with 410 additions and 366 deletions.
26 changes: 0 additions & 26 deletions .buildscript/deploy_snapshot.sh

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- '**/*.md'
# Always run on PRs
pull_request:
branches: [ main ]
merge_group:

concurrency:
group: 'ci-${{ github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1

- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '19'

- name: Build and run tests
id: gradle
uses: gradle/gradle-build-action@v2
with:
arguments: check
gradle-home-cache-cleanup: true
cache-read-only: false

- name: (Fail-only) Upload build reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: reports
path: |
**/build/reports/**
- name: Publish snapshot (main branch only)
if: github.repository == 'inflationx/viewpump' && github.ref == 'refs/heads/main'
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPEUSERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPEPASSWORD }} --no-configuration-cache
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion ViewPumpSample/.gitignore

This file was deleted.

23 changes: 10 additions & 13 deletions ViewPumpSample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
apply plugin: 'com.android.application'
plugins {
alias(libs.plugins.agp.application)
}

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdk 33
namespace = "io.github.inflationx.viewpump.sample"

defaultConfig {
minSdkVersion 14
targetSdkVersion 28
targetSdkVersion 33
versionCode 1
versionName "1"
}
Expand All @@ -20,29 +22,24 @@ android {
debug {
matchingFallbacks = ['release']
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}

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

dependencies {
implementation project(':viewpump')
implementation 'androidx.appcompat:appcompat:1.0.2'

implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation libs.androidx.appcompat

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
debugImplementation libs.leakcanary.android
}
29 changes: 0 additions & 29 deletions ViewPumpSample/proguard-rules.pro

This file was deleted.

3 changes: 1 addition & 2 deletions ViewPumpSample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="io.github.inflationx.viewpump.sample"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
Expand All @@ -10,7 +9,7 @@
android:theme="@style/AppTheme">
<activity
android:name="io.github.inflationx.viewpump.sample.MainActivity"
android:label="@string/app_name">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
65 changes: 17 additions & 48 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,24 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://maven.google.com"
content {
includeGroupByRegex "com\\.android.*"
includeGroupByRegex "androidx.*"
}
}
maven {
url "https://repo.maven.apache.org/maven2/"
content {
includeGroupByRegex "org\\.jetbrains.*"
}
}
mavenCentral()
jcenter()
maven {
// For maven publish plugin until 0.9.0 is released
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21'
classpath 'org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0-SNAPSHOT'
}
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.agp.application) apply false
alias(libs.plugins.agp.library) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.mavenPublish) apply false
}

allprojects {
repositories {
maven {
url "https://maven.google.com"
content {
includeGroupByRegex "com\\.android.*"
includeGroupByRegex "androidx.*"
pluginManager.withPlugin("java") {
java {
toolchain {
languageVersion.set(
JavaLanguageVersion.of(libs.versions.jdk.get().removeSuffix("-ea").toInt())
)
}
}
maven {
url "https://repo.maven.apache.org/maven2/"
content {
includeGroupByRegex "org\\.jetbrains.*"
includeGroupByRegex "com\\.jakewharton.*"
includeGroupByRegex "com\\.squareup.*"
includeGroupByRegex "junit.*"
includeGroupByRegex "org\\.assertj.*"
includeGroupByRegex "org\\.mockito.*"
}

tasks.withType(JavaCompile) {
options.release = 8
}
mavenCentral()
jcenter()
}
}
}
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ POM_SCM_CONNECTION=scm:git@github.com:InflationX/ViewPump.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:InflationX/ViewPump.git

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

POM_DEVELOPER_ID=InflationX
POM_DEVELOPER_NAME=InflationX
POM_DEVELOPER_EMAIL=

# https://developer.android.com/topic/libraries/support-library/androidx-overview
android.useAndroidX=true
android.enableJetifier=true
24 changes: 24 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[versions]
agp = "7.4.2"
dokka = "1.8.10"
jdk = "19"
kotlin = "1.8.10"
leakcanary = "2.10"
mavenPublish = "0.25.1"

[plugins]
agp-application = { id = "com.android.application", version.ref = "agp" }
agp-library = { id = "com.android.library", version.ref = "agp" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }

[libraries]
androidx-annotation="androidx.annotation:annotation:1.6.0"
androidx-appcompat="androidx.appcompat:appcompat:1.6.1"
androidx-test-runner="androidx.test:runner:1.5.2"
assertj="org.assertj:assertj-core:3.24.2"
junit="junit:junit:4.13.2"
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" }
mockito="org.mockito:mockito-core:4.11.0"
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit db3ba26

Please sign in to comment.