Skip to content

Commit 8c86889

Browse files
committed
ci directory added with gradle project
1 parent 870e45d commit 8c86889

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import java.io.File
2+
import org.gradle.kotlin.dsl.*
3+
4+
plugins { alias(libs.plugins.spotless) }
5+
6+
spotless {
7+
kotlinGradle {
8+
target("*.gradle.kts")
9+
ktfmt("0.41").googleStyle()
10+
}
11+
}
12+
13+
abstract class InstallFirebaseToolsTask : DefaultTask() {
14+
15+
@get:Input abstract val firebaseToolsVersion: Property<String>
16+
17+
@get:OutputDirectory abstract val installDir: DirectoryProperty
18+
19+
@get:Inject abstract val execOperations: ExecOperations
20+
21+
@TaskAction
22+
fun execute() {
23+
val installDir: File = installDir.get().asFile
24+
val firebaseToolsVersion: String = firebaseToolsVersion.get()
25+
26+
logger.lifecycle("Creating directory: $installDir")
27+
installDir.mkdirs()
28+
29+
val packageJsonFile = File(installDir, "package.json")
30+
logger.lifecycle("Creating $packageJsonFile")
31+
packageJsonFile.writeText("{}")
32+
33+
execOperations.exec {
34+
workingDir = installDir
35+
setCommandLine(
36+
"npm",
37+
"install",
38+
"--fund=false",
39+
"--audit=false",
40+
"--save",
41+
"--save-exact",
42+
"firebase-tools@$firebaseToolsVersion",
43+
)
44+
logger.lifecycle("Running command in directory $workingDir: ${commandLine.joinToString(" ")}")
45+
}
46+
}
47+
}
48+
49+
tasks.register<InstallFirebaseToolsTask>("installFirebaseTools") {
50+
val projectDirectory = layout.projectDirectory
51+
installDir.set(providers.gradleProperty("installDir").map { projectDirectory.dir(it) })
52+
firebaseToolsVersion.set(providers.gradleProperty("firebaseToolsVersion"))
53+
}
54+
55+
class RequiredPropertyMissing(message: String) : Exception(message)
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See https://docs.gradle.org/current/userguide/build_environment.html#gradle_properties_reference
2+
3+
# When set to true, Gradle will reuse task outputs from any previous build when possible.
4+
# See https://docs.gradle.org/current/userguide/build_cache.html#build_cache
5+
org.gradle.caching=true
6+
7+
# Enables configuration caching. Gradle will try to reuse the build configuration from previous builds.
8+
# See https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:enable
9+
org.gradle.configuration-cache=true
10+
11+
# Enables incubating configuration-on-demand, where Gradle will attempt to configure only necessary projects.
12+
org.gradle.configureondemand=true
13+
14+
# When set to quiet, warn, info, or debug, Gradle will use this log level. The values are not case-sensitive.
15+
# Use "info" since this script uses a lot of info logging for normal output.
16+
org.gradle.logging.level=lifecycle
17+
18+
# When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute projects in parallel.
19+
# See https://docs.gradle.org/current/userguide/performance.html#parallel_execution
20+
org.gradle.parallel=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
rootProject.name = "dataconnect-ci"
2+
3+
dependencyResolutionManagement {
4+
repositories {
5+
google()
6+
mavenCentral()
7+
}
8+
9+
// Reuse libs.version.toml from the main Gradle project.
10+
versionCatalogs { create("libs") { from(files("../../gradle/libs.versions.toml")) } }
11+
}

0 commit comments

Comments
 (0)