Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/

# Local configuration file (sdk path, etc)
local.properties
publishInfo.json

# Log/OS Files
*.log
Expand Down
11 changes: 9 additions & 2 deletions androidLib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// Reduce META-INF file conflicts
kotlinOptions.freeCompilerArgs += ['-module-name', "${parent.ext.groupId}.${project.getName()}"]
}

kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += ['-module-name', "${parent.ext.groupId}.${project.getName()}"]
}

libraryVariants.all { variant ->
Expand Down Expand Up @@ -103,6 +102,14 @@ afterEvaluate {
}
}

tasks.withType(GenerateModuleMetadata).configureEach {
dependsOn("bundleReleaseAar")
}

tasks.matching { task -> task.name.startsWith('publish') }.configureEach { publishTask ->
publishTask.dependsOn("bundleReleaseAar")
}

signing {
if (parent.ext.publishInfo['signArtifacts']) {
def signingKey = parent.ext.publishInfo['signingKey']
Expand Down
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ android {
}

dependencies {

testImplementation 'junit:junit:4.13.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

Expand Down
58 changes: 37 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,47 @@ allprojects {
}
}

project.afterEvaluate {
tasks.register('incrementalPublish') {

task incrementalPublish {
def libProps = project.ext.libProps
def artifactExists = { params ->
// githubUrl, moduleName, version, true
def group = libProps['groupId'].replace(".", "/")
def url = "${params['downloadUrl']}/${group}/${params['moduleName']}/${params['version']}/${params['moduleName']}-${params['version']}.pom"

try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
connection.setRequestProperty("Authorization", params['auth'])
connection.connect()

def exists = connection.getResponseCode() == HttpURLConnection.HTTP_OK
println "pom for ${params['moduleName']} exists on $url}: ${exists}"

return exists
if (!file("publishInfo.json").exists()) {
throw new GradleException("publishInfo.json not found. Check the README for instructions")
}
catch (ignored) {
println "Unable to configure incremental publish for ${name}, check your internet connection"
return null

def libProps = project.ext.libProps
def artifactExists = { params ->
// githubUrl, moduleName, version, true
def group = libProps['groupId'].replace(".", "/")
def moduleName = params['moduleName']
def version = params['version']

def url = "${params['downloadUrl']}/${group}/${moduleName}/${version}/${moduleName}-${version}"
def fileTypes = ['aar', 'pom']

try {
// Check AAR AND POM
for (String fileType : fileTypes) {
def urlWithType = "${url}.${fileType}"
HttpURLConnection connection = (HttpURLConnection) new URL(urlWithType).openConnection()
connection.setRequestProperty("Authorization", params['auth'])
connection.setRequestMethod("HEAD")
connection.connect()
def exists = connection.getResponseCode() == HttpURLConnection.HTTP_OK

println "Artifact check for ${moduleName}-${version}: ${fileType} exists: ${exists}"

if (exists) {
return true
}
}
return false
}
catch (exception) {
println "Unable to configure incremental publish ${exception}"
return null
}
}
}

project.afterEvaluate {
libProps.stringPropertyNames()
.findAll { name -> name.contains('version') }
.each { name ->
Expand Down
1 change: 0 additions & 1 deletion communications/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apply from: "${project.rootDir}/androidLib.gradle"

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation parent.ext.appCompat
implementation parent.ext.supportAnnotations

Expand Down
2 changes: 0 additions & 2 deletions constraintlayout/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply from: "${project.rootDir}/androidLib.gradle"

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.ktxCore
implementation parent.ext.appCompat
Expand Down
2 changes: 0 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.ktxCore
implementation parent.ext.appCompat
Expand Down
2 changes: 1 addition & 1 deletion libraryVersion.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ view_version=1.2.0
material_version=1.0.4
functions_version=1.0.0
savedstate_version=1.0.1
navigation_version=1.2.1
navigation_version=1.2.2
recyclerview_version=1.2.0
viewpager2_version=1.0.0
communications_version=1.0.0
Expand Down
2 changes: 0 additions & 2 deletions material/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply from: "${project.rootDir}/androidLib.gradle"

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.ktxCore
implementation parent.ext.material
Expand Down
2 changes: 0 additions & 2 deletions recyclerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.ktxCore
implementation parent.ext.appCompat
Expand Down
2 changes: 0 additions & 2 deletions test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply from: "${project.rootDir}/androidLib.gradle"

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.appCompat
implementation parent.ext.recyclerView
Expand Down
4 changes: 3 additions & 1 deletion version.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
allprojects {
def versionKey = project.name + "_version"
def versionSuffix = parent.ext.publishInfo?.versionSuffix ?: ""
group = parent.ext.libProps['groupId']
version = parent.ext.libProps[versionKey] + parent.ext.versionSuffix
def suffix = versionSuffix.isEmpty() ? "" : "-" + versionSuffix
version = parent.ext.libProps[versionKey] + suffix

task printProjectVersion {
doLast {
Expand Down
2 changes: 0 additions & 2 deletions view/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation parent.ext.kotlin
implementation parent.ext.ktxCore
implementation parent.ext.appCompat
Expand Down