Skip to content

Commit

Permalink
Merge pull request #18 from 2BAB/dev
Browse files Browse the repository at this point in the history
Upgrade: Polyfill 0.9.0, AGP 8.1.2, Gradle 8.1.1, Java 17
  • Loading branch information
2BAB authored Dec 26, 2023
2 parents 5a2c6ef + ba9ffac commit c13a944
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 78 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand All @@ -53,11 +53,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand All @@ -76,11 +76,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: actions/cache@v2
with:
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
- name: Check out
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Prepare environment
env:
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ buildscript {
mavenCentral()
}
dependencies {
...
classpath("me.2bab:seal:3.3.0")
classpath("com.android.tools.build:gradle:8.1.2")
classpath("me.2bab:seal:3.4.0")
}
}
```
Expand Down Expand Up @@ -138,16 +138,15 @@ Please check [this link](https://stackoverflow.com/questions/42893846/androidman

Polyfill is only supported & tested on latest **2** Minor versions of Android Gradle Plugin. Since `3.0.2`, the publish repository has been shifted to **Maven Central**.

| AGP Version | Latest Support Version |
|:-----------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
| 7.2.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.0.x | [3.1.0](https://github.com/2BAB/Seal/releases/tag/3.1.0) |
| 4.2.x | [3.0.2](https://github.com/2BAB/Seal/releases/tag/3.0.2) |
| 3.0.x | [2.0.0](https://github.com/2BAB/Seal/releases/tag/2.0.0) |
| 2.3.x | [1.1.0](https://github.com/2BAB/Seal/releases/tag/1.1.0) |
| AGP Version | Latest Support Version |
|:-------------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
| 8.1.x / 8.0.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.2.x 7.1.x | [3.3.0](https://github.com/2BAB/Seal/releases/tag/3.3.0) |
| 7.0.x | [3.1.0](https://github.com/2BAB/Seal/releases/tag/3.1.0) |
| 4.2.x | [3.0.2](https://github.com/2BAB/Seal/releases/tag/3.0.2) |
| 3.0.x | [2.0.0](https://github.com/2BAB/Seal/releases/tag/2.0.0) |
| 2.3.x | [1.1.0](https://github.com/2BAB/Seal/releases/tag/1.1.0) |

(The project currently compiles with the latest version of AGP 7.0, and compiles and tests against the both AGP 7.0 and 7.1 on CI.)

## Why Seal use DOM parser API

Expand All @@ -158,7 +157,7 @@ Since we need to support "delete tag" feature, and export outputs simply, from t

## License

Copyright 2017-2022 2BAB
Copyright Since 2017 2BAB

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
24 changes: 11 additions & 13 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ buildscript {
mavenCentral()
}
dependencies {
...
classpath("me.2bab:seal:3.3.0")
classpath("com.android.tools.build:gradle:8.1.2")
classpath("me.2bab:seal:3.4.0")
}
}
```
Expand Down Expand Up @@ -142,17 +142,15 @@ tools:replace specified at line:25 for attribute android:authorities, but no new

Polyfill 只支持并在最新的两个 Android Gradle Plugin 版本(例如 4.2.x,7.0.x)进行测试。从 `3.0.2` 开始,Seal 发布的仓库迁移到 **Maven Central**

