Skip to content

Commit

Permalink
Merge pull request #1193 from android/wff-validate
Browse files Browse the repository at this point in the history
Adds use of validator plugin
  • Loading branch information
garanj authored Oct 16, 2024
2 parents 2c32938 + c6d315e commit 2797938
Show file tree
Hide file tree
Showing 33 changed files with 555 additions and 25 deletions.
8 changes: 5 additions & 3 deletions WatchFaceFormat/Complications/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.6.1" apply false
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
9 changes: 9 additions & 0 deletions WatchFaceFormat/Complications/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }


5 changes: 4 additions & 1 deletion WatchFaceFormat/Complications/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
pluginManagement {
includeBuild("../validator-plugin")
repositories {
google()
mavenCentral()
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
mavenCentral()
}
}
// See: https://medium.com/@ttdevelopment/encountering-the-unable-to-make-progress-running-work-error-in-gradle-6bc363ac1eb8
gradle.startParameter.excludedTaskNames.addAll(listOf(":validator-plugin:plugins:testClasses"))

rootProject.name = "Complications"
include(":watchface")
include(":watchface")
5 changes: 4 additions & 1 deletion WatchFaceFormat/Complications/watchface/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/
plugins {
id("com.android.application")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
// Use the locally-defined validator to demonstrate validation on-build.
id("com.google.wff.validatorplugin")
}

android {
Expand Down
8 changes: 5 additions & 3 deletions WatchFaceFormat/Flavors/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.6.1" apply false
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
9 changes: 9 additions & 0 deletions WatchFaceFormat/Flavors/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }


5 changes: 4 additions & 1 deletion WatchFaceFormat/Flavors/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
pluginManagement {
includeBuild("../validator-plugin")
repositories {
google()
mavenCentral()
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
mavenCentral()
}
}
// See: https://medium.com/@ttdevelopment/encountering-the-unable-to-make-progress-running-work-error-in-gradle-6bc363ac1eb8
gradle.startParameter.excludedTaskNames.addAll(listOf(":validator-plugin:plugins:testClasses"))

rootProject.name = "Flavors"
include(":watchface")
include(":watchface")
5 changes: 4 additions & 1 deletion WatchFaceFormat/Flavors/watchface/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/
plugins {
id("com.android.application")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
// Use the locally-defined validator to demonstrate validation on-build.
id("com.google.wff.validatorplugin")
}

android {
Expand Down
8 changes: 5 additions & 3 deletions WatchFaceFormat/SimpleAnalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.6.1" apply false
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
9 changes: 9 additions & 0 deletions WatchFaceFormat/SimpleAnalog/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }


5 changes: 4 additions & 1 deletion WatchFaceFormat/SimpleAnalog/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
pluginManagement {
includeBuild("../validator-plugin")
repositories {
google()
mavenCentral()
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
mavenCentral()
}
}
// See: https://medium.com/@ttdevelopment/encountering-the-unable-to-make-progress-running-work-error-in-gradle-6bc363ac1eb8
gradle.startParameter.excludedTaskNames.addAll(listOf(":validator-plugin:plugins:testClasses"))

rootProject.name = "SimpleAnalog"
include(":watchface")
include(":watchface")
5 changes: 4 additions & 1 deletion WatchFaceFormat/SimpleAnalog/watchface/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/
plugins {
id("com.android.application")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
// Use the locally-defined validator to demonstrate validation on-build.
id("com.google.wff.validatorplugin")
}

android {
Expand Down
8 changes: 5 additions & 3 deletions WatchFaceFormat/SimpleDigital/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.6.1" apply false
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
9 changes: 9 additions & 0 deletions WatchFaceFormat/SimpleDigital/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }


5 changes: 4 additions & 1 deletion WatchFaceFormat/SimpleDigital/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
pluginManagement {
includeBuild("../validator-plugin")
repositories {
google()
mavenCentral()
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
mavenCentral()
}
}
// See: https://medium.com/@ttdevelopment/encountering-the-unable-to-make-progress-running-work-error-in-gradle-6bc363ac1eb8
gradle.startParameter.excludedTaskNames.addAll(listOf(":validator-plugin:plugins:testClasses"))

rootProject.name = "SimpleDigital"
include(":watchface")
include(":watchface")
5 changes: 4 additions & 1 deletion WatchFaceFormat/SimpleDigital/watchface/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/
plugins {
id("com.android.application")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
// Use the locally-defined validator to demonstrate validation on-build.
id("com.google.wff.validatorplugin")
}

android {
Expand Down
8 changes: 5 additions & 3 deletions WatchFaceFormat/Weather/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id("com.android.application") version "8.6.1" apply false
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
}
9 changes: 9 additions & 0 deletions WatchFaceFormat/Weather/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }


5 changes: 4 additions & 1 deletion WatchFaceFormat/Weather/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
pluginManagement {
includeBuild("../validator-plugin")
repositories {
google()
mavenCentral()
Expand All @@ -27,6 +28,8 @@ dependencyResolutionManagement {
mavenCentral()
}
}
// See: https://medium.com/@ttdevelopment/encountering-the-unable-to-make-progress-running-work-error-in-gradle-6bc363ac1eb8
gradle.startParameter.excludedTaskNames.addAll(listOf(":validator-plugin:plugins:testClasses"))

rootProject.name = "Weather"
include(":watchface")
include(":watchface")
5 changes: 4 additions & 1 deletion WatchFaceFormat/Weather/watchface/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/
plugins {
id("com.android.application")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
// Use the locally-defined validator to demonstrate validation on-build.
id("com.google.wff.validatorplugin")
}

android {
Expand Down
2 changes: 2 additions & 0 deletions WatchFaceFormat/validator-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Gradle properties are not passed to included builds https://github.com/gradle/gradle/issues/2534
org.gradle.parallel=true
9 changes: 9 additions & 0 deletions WatchFaceFormat/validator-plugin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[versions]
androidGradlePlugin = "8.7.0"
kotlin = "1.9.25"

[libraries]
android-gradlePlugin-api = { group = "com.android.tools.build", name = "gradle-api", version.ref = "androidGradlePlugin" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file.
Empty file.
45 changes: 45 additions & 0 deletions WatchFaceFormat/validator-plugin/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
`java-gradle-plugin`
alias(libs.plugins.kotlin.jvm)
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

dependencies {
implementation("com.android.tools.build:gradle-api:7.1.0-alpha13")

implementation("io.ktor:ktor-client-core:3.0.0")
runtimeOnly("io.ktor:ktor-client-okhttp:3.0.0")

compileOnly(libs.android.gradlePlugin.api)
implementation(gradleKotlinDsl())
}

gradlePlugin {
plugins {
create("wffValidatorPlugin") {
id = "com.google.wff.validatorplugin"
implementationClass = "WffValidatorPlugin"
}
}
}
Loading

0 comments on commit 2797938

Please sign in to comment.