-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
176 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.gradle | ||
.idea | ||
build | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,48 @@ | ||
import com.android.build.api.attributes.BuildTypeAttr | ||
|
||
plugins { | ||
id("org.gradle.java") | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.base.dependency-rules") | ||
id("org.example.gradle.check.format-gradle") | ||
id("org.example.gradle.report.code-coverage") | ||
// id("org.example.gradle.report.code-coverage") | ||
id("org.example.gradle.report.plugin-analysis") | ||
id("org.example.gradle.report.sbom") | ||
id("org.example.gradle.report.test") | ||
// id("org.example.gradle.report.test") | ||
} | ||
|
||
dependencies { implementation(projects.app) } | ||
|
||
configurations { | ||
compileClasspath { selectRelease() } | ||
runtimeClasspath { selectRelease() } | ||
testCompileClasspath { selectRelease() } | ||
testRuntimeClasspath { selectRelease() } | ||
} | ||
|
||
fun Configuration.selectRelease() { | ||
attributes.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "jar") | ||
attributes.attribute(BuildTypeAttr.ATTRIBUTE, objects.named("release")) | ||
} | ||
|
||
// Allow AARs to appear along JARs on the joint classpath for reports | ||
dependencies { | ||
attributesSchema { getMatchingStrategy(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE).compatibilityRules.add(AarJarCompatibility::class.java) } | ||
attributesSchema { getMatchingStrategy(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE).compatibilityRules.add(AarJarStringCompatibility::class.java) } | ||
} | ||
|
||
class AarJarCompatibility : AttributeCompatibilityRule<LibraryElements> { | ||
override fun execute(details: CompatibilityCheckDetails<LibraryElements>) { | ||
if (details.producerValue?.name == "aar") { | ||
details.compatible() | ||
} | ||
} | ||
} | ||
|
||
class AarJarStringCompatibility : AttributeCompatibilityRule<String> { | ||
override fun execute(details: CompatibilityCheckDetails<String>) { | ||
if (details.producerValue == "aar" || details.producerValue == "android-classes-jar") { | ||
details.compatible() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
gradle/plugins/src/main/kotlin/org.example.gradle.component.android-library.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
plugins { | ||
id("org.example.gradle.base.dependency-rules") | ||
id("org.example.gradle.base.identity") | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.check.dependencies") | ||
id("org.example.gradle.check.format-gradle") | ||
id("org.example.gradle.check.format-java") | ||
id("org.example.gradle.feature.android-library") | ||
} |
7 changes: 1 addition & 6 deletions
7
gradle/plugins/src/main/kotlin/org.example.gradle.component.application.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
plugins { | ||
id("org.gradle.application") | ||
id("org.example.gradle.base.dependency-rules") | ||
id("org.example.gradle.base.identity") | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.check.dependencies") | ||
id("org.example.gradle.check.format-gradle") | ||
id("org.example.gradle.check.format-java") | ||
id("org.example.gradle.feature.android-application") | ||
id("org.example.gradle.feature.checksum") | ||
id("org.example.gradle.feature.compile-java") | ||
id("org.example.gradle.feature.javadoc") | ||
id("org.example.gradle.feature.test") | ||
id("org.example.gradle.feature.test-end-to-end") | ||
id("org.example.gradle.feature.war") | ||
} |
55 changes: 55 additions & 0 deletions
55
gradle/plugins/src/main/kotlin/org.example.gradle.feature.android-application.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
plugins { | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.base.dependency-rules") | ||
id("com.android.application") | ||
} | ||
|
||
val versionString = | ||
providers.fileContents(isolated.rootProject.projectDirectory.file("gradle/version.txt")).asText.getOrElse("") | ||
val versionInt = versionString.split(".")[0].toInt() * 1000 + versionString.split(".")[1].toInt() | ||
|
||
android { | ||
compileSdk = 34 | ||
namespace = "org.example.product.${project.name}" | ||
defaultConfig { | ||
applicationId = "org.example.product.app" | ||
minSdk = 26 | ||
targetSdk = 34 | ||
versionCode = versionInt | ||
versionName = versionString | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes.getByName("release") { minifyEnabled(false) } | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
packaging { resources.excludes.add("META-INF/**") } | ||
} | ||
|
||
// Configure common test runtime dependencies for android application projects | ||
dependencies { androidTestRuntimeOnly("androidx.test.espresso:espresso-core") } | ||
|
||
// Required, because 'org.gradlex.jvm-dependency-conflict-resolution' does not | ||
// automatically configure everything for Android (yet) | ||
android { | ||
applicationVariants.all { | ||
compileConfiguration.configureConsistentResolution() | ||
runtimeConfiguration.configureConsistentResolution() | ||
unitTestVariant.compileConfiguration.configureConsistentResolution() | ||
unitTestVariant.runtimeConfiguration.configureConsistentResolution() | ||
if (testVariant != null) { | ||
testVariant.compileConfiguration.configureConsistentResolution() | ||
testVariant.runtimeConfiguration.configureConsistentResolution() | ||
} | ||
} | ||
} | ||
|
||
fun Configuration.configureConsistentResolution() { | ||
extendsFrom(configurations["internal"]) | ||
shouldResolveConsistentlyWith(configurations["mainRuntimeClasspath"]) | ||
} |
33 changes: 33 additions & 0 deletions
33
gradle/plugins/src/main/kotlin/org.example.gradle.feature.android-library.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
plugins { | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.base.dependency-rules") | ||
id("com.android.library") | ||
} | ||
|
||
android { | ||
compileSdk = 34 | ||
namespace = "org.example.product.${project.name}" | ||
|
||
defaultConfig { minSdk = 26 } | ||
} | ||
|
||
// Required, because 'org.gradlex.jvm-dependency-conflict-resolution' does not | ||
// automatically configure everything for Android (yet) | ||
android { | ||
libraryVariants.all { | ||
compileConfiguration.configureConsistentResolution() | ||
runtimeConfiguration.configureConsistentResolution() | ||
unitTestVariant.compileConfiguration.configureConsistentResolution() | ||
unitTestVariant.runtimeConfiguration.configureConsistentResolution() | ||
if (testVariant != null) { | ||
testVariant.compileConfiguration.configureConsistentResolution() | ||
testVariant.runtimeConfiguration.configureConsistentResolution() | ||
} | ||
} | ||
packaging { resources.excludes.add("META-INF/*") } | ||
} | ||
|
||
fun Configuration.configureConsistentResolution() { | ||
extendsFrom(configurations["internal"]) | ||
shouldResolveConsistentlyWith(configurations["mainRuntimeClasspath"]) | ||
} |
4 changes: 0 additions & 4 deletions
4
gradle/plugins/src/main/kotlin/org.example.gradle.feature.checksum.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
import org.example.gradle.tasks.MD5DirectoryChecksum | ||
|
||
plugins { id("org.gradle.java") } | ||
|
||
// Generate additional resources required at application runtime | ||
// This is an example for creating and integrating a custom task implementation. | ||
tasks.register<MD5DirectoryChecksum>("resourcesChecksum") { | ||
inputDirectory = layout.projectDirectory.dir("src/main/resources") | ||
checksumFile = layout.buildDirectory.file("generated-resources/md5/resources.MD5") | ||
} | ||
|
||
tasks.processResources { from(tasks.named("resourcesChecksum")) } |
1 change: 1 addition & 0 deletions
1
gradle/plugins/src/main/kotlin/org.example.gradle.feature.repositories.settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dependencyResolutionManagement { | ||
// Get components from Maven Central | ||
repositories.mavenCentral() | ||
repositories.google() | ||
} |
33 changes: 0 additions & 33 deletions
33
gradle/plugins/src/main/kotlin/org.example.gradle.feature.test-end-to-end.gradle.kts
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
gradle/plugins/src/main/kotlin/org.example.gradle.feature.war.gradle.kts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.