Skip to content

Commit

Permalink
Merge pull request #20 from 2BAB/dev_v2
Browse files Browse the repository at this point in the history
3.3.0 with AGP8.1/8.0 support
  • Loading branch information
2BAB authored Dec 28, 2023
2 parents 7deac37 + 92f65f3 commit db28389
Show file tree
Hide file tree
Showing 30 changed files with 555 additions and 394 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,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 @@ -51,11 +51,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 @@ -74,11 +74,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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pluginManagement {
}
plugins {
...
id("me.2bab.scratchpaper") version "3.2.1" apply false
id("me.2bab.scratchpaper") version "3.3.0" apply false
}
}
Expand All @@ -61,7 +61,7 @@ buildscript {
}
dependencies {
...
classpath("me.2bab:scratchpaper:3.2.1")
classpath("me.2bab:scratchpaper:3.3.0")
}
}
```
Expand Down Expand Up @@ -126,8 +126,10 @@ ScratchPaper is only supported & tested on LATEST ONE Minor versions of Android

AGP Version|Latest Support Version
-----------|-----------------
7.2.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
7.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
8.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
8.0.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
7.2.x | 3.2.1
7.1.x | 3.2.1
7.0.x | 3.0.0
4.2.x | 2.6.0
4.1.x | 2.5.4
Expand Down Expand Up @@ -162,7 +164,7 @@ The v1.x `IconCover` forked from [icon-version@akonior](https://github.com/akoni
## License

>
> Copyright 2016-2022 2BAB
> Copyright Since 2016 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
12 changes: 7 additions & 5 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pluginManagement {
}
plugins {
...
id("me.2bab.scratchpaper") version "3.2.1" apply false
id("me.2bab.scratchpaper") version "3.3.0" apply false
}
}

Expand All @@ -56,7 +56,7 @@ buildscript {
}
dependencies {
...
classpath("me.2bab:scratchpaper:3.2.1")
classpath("me.2bab:scratchpaper:3.3.0")
}
}
```
Expand Down Expand Up @@ -119,8 +119,10 @@ scratchPaper {

AGP Version|Latest Support Version
-----------|-----------------
7.2.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
7.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
8.1.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
8.0.x | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.2bab/scratchpaper/badge.svg)](https://search.maven.org/artifact/me.2bab/scratchpaper)
7.2.x | 3.2.1
7.1.x | 3.2.1
7.0.x | 3.0.0
4.1.x | 2.5.4
4.0.x | 2.5.3
Expand Down Expand Up @@ -152,7 +154,7 @@ The v1.x `IconCover` forked from [icon-version@akonior](https://github.com/akoni
## License

>
> Copyright 2016-2022 2BAB
> Copyright Since 2016 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/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

dependencies {
// Github Release
implementation("com.github.breadmoirai:github-release:2.2.12")
implementation("com.github.breadmoirai:github-release:2.5.2")
}

repositories {
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 scratchPaperVersion = "3.2.1"
const val scratchPaperVersion = "3.3.0"
}

}
71 changes: 32 additions & 39 deletions buildSrc/src/main/kotlin/github-release.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
import java.util.*

val libs = File(project.buildDir.absoluteFile, "libs")
val taskName = "releaseArtifactsToGithub"
val artifacts: DirectoryProperty = project.objects.directoryProperty()
artifacts.set(libs)

// Temporary workaround for directory is not recognized by ReleaseAssets
gradle.taskGraph.whenReady {
beforeTask {
if (this is GithubReleaseTask) {
this.setReleaseAssets(libs.listFiles())
}
}
}

val tokenFromEnv: String? = System.getenv("GH_DEV_TOKEN")
val token: String = if (!tokenFromEnv.isNullOrBlank()) {
Expand All @@ -31,31 +19,36 @@ val repo = "ScratchPaper"
val tagBranch = "master"
val version = BuildConfig.Versions.scratchPaperVersion
val releaseNotes = ""
createGithubReleaseTaskInternal(artifacts, token, repo, tagBranch, version, releaseNotes)


fun createGithubReleaseTaskInternal(artifacts: DirectoryProperty,
token: String,
repo: String,
tagBranch: String,
version: String,
releaseNotes: String): TaskProvider<GithubReleaseTask> {
// val id = version.replace(".", "")
return project.tasks.register<GithubReleaseTask>("releaseArtifactsToGithub") {
setAuthorization("Token $token")
setOwner("2bab")
setRepo(repo)
setTagName(version)
setTargetCommitish(tagBranch)
setReleaseName(version)
setBody(releaseNotes)
setDraft(false)
setPrerelease(false)
setReleaseAssets(artifacts)
setOverwrite(true)
setAllowUploadToExisting(true)
setApiEndpoint("https://api.github.com")
setDryRun(false)
val task = createGithubReleaseTaskInternal(token, repo, tagBranch, version, releaseNotes)


fun createGithubReleaseTaskInternal(
token: String,
repo: String,
tagBranch: String,
version: String,
releaseNotes: String
): TaskProvider<GithubReleaseTask> {
return project.tasks.register<GithubReleaseTask>(taskName) {
authorization.set("Token $token")
owner.set("2bab")
this.repo.set(repo)
tagName.set(version)
targetCommitish.set(tagBranch)
releaseName.set("v${version}")
body.set(releaseNotes)
draft.set(false)
prerelease.set(false)
overwrite.set(true)
allowUploadToExisting.set(true)
apiEndpoint.set("https://api.github.com")
dryRun.set(false)
generateReleaseNotes.set(false)
releaseAssets.from(
tasks.getByName<Jar>("jar").archiveFile, // seal-${version}.jar
tasks.getByName<Jar>("sourcesJar").archiveFile, // seal-${version}-sources.jar
tasks.getByName<Jar>("javadocJar").archiveFile, // seal-${version}-javadoc.jar
//tasks.getByName<Sign>("signPluginMavenPublication").outputs, // seal-${version}-asc.jar, seal-${version}-sources-asc.jar, seal-${version}-sources-asc.jar,
)
}
}

}
10 changes: 1 addition & 9 deletions buildSrc/src/main/kotlin/maven-central-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +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,20 +70,16 @@ publishing {
}
}

signing {
sign(publishing.publications)
}

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.scratchPaperVersion
artifact(javadocJar.get())

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

[libraries]
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agpVer" }
Expand Down
5 changes: 3 additions & 2 deletions functional-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ group = "me.2bab"

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

dependencies {
Expand Down
16 changes: 8 additions & 8 deletions functional-test/src/functionalTest/kotlin/BasicFunctionalTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class BasicFunctionalTest {
@BeforeAll
@JvmStatic
fun buildTestProject() {
// if (File("../local.properties").exists()) {
// println("Publishing libraries to MavenLocal...")
// ("./gradlew" + " :plugin:publishAllPublicationsToMyMavenlocalRepository"
// + " --stacktrace").runCommand(File("../"))
// println("All libraries published.")
// }
if (File("../local.properties").exists()) {
println("Publishing libraries to MavenLocal...")
("./gradlew" + " :scratchpaper:publishToMavenLocal"
+ " --stacktrace").runCommand(File("../"))
println("All libraries published.")
}
runBlocking(Dispatchers.IO) {
agpVerProvider().map { agpVer ->
async {
Expand Down Expand Up @@ -61,7 +61,7 @@ class BasicFunctionalTest {
println("assembleFullDebug for [$agpVer]")

GradleRunner.create()
.withGradleVersion("7.4.2")
.withGradleVersion("8.5")
.forwardOutput()
.withArguments("clean", "assembleFullDebug", "--stacktrace")
.withProjectDir(targetProject)
Expand Down Expand Up @@ -155,7 +155,7 @@ class BasicFunctionalTest {
@ParameterizedTest
@MethodSource("agpVerProvider")
fun pngOverlayContentIsAttached_Correctly() {
// TODO: Haven't found a simple&royal-free OCR framework
// TODO: Haven't found a simple&free OCR framework
// to fulfill the test requirement. Will add the test once seeked.
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Sun Sep 13 20:38:33 SGT 2020
distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit db28389

Please sign in to comment.