Skip to content

Commit

Permalink
Merge pull request #12 from 2BAB/dev
Browse files Browse the repository at this point in the history
0.9.0 - AGP 8.1/8.0 support
  • Loading branch information
2BAB authored Nov 4, 2023
2 parents f93b039 + ab6077a commit bb393b8
Show file tree
Hide file tree
Showing 37 changed files with 447 additions and 301 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- master
- dev
paths-ignore:
- '*.md'
push:
Expand All @@ -30,7 +31,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand All @@ -53,7 +54,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand All @@ -76,7 +77,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion android-arsc-parser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ java {
withSourcesJar()
sourceCompatibility = Versions.polyfillSourceCompatibilityVersion
targetCompatibility = Versions.polyfillTargetCompatibilityVersion
}
}
1 change: 1 addition & 0 deletions android-arsc-parser/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
me.2bab.maven.publish.type=jar
1 change: 1 addition & 0 deletions android-manifest-parser/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
me.2bab.maven.publish.type=jar
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ object BuildConfig {
}

object Versions {
const val polyfillDevVersion = "0.8.1"
const val polyfillDevVersion = "0.9.0"

val polyfillSourceCompatibilityVersion = JavaVersion.VERSION_1_8
val polyfillTargetCompatibilityVersion = JavaVersion.VERSION_1_8
val polyfillSourceCompatibilityVersion = JavaVersion.VERSION_11
val polyfillTargetCompatibilityVersion = JavaVersion.VERSION_17
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}
val versionCatalog = extensions.getByType<VersionCatalogsExtension>().named("deps")
val defaultAGPVer = versionCatalog.findVersion("agpVer").get().requiredVersion
val defaultAGP = versionCatalog.findDependency("android-gradle-plugin").get()
val defaultAGP = versionCatalog.findLibrary("android-gradle-plugin").get()

val fixtureClasspath: Configuration by configurations.creating
tasks.pluginUnderTestMetadata {
Expand Down Expand Up @@ -61,11 +61,9 @@ val test by tasks.getting(Test::class) {
}
}

@Suppress("UnstableApiUsage")
val fixtureAgpVersion: String = providers
.environmentVariable("AGP_VERSION")
.forUseAtConfigurationTime()
.orElse(providers.gradleProperty("agpVersion").forUseAtConfigurationTime())
.orElse(providers.gradleProperty("agpVersion"))
.getOrElse(defaultAGPVer)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package me.xx2bab.polyfill.buildscript

