Skip to content

Commit

Permalink
migrate props to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aajtodd committed Jul 27, 2023
1 parent 2129c09 commit 258ff5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
22 changes: 2 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import aws.sdk.kotlin.gradle.kmp.typedProp
import java.net.URL
import java.time.Duration
import java.util.Properties

buildscript {
dependencies {
Expand Down Expand Up @@ -89,25 +89,7 @@ subprojects {
}
}

val localProperties: Map<String, Any> by lazy {
val props = Properties()

listOf(
File(rootProject.projectDir, "local.properties"), // Project-specific local properties
File(rootProject.projectDir.parent, "local.properties"), // Workspace-specific local properties
File(System.getProperty("user.home"), ".sdkdev/local.properties"), // User-specific local properties
)
.filter(File::exists)
.map(File::inputStream)
.forEach(props::load)

props.mapKeys { (k, _) -> k.toString() }
}

fun Project.prop(name: String): Any? =
this.properties[name] ?: localProperties[name]

if (project.prop("kotlinWarningsAsErrors")?.toString()?.toBoolean() == true) {
if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
Expand Down
3 changes: 1 addition & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ pluginManagement {
}

sourceControl {
// gitRepository(java.net.URI("https://github.com/awslabs/aws-kotlin-repo-tools.git")){
gitRepository(java.net.URI("file:///Users/todaaron/sandbox/aws-kotlin-repo-tools")){
gitRepository(java.net.URI("https://github.com/awslabs/aws-kotlin-repo-tools.git")){
producesModule("aws.sdk.kotlin:build-plugins")
}
}
Expand Down

0 comments on commit 258ff5b

Please sign in to comment.