| AGP 版本号 | 最新支持版本号 |
|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
| 7.2.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.0.x | [3.1.0](https://github.com/2BAB/Seal/releases/tag/3.1.0) |
| 4.2.x | [3.0.2](https://github.com/2BAB/Seal/releases/tag/3.0.2) |
| 3.0.x | [2.0.0](https://github.com/2BAB/Seal/releases/tag/2.0.0) |
| 2.3.x | [1.1.0](https://github.com/2BAB/Seal/releases/tag/1.1.0) |

| AGP 版本号 | 最新支持版本号 |
|:-------------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
| 8.1.x / 8.0.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/seal/badge.svg)](https://search.maven.org/artifact/me.2bab/seal) |
| 7.2.x 7.1.x | [3.3.0](https://github.com/2BAB/Seal/releases/tag/3.3.0) |
| 7.0.x | [3.1.0](https://github.com/2BAB/Seal/releases/tag/3.1.0) |
| 4.2.x | [3.0.2](https://github.com/2BAB/Seal/releases/tag/3.0.2) |
| 3.0.x | [2.0.0](https://github.com/2BAB/Seal/releases/tag/2.0.0) |
| 2.3.x | [1.1.0](https://github.com/2BAB/Seal/releases/tag/1.1.0) |

(目前本工程基于 AGP 7.0 的最新版本进行开发,在 CI 环境下还会同时编译&测试 7.0/7.1 版本的兼容性)

## 为什么 Seal 使用 DOM 解析 API

Expand All @@ -162,7 +160,7 @@ Polyfill 只支持并在最新的两个 Android Gradle Plugin 版本(例如 4.

## License

Copyright 2017-2022 2BAB
Copyright Since 2017 2BAB

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object BuildConfig {

object Versions {
const val sealVersion = "3.3.0"
const val sealVersion = "3.4.0"
}

}
10 changes: 2 additions & 8 deletions buildSrc/src/main/kotlin/maven-central-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ 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")
}

fun getExtraString(name: String) = ext[name]?.toString()

Expand Down Expand Up @@ -74,22 +71,19 @@ publishing {
}
}

signing {
sign(publishing.publications)
}


// To add missing information for the gradle plugin coordinator
afterEvaluate {
publishing.publications.all {
signing.sign(this)
val publicationName = this.name
(this as MavenPublication).apply {
if (publicationName == "pluginMaven") {
groupId = groupName
artifactId = projectName
}
version = BuildConfig.Versions.sealVersion
artifact(javadocJar.get())

pom {
if (publicationName == "pluginMaven") {
name.set(project.name)
Expand Down
12 changes: 6 additions & 6 deletions deps.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
kotlinVer = "1.6.21"
polyfillVer = "0.7.0"
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)
kotlinVer = "1.9.22"
polyfillVer = "0.9.0"
agpVer = "8.1.2"
agpPatchIgnoredVer = "8.1.0" # To be used by backport version matching
agpBackportVer = "8.0.1"
agpBackportPatchIgnoredVer = "8.1.1" # To be used by backport version matching, e.g. apply backport patches when (7.1.0 <= ver < 7.2.0)


[libraries]
Expand Down
6 changes: 3 additions & 3 deletions functional-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ group = "me.2bab"

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

dependencies {
Expand All @@ -24,7 +24,7 @@ testing {
testType.set(TestSuiteType.FUNCTIONAL_TEST)
dependencies {
implementation(deps.hamcrest)
implementation("dev.gradleplugins:gradle-test-kit:7.4.2")
implementation("dev.gradleplugins:gradle-test-kit:8.1.1")
implementation(deps.kotlin.coroutine)
implementation(deps.kotlin.serialization)
implementation(deps.zip4j)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class SealBaseFunctionTest {
fun buildTestProject() {
if (File("../local.properties").exists()) {
println("Publishing libraries to MavenLocal...")
("./gradlew" + " :seal:publishAllPublicationsToMyMavenlocalRepository"
("./gradlew" + " :seal:publishPluginMavenPublicationToMyMavenlocalRepository"
+ " --stacktrace").runCommand(File("../"))
("./gradlew" + " :seal:publishSealPluginMarkerMavenPublicationToMyMavenlocalRepository"
+ " --stacktrace").runCommand(File("../"))
println("All libraries published.")
}
Expand Down Expand Up @@ -62,9 +64,9 @@ class SealBaseFunctionTest {
println("assembleFullDebug for [$agpVer]")

GradleRunner.create()
.withGradleVersion("7.4.2")
.withGradleVersion("8.1.1")
.forwardOutput()
.withArguments("clean", "assembleDebug", "--stacktrace")
.withArguments("clean", "assembleDebug", "--stacktrace", "--scan")
.withProjectDir(targetProject)
.build()

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./gradlew clean :seal:publishAllPublicationsToSonatypeRepository :seal:releaseArtifactsToGithub
./gradlew clean :seal:publishPluginMavenPublicationToSonatypeRepository :seal:publishSealPluginMarkerMavenPublicationToSonatypeRepository :seal:releaseArtifactsToGithub
2 changes: 1 addition & 1 deletion publish_to_local.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./gradlew clean :seal:assemble :seal:publishToMavenLocal
./gradlew clean :seal:assemble :seal:publishPluginMavenPublicationToMyMavenlocalRepository :seal:publishSealPluginMarkerMavenPublicationToMyMavenlocalRepository
4 changes: 4 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extensions.findByName("buildScan")?.withGroovyBuilder {
setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service")
setProperty("termsOfServiceAgree", "yes")
}
2 changes: 1 addition & 1 deletion sample/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 6 additions & 6 deletions sample/test-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ plugins {
}

android {
compileSdk = 30
buildToolsVersion = "30.0.3"
namespace = "me.xx2bab.seal.sample"
compileSdk = 34
defaultConfig {
applicationId = "me.xx2bab.seal.sample"
minSdk = 23
targetSdk = 30
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -28,12 +28,12 @@ android {
sourceSets["main"].java.srcDir("src/main/kotlin")

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
}

Expand Down
3 changes: 1 addition & 2 deletions sample/test-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="me.xx2bab.seal.sample">
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
Expand Down
12 changes: 6 additions & 6 deletions sample/test-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

android {
compileSdk = 30
buildToolsVersion = "30.0.3"
namespace = "me.xx2bab.seal.sample.library"
compileSdk = 34
defaultConfig {
minSdk = 23
targetSdk = 30
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -19,12 +19,12 @@ android {
sourceSets["main"].java.srcDir("src/main/kotlin")

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
}

Expand Down
3 changes: 1 addition & 2 deletions sample/test-library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="me.xx2bab.seal.sample.library">
xmlns:tools="http://schemas.android.com/tools">

<!-- To simulate an feature declaration the lib requires but we don't actually use -->
<uses-feature android:name="android.hardware.usb.host" /> <!-- To simulate an custom permission we don't need -->
Expand Down
7 changes: 4 additions & 3 deletions seal/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ plugins {

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

gradlePlugin {
Expand All @@ -33,4 +34,4 @@ dependencies {

testImplementation(gradleTestKit())
testImplementation(deps.zip4j)
}
}
2 changes: 1 addition & 1 deletion seal/src/main/kotlin/me/xx2bab/seal/Injector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Injector {
private const val LOG_TAG = "[Seal]: "

private val documentBuilderFactory = DocumentBuilderFactory.newInstance()
private val transformer= TransformerFactory.newInstance().newTransformer()
private val transformer = TransformerFactory.newInstance().newTransformer()

fun newDOMBuilder(): DocumentBuilder {
return documentBuilderFactory.newDocumentBuilder()
Expand Down

0 comments on commit c13a944

Please sign in to comment.