plugins{
plugins {
`maven-publish`
signing
}

val publishType = (project.properties["me.2bab.maven.publish.type"] as String) ?: "jar"

// Stub secrets to let the project sync and build without the publication values set up
ext["signing.keyId"] = null
Expand All @@ -31,9 +32,9 @@ if (secretPropsFile.exists()) {
ext["ossrh.username"] = System.getenv("OSSRH_USERNAME")
ext["ossrh.password"] = System.getenv("OSSRH_PASSWORD")
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
//val javadocJar by tasks.registering(Jar::class) {
// archiveClassifier.set("javadoc")
//}
fun getExtraString(name: String) = ext[name]?.toString()


Expand All @@ -52,44 +53,61 @@ val inception = "2018"

val username = "2BAB"

fun MavenPublication.configMetadata(publishType: String) {
// artifact(javadocJar.get())
if (publishType != "plugin") {
from(components["java"])
}
pom {
// Description
name.set(projectName)
description.set(mavenDesc)
url.set(siteUrl)

// Archive
groupId = groupName
artifactId = project.name
version = BuildConfig.Versions.polyfillDevVersion

// License
inceptionYear.set(inception)
licenses {
licenseNames.forEachIndexed { ln, li ->
license {
name.set(li)
url.set(licenseUrls[ln])
}
}
}
developers {
developer {
name.set(username)
}
}
scm {
connection.set(gitUrl)
developerConnection.set(gitUrl)
url.set(siteUrl)
}
}
}

publishing {

publishing {
publications {
create<MavenPublication>("PolyfillArtifact") {
artifact(javadocJar.get())
from(components["java"])
pom {
// Description
name.set(projectName)
description.set(mavenDesc)
url.set(siteUrl)

// Archive
groupId = groupName
artifactId = project.name
version = BuildConfig.Versions.polyfillDevVersion

// License
inceptionYear.set(inception)
licenses {
licenseNames.forEachIndexed { ln, li ->
license {
name.set(li)
url.set(licenseUrls[ln])
}
afterEvaluate {
when (publishType) {
"jar" -> {
create<MavenPublication>("PolyfillArtifact") {
configMetadata(publishType)
}
}
developers {
developer {
name.set(username)

"plugin" -> {
named<MavenPublication>("pluginMaven") {
configMetadata(publishType)
}
}
scm {
connection.set(gitUrl)
developerConnection.set(gitUrl)
url.set(siteUrl)
}
}
}
}
Expand All @@ -115,6 +133,8 @@ publishing {
}
}

signing {
sign(publishing.publications)
afterEvaluate {
signing {
sign(publishing.publications)
}
}
21 changes: 10 additions & 11 deletions deps.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
[versions]
kotlinVer = "1.6.21"
kotlinVer = "1.9.10"
buildConfigVer = "3.0.3"

agpVer = "7.2.2"
agpPatchIgnoredVer = "7.2.0" # To be used by backport version matching
agpBackportVer = "7.1.3"
agpBackportPatchIgnoredVer = "7.1.0" # To be used by backport version matching, e.g. apply backport patches when (7.1.0 <= ver < 7.2.0)
agpNextBetaVer = "7.3.0-beta01"
agpVer = "8.1.2"
agpPatchIgnoredVer = "8.1.0" # To be used by backport version matching
agpBackportVer = "8.0.1"
agpBackportPatchIgnoredVer = "8.0.1" # To be used by backport version matching, e.g. apply backport patches when (7.1.0 <= ver < 7.2.0)
agpNextBetaVer = "8.2.0-beta06"

# 30.2.0-beta03
androidToolVer = "30.2.0"
# Please refer to https://mvnrepository.com/artifact/com.android.tools/sdk-common?repo=google
# The minor and patch version are synced with agpVer
androidToolVer = "31.1.2"
mockitoVer = "3.9.0"

[libraries]
Expand All @@ -20,11 +21,9 @@ android-tools-common = { module = "com.android.tools:common", version.ref = "and
android-tools-sdklib = { module = "com.android.tools:sdklib", version.ref = "androidToolVer" }
kotlin-std = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlinVer" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlinVer" }
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.3.2" }
kotlin-coroutine = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version = "1.6.0" }
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.5.1" }
guava = { module = "com.google.guava:guava", version = "30.1.1-jre" }
fastJson = { module = "com.alibaba:fastjson", version = "1.2.73" }
zip4j = { module = "net.lingala.zip4j:zip4j", version = "2.6.2" }
hamcrest = { module = "org.hamcrest:hamcrest-library", version = "2.2" }
junit = { module = "junit:junit", version = "4.12" }
mockito = { module = "org.mockito:mockito-core", version.ref = "mockitoVer" }
Expand Down
14 changes: 7 additions & 7 deletions functional-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ group = "me.2bab"

java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
implementation(deps.kotlin.std)
}

testing {
suites {
Expand All @@ -22,15 +19,18 @@ testing {
testType.set(TestSuiteType.FUNCTIONAL_TEST)
dependencies {
implementation(deps.hamcrest)
implementation("dev.gradleplugins:gradle-test-kit:7.4.1")
implementation(deps.kotlin.coroutine)
implementation(deps.kotlin.serialization)
implementation(deps.fastJson)
}
}
}
}

dependencies {
implementation(deps.kotlin.std)
"functionalTestImplementation"(gradleTestKit())
}

tasks.named("check") {
dependsOn(testing.suites.named("functionalTest"))
}
Expand Down
Loading

0 comments on commit bb393b8

Please sign in to comment.