Skip to content

Commit

Permalink
Update project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed Jan 18, 2020
1 parent 35239b1 commit ec1d3aa
Show file tree
Hide file tree
Showing 16 changed files with 173 additions and 182 deletions.
50 changes: 0 additions & 50 deletions bintrayconfig.gradle

This file was deleted.

27 changes: 16 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
apply from: './dependencies.gradle'
apply from: './versionsPlugin.gradle'
apply from: rootProject.file("gradle/versions_plugin_config.gradle")
apply from: rootProject.file("gradle/nebula_lint_config.gradle")

buildscript {
apply from: './dependencies.gradle'
apply from: rootProject.file("dependencies.gradle")

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:' + versions.gradlePlugin
classpath "com.diffplug.spotless:spotless-plugin-gradle:" + versions.spotlessPlugin
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + versions.kotlin
classpath 'com.github.ben-manes:gradle-versions-plugin:' + versions.versionPlugin
classpath 'com.novoda:bintray-release:' + versions.bintrayPlugin
classpath deps.gradle_plugins.android
classpath deps.gradle_plugins.bintray_release
classpath deps.gradle_plugins.kotlin
classpath deps.gradle_plugins.nebula_lint
classpath deps.gradle_plugins.spotless
classpath deps.gradle_plugins.versions
}
}

Expand All @@ -23,8 +24,12 @@ allprojects {
google()
jcenter()
}
}

tasks.withType(Javadoc).all {
enabled = false
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += ['-module-name', project.path.replace('/', '.').replace(':', '_')]
}
}
}
}
63 changes: 44 additions & 19 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,50 @@
ext.versions = [
minSdk : 14,
compileSdk : 29,
buildTools : '29.0.0',
publishVersion : '2.3.1',
publishVersionCode : 20,
min_sdk: 14,
compile_sdk: 29,
build_tools: "29.0.0",
publish_version: "2.3.1",
publish_version_code: 20
]

ext.deps = [
gradle_plugins: [
android: "com.android.tools.build:gradle:3.5.3",
spotless: "com.diffplug.spotless:spotless-plugin-gradle:3.27.1",
versions: "com.github.ben-manes:gradle-versions-plugin:0.27.0",
bintray_release: "com.novoda:bintray-release:0.9.2",
kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61",
nebula_lint: "com.netflix.nebula:gradle-lint-plugin:16.0.2"
],

androidx: [
annotations: "androidx.annotation:annotation:1.1.0",
app_compat: "androidx.appcompat:appcompat:1.1.0",
test: [
core: "androidx.test:core:1.1.0"
]
],

gradlePlugin : '3.5.0',
spotlessPlugin : '3.24.2',
versionPlugin : '0.22.0',
kotlin : '1.3.50',
bintrayPlugin : '0.9.1',
material: "com.google.android.material:material:1.0.0",

timber : '4.7.1',
kotlin: [
stdlib8: "org.jetbrains.kotlin:kotlin-stdlib-jdk8",
coroutines: [
core: "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2",
android: "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2"
],
test: [
mockito: "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
]
],

junit : '4.12',
mockito : '3.0.0',
mockitoKotlin : '2.1.0',
truth : '1.0',
debug: [
timber: "com.jakewharton.timber:timber:4.7.1"
],

androidxAnnotations: '1.1.0',
androidxCore : '1.0.2',
androidxMaterial : '1.0.0',
robolectric : '4.3',
test: [
junit: "junit:junit:4.13",
robolectric: "org.robolectric:robolectric:4.3.1",
mockito_core: "org.mockito:mockito-core:3.2.4",
truth: "com.google.truth:truth:1.0",
]
]
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
49 changes: 12 additions & 37 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../dependencies.gradle'
ext.module_group = "com.afollestad"
ext.module_name = "assent"

apply from: '../bintrayconfig.gradle'

android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools

compileOptions {
if (modulePackageId != null && modulePackageId != '') {
logger.warn('Package for current module: ' + modulePackageId)
kotlinOptions.freeCompilerArgs += ['-module-name', modulePackageId]
} else {
logger.warn('Skipping setting compiler module name, no package to use.')
}
}

defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.publishVersionCode
versionName versions.publishVersion
}
}
apply from: rootProject.file("gradle/android_library_config.gradle")

dependencies {
implementation 'androidx.annotation:annotation:' + versions.androidxAnnotations
implementation 'androidx.appcompat:appcompat:' + versions.androidxCore
implementation 'com.google.android.material:material:' + versions.androidxMaterial
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:' + versions.kotlin
implementation 'com.jakewharton.timber:timber:' + versions.timber
implementation deps.androidx.annotations
implementation deps.androidx.app_compat

testImplementation 'org.robolectric:robolectric:' + versions.robolectric
testImplementation 'junit:junit:' + versions.junit
testImplementation 'org.mockito:mockito-inline:' + versions.mockito
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:' + versions.mockitoKotlin
testImplementation 'com.google.truth:truth:' + versions.truth
}
implementation deps.kotlin.stdlib8
implementation deps.debug.timber

apply from: '../spotless.gradle'
testImplementation deps.kotlin.test.mockito
testImplementation deps.test.junit
testImplementation deps.test.robolectric
testImplementation deps.test.truth
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import com.afollestad.assent.Callback
import com.afollestad.assent.Permission
import com.afollestad.assent.internal.maybeObserveLifecycle
import com.afollestad.assent.plus
import timber.log.Timber
import kotlin.properties.Delegates.notNull
import timber.log.Timber

typealias Requester = (Array<out Permission>, Int, RationaleHandler?, Callback) -> Unit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package com.afollestad.assent.testutil

import java.lang.reflect.Method
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import java.lang.reflect.Method

@Config(manifest = Config.NONE, sdk = [28])
class NoManifestTestRunner(testClass: Class<*>) : RobolectricTestRunner(testClass) {
Expand Down
29 changes: 7 additions & 22 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
apply from: '../dependencies.gradle'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
ext.module_group = "com.afollestad"
ext.module_name = "assentsample"

android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools

defaultConfig {
applicationId "com.afollestad.assentsample"
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.publishVersionCode
versionName versions.publishVersion
}
}
apply from: rootProject.file("gradle/android_application_config.gradle")

dependencies {
implementation project(':library')

implementation 'androidx.annotation:annotation:' + versions.androidxAnnotations
implementation 'androidx.appcompat:appcompat:' + versions.androidxCore

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:' + versions.kotlin

implementation 'com.jakewharton.timber:timber:' + versions.timber
implementation deps.androidx.annotations
implementation deps.androidx.app_compat
implementation deps.kotlin.stdlib8
implementation deps.debug.timber
}
18 changes: 13 additions & 5 deletions sample/src/main/java/com/afollestad/assentsample/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
/*
* Licensed under Apache-2.0
/**
* Designed and developed by Aidan Follestad (@afollestad)
*
* Designed an developed by Aidan Follestad (afollestad)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.afollestad.assentsample

import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import com.afollestad.assent.Permission.CALL_PHONE
import com.afollestad.assent.Permission.READ_CONTACTS
import com.afollestad.assent.Permission.READ_SMS
import com.afollestad.assent.Permission.WRITE_EXTERNAL_STORAGE
Expand Down
17 changes: 16 additions & 1 deletion sample/src/main/java/com/afollestad/assentsample/SampleApp.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Designed and developed by Aidan Follestad (@afollestad)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.afollestad.assentsample

import android.app.Application
Expand All @@ -10,4 +25,4 @@ class SampleApp : Application() {
super.onCreate()
Timber.plant(DebugTree())
}
}
}
15 changes: 15 additions & 0 deletions sample/src/main/java/com/afollestad/assentsample/Util.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Designed and developed by Aidan Follestad (@afollestad)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.afollestad.assentsample

import android.app.Activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Designed and developed by Aidan Follestad (@afollestad)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.afollestad.assentsample.fragment

import android.annotation.SuppressLint
Expand All @@ -7,7 +22,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.afollestad.assent.Permission.CALL_PHONE
import com.afollestad.assent.Permission.READ_CALENDAR
import com.afollestad.assent.Permission.WRITE_EXTERNAL_STORAGE
import com.afollestad.assent.askForPermissions
import com.afollestad.assentsample.R.layout
Expand All @@ -34,4 +48,4 @@ class ExampleChildFragment : Fragment() {
}
}
}
}
}
Loading

0 comments on commit ec1d3aa

Please sign in to comment.