Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/cid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Setup environment
run: ./gradlew publishToMavenLocal
- name: Run tests
run: ./gradlew check test -S
run: ./gradlew check test -S -x :play:play-publisher:lint

deploy_snapshot:
needs: [build, test]
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Gradle Cache
uses: gradle/actions/setup-gradle@v4
- name: Run lint
run: ./gradlew :play:play-publisher:lint
- name: Summarize lint errors
if: always()
run: |
report=play/plugin/build/reports/lint-results-jvmMain.xml
if [ ! -f "$report" ]; then
echo "No lint XML report was generated."
exit 0
fi

ruby -r rexml/document -e '
REXML::Document.new(File.read(ARGV[0])).elements.each("issues/issue") do |issue|
location = issue.elements["location"]
puts "#{issue.attributes["severity"]}: #{location.attributes["file"]}:#{location.attributes["line"]}: #{issue.attributes["message"]} [#{issue.attributes["id"]}]"
end
' "$report" | tee -a "$GITHUB_STEP_SUMMARY"
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {

plugins {
`lifecycle-base`
alias(libs.plugins.lint) apply false
alias(libs.plugins.depUpdates)

// Needed to support publishing all modules atomically
Expand Down
6 changes: 6 additions & 0 deletions play/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ plugins {
`kotlin-dsl`
`maven-publish`
signing
alias(libs.plugins.lint)
id("com.gradle.plugin-publish")
}

lint {
baseline = file("lint-baseline.xml")
}

dependencies {
implementation(project(":play:android-publisher"))
implementation(project(":common:utils"))
Expand All @@ -17,6 +22,7 @@ dependencies {
compileOnly(libs.agp.ddms)
implementation(libs.guava)
implementation(libs.client.gson)
lintChecks(libs.lint.gradle)

testImplementation(project(":common:utils"))
testImplementation(project(":common:validation"))
Expand Down
180 changes: 180 additions & 0 deletions play/plugin/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 9.0.0" type="baseline" client="gradle" dependencies="false" name="AGP (9.0.0)" variant="all" version="9.0.0">

<issue
id="GradleConfigurationCacheBroadInputs"
message="Use Project.providers.environmentVariable instead of getenv"
errorLine1=" System.getenv(&quot;ANDROID_SERIAL&quot;)"
errorLine2=" ~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/tasks/InstallInternalSharingArtifact.kt"
line="192"
column="32"/>
</issue>

<issue
id="GradleConfigurationCacheBroadInputs"
message="Use Project.providers.environmentVariable instead of getenv"
errorLine1=" System.getenv(PlayPublisher.CREDENTIAL_ENV_VAR) != null)"
errorLine2=" ~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/tasks/internal/PlayApiService.kt"
line="30"
column="24"/>
</issue>

<issue
id="GradleConfigurationCacheBroadInputs"
message="Use Project.providers.environmentVariable instead of getenv"
errorLine1=" val credsString = System.getenv(PlayPublisher.CREDENTIAL_ENV_VAR)"
errorLine2=" ~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/tasks/internal/PlayApiService.kt"
line="159"
column="34"/>
</issue>

<issue
id="GradleLikelyBug"
message="Implicit usage of toString on a Provider"
errorLine1=" |No application found for the package name &apos;$appId&apos;. The first version of your"
errorLine2=" ~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/tasks/internal/PlayApiService.kt"
line="136"
column="66"/>
</issue>

<issue
id="GradlePerformance"
message="Avoid using method mustRunAfter"
errorLine1=" mustRunAfter(bootstrapTask)"
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt"
line="377"
column="17"/>
</issue>

<issue
id="GradlePerformance"
message="Avoid using method mustRunAfter"
errorLine1=" mustRunAfter(publishApkTask)"
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt"
line="545"
column="17"/>
</issue>

<issue
id="GradlePerformance"
message="Avoid using method mustRunAfter"
errorLine1=" mustRunAfter(publishBundleTask)"
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt"
line="546"
column="17"/>
</issue>

<issue
id="GradleProjectIsolation"
message="Use isolated.rootProject instead of getRootProject"
errorLine1=" val project = if (extension.isolatedSingleProject.get()) this else rootProject"
errorLine2=" ~~~~~~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/internal/Plugins.kt"
line="56"
column="72"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" val classpathJars = GradleRunner.create().withPluginClasspath().pluginClasspath"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/ArtifactIntegrationTests.kt"
line="100"
column="51"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" .withPluginClasspath()"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/helpers/IntegrationTestBase.kt"
line="69"
column="18"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" runner.withPluginClasspath(runner.pluginClasspath + listOf("
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/helpers/IntegrationTestBase.kt"
line="85"
column="16"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" val classpathJars = GradleRunner.create().withPluginClasspath().pluginClasspath"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/PlayPublisherPluginIntegrationTest.kt"
line="671"
column="51"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" val classpathJars = GradleRunner.create().withPluginClasspath().pluginClasspath"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/PlayPublisherPluginIntegrationTest.kt"
line="919"
column="51"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" val classpathJars = GradleRunner.create().withPluginClasspath().pluginClasspath"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/PlayPublisherPluginIntegrationTest.kt"
line="1020"
column="51"/>
</issue>

<issue
id="WithPluginClasspathUsage"
message="Avoid usage of GradleRunner#withPluginClasspath, which is broken. Instead use something like https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit#gradle-testkit-support-plugin"
errorLine1=" val classpathJars = GradleRunner.create().withPluginClasspath().pluginClasspath"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="src/test/kotlin/com/github/triplet/gradle/play/PlayPublisherPluginIntegrationTest.kt"
line="1097"
column="51"/>
</issue>

<issue
id="WithTypeWithoutConfigureEach"
message="Avoid passing a closure to withType, use withType().configureEach instead"
errorLine1=" project.plugins.withType&lt;AppPlugin> {"
errorLine2=" ~~~~~~~~">
<location
file="src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt"
line="84"
column="25"/>
</issue>

</issues>
10 changes: 10 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import org.gradle.kotlin.dsl.version

pluginManagement {
repositories {
gradlePluginPortal()
google()
}
}

plugins {
id("com.gradle.develocity") version "4.3.1"
}
Expand Down Expand Up @@ -30,13 +37,15 @@ dependencyResolutionManagement {
version("depUpdates", "0.50.0")
version("gradlePublish", "1.2.1")
version("nexusPublish", "2.0.0")
version("lint-gradle", "1.0.0")

plugin("depUpdates", "com.github.ben-manes.versions")
.versionRef("depUpdates")
plugin("gradlePublish", "com.gradle.plugin-publish")
.versionRef("gradlePublish")
plugin("nexusPublish", "io.github.gradle-nexus.publish-plugin")
.versionRef("nexusPublish")
plugin("lint", "com.android.lint").versionRef("agp")

version("agp", "9.0.0")
version("agp-tools", "32.0.0")
Expand All @@ -61,6 +70,7 @@ dependencyResolutionManagement {
library("client-gson", "com.google.http-client", "google-http-client-gson")
.versionRef("http-client")
library("guava", "com.google.guava", "guava").versionRef("guava")
library("lint-gradle", "androidx.lint", "lint-gradle").versionRef("lint-gradle")
}

create("testLibs") {
Expand Down
Loading