-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade kotlin version to 1.3.61, build caching, and publishing impro…
…vements (#39)
- Loading branch information
Showing
7 changed files
with
67 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import org.gradle.caching.http.HttpBuildCache | ||
import org.gradle.kotlin.dsl.KotlinSettingsScript | ||
import java.net.URI | ||
|
||
fun KotlinSettingsScript.setupBuildCache() { | ||
buildCache { | ||
val localBuildCacheUrl = Properties.gradleLocalBuildCacheUrl | ||
if (!localBuildCacheUrl.isNullOrEmpty()) { | ||
println("Using local build cache located at: $localBuildCacheUrl") | ||
local(HttpBuildCache::class.java) { | ||
url = URI(localBuildCacheUrl) | ||
} | ||
} | ||
} | ||
} |
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,40 @@ | ||
import org.gradle.api.Project | ||
import java.io.File | ||
|
||
object Properties { | ||
val isRelease by lazy { | ||
System.getenv("release") == "true" | ||
private val properties = java.util.Properties() | ||
|
||
init { | ||
val home = System.getenv("HOME") | ||
properties.apply { | ||
loadPropertiesIfExists("local.properties") | ||
home?.also { | ||
loadPropertiesIfExists("$it/.gradle/gradle.properties") | ||
} | ||
} | ||
} | ||
|
||
val ossrhUsername by lazy { | ||
optionalProperty("ossrhUsername") | ||
} | ||
|
||
val ossrhPassword by lazy { | ||
optionalProperty("ossrhPassword") | ||
} | ||
|
||
val gradleLocalBuildCacheUrl by lazy { | ||
optionalProperty("GRADLE_LOCAL_BUILD_CACHE_URL") | ||
} | ||
|
||
fun Project.requiredForReleaseProperty(name: String) = | ||
private fun optionalProperty(name: String): String? = | ||
properties[name] as String? | ||
?: let { | ||
if (isRelease) | ||
throw RuntimeException("Missing property $name") | ||
return "" | ||
?: System.getenv(name) | ||
|
||
private fun java.util.Properties.loadPropertiesIfExists(propertiesFile: String) { | ||
val localPropertiesFile = File(propertiesFile) | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.inputStream().use { | ||
load(it) | ||
} | ||
} | ||
} | ||
} | ||
} |
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