Skip to content

Commit 599e987

Browse files
committed
wip
1 parent 924547f commit 599e987

File tree

7 files changed

+76
-80
lines changed

7 files changed

+76
-80
lines changed

buildSrc/src/main/kotlin/software/aws/toolkits/gradle/changelog/tasks/ChangeLogTask.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import org.gradle.api.tasks.Internal
1212
import software.aws.toolkits.gradle.changelog.GitStager
1313

1414
abstract class ChangeLogTask : DefaultTask() {
15-
@Internal
16-
protected val git = GitStager.create(project.rootDir)
15+
fun git() = GitStager.create(project.rootDir)
1716

1817
@InputDirectory
1918
val changesDirectory: DirectoryProperty = project.objects.directoryProperty().convention(project.rootProject.layout.projectDirectory.dir(".changes"))

buildSrc/src/main/kotlin/software/aws/toolkits/gradle/changelog/tasks/CreateRelease.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ open class CreateRelease @Inject constructor(projectLayout: ProjectLayout) : Cha
4545

4646
val creator = ReleaseCreator(releaseEntries.files, releaseFile.get().asFile, logger)
4747
creator.create(releaseVersion.get(), releaseDate)
48+
val git = git()
4849
if (git != null) {
4950
git.stage(releaseFile.get().asFile.absoluteFile)
5051
git.stage(nextReleaseDirectory.get().asFile.absoluteFile)

buildSrc/src/main/kotlin/software/aws/toolkits/gradle/changelog/tasks/GenerateChangeLog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract class GenerateChangeLog(private val shouldStage: Boolean) : ChangeLogTa
4646
generator.close()
4747

4848
if (shouldStage) {
49-
git?.stage(changeLogFile.get().asFile)
49+
git()?.stage(changeLogFile.get().asFile)
5050
}
5151
}
5252

buildSrc/src/main/kotlin/software/aws/toolkits/gradle/changelog/tasks/NewChange.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ open class NewChange : ChangeLogTask() {
3030
changeType != null && description != null -> createChange(changeType, description)
3131
else -> promptForChange(input, changeType)
3232
}
33-
git?.stage(file)
33+
git()?.stage(file)
3434
}
3535

3636
private fun promptForChange(input: Scanner, existingChangeType: ChangeType?): File {

buildSrc/src/main/kotlin/toolkit-git-secrets.gradle.kts

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,43 @@ plugins {
88
id("de.undercouch.download")
99
}
1010

11-
//val downloadGitSecrets = tasks.register<Download>("downloadGitSecrets") {
12-
// src("https://raw.githubusercontent.com/awslabs/git-secrets/master/git-secrets")
13-
// dest("$buildDir/git-secrets")
14-
// onlyIfModified(true)
15-
// useETag(true)
16-
//}
17-
//
18-
//val gitSecrets = tasks.register<Exec>("gitSecrets") {
19-
// onlyIf {
20-
// !DefaultNativePlatform.getCurrentOperatingSystem().isWindows
21-
// }
22-
//
23-
// dependsOn(downloadGitSecrets)
24-
// workingDir(project.rootDir)
25-
// val path = "$buildDir${File.pathSeparator}"
26-
// val patchendEnv = environment.apply { replace("PATH", path + getOrDefault("PATH", "")) }
27-
// environment = patchendEnv
28-
//
29-
// commandLine("/bin/sh", "$buildDir/git-secrets", "--register-aws")
30-
//
31-
// // cleaner than having multiple separate exec tasks
32-
// doLast {
33-
// exec {
34-
// workingDir(project.rootDir)
35-
// commandLine("git", "config", "--add", "secrets.allowed", "123456789012")
36-
// }
37-
//
38-
// exec {
39-
// workingDir(project.rootDir)
40-
// environment = patchendEnv
41-
// commandLine("/bin/sh", "$buildDir/git-secrets", "--scan")
42-
// }
43-
// }
44-
//}
45-
//
46-
//tasks.findByName("check")?.let {
47-
// it.dependsOn(gitSecrets)
48-
//}
11+
val downloadGitSecrets = tasks.register<Download>("downloadGitSecrets") {
12+
src("https://raw.githubusercontent.com/awslabs/git-secrets/master/git-secrets")
13+
dest(layout.buildDirectory.file("git-secrets"))
14+
onlyIfModified(true)
15+
useETag(true)
16+
}
17+
18+
val gitSecrets = tasks.register<Exec>("gitSecrets") {
19+
notCompatibleWithConfigurationCache("runs commands; do we even need this?")
20+
21+
onlyIf {
22+
!DefaultNativePlatform.getCurrentOperatingSystem().isWindows
23+
}
24+
25+
dependsOn(downloadGitSecrets)
26+
workingDir(project.rootDir)
27+
val path = "$buildDir${File.pathSeparator}"
28+
val patchendEnv = environment.apply { replace("PATH", path + getOrDefault("PATH", "")) }
29+
environment = patchendEnv
30+
31+
commandLine("/bin/sh", "$buildDir/git-secrets", "--register-aws")
32+
33+
// cleaner than having multiple separate exec tasks
34+
doLast {
35+
providers.exec {
36+
workingDir(project.rootDir)
37+
commandLine("git", "config", "--add", "secrets.allowed", "123456789012")
38+
}
39+
40+
providers.exec {
41+
workingDir(project.rootDir)
42+
environment = patchendEnv
43+
commandLine("/bin/sh", "$buildDir/git-secrets", "--scan")
44+
}
45+
}
46+
}
47+
48+
tasks.findByName("check")?.let {
49+
it.dependsOn(gitSecrets)
50+
}

plugins/amazonq/build.gradle.kts

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ buildscript {
2121
}
2222
}
2323

24-
//val changelog = tasks.register<GeneratePluginChangeLog>("pluginChangeLog") {
25-
// includeUnreleased.set(true)
26-
// changeLogFile.value(layout.buildDirectory.file("changelog/change-notes.xml"))
27-
//}
24+
val changelog = tasks.register<GeneratePluginChangeLog>("pluginChangeLog") {
25+
includeUnreleased.set(true)
26+
changeLogFile.value(layout.buildDirectory.file("changelog/change-notes.xml"))
27+
}
2828

2929
tasks.jar {
30-
// dependsOn(changelog)
31-
// from(changelog) {
32-
// into("META-INF")
33-
// }
30+
dependsOn(changelog)
31+
from(changelog) {
32+
into("META-INF")
33+
}
3434
}
3535

3636
dependencies {
@@ -109,35 +109,29 @@ val downloadFlareArtifacts by tasks.registering(Download::class) {
109109
useETag(true)
110110
}
111111

112-
val prepareBundledFlare by tasks.registering(Copy::class) {
113-
// TODO: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
114-
dependsOn(downloadFlareArtifacts)
115-
inputs.files(downloadFlareArtifacts)
116-
117-
val dest = layout.buildDirectory.dir("tmp/extractFlare")
118-
into(dest)
119-
from(downloadFlareArtifacts.map { it.outputFiles.filterNot { file -> file.name.endsWith(".zip") } })
120-
includeEmptyDirs = false
112+
//val prepareBundledFlare by tasks.registering(Copy::class) {
113+
// dependsOn(downloadFlareArtifacts)
114+
// inputs.files(downloadFlareArtifacts)
115+
// val dest = layout.buildDirectory.dir("tmp/extractFlare")
121116
//
122-
// doLast {
123-
// copy {
124-
// into(dest)
125-
// downloadFlareArtifacts.get().outputFiles.filter { it.name.endsWith(".zip") }.forEach {
126-
// dest.get().file(it.parentFile.name).asFile.createNewFile()
127-
// from(zipTree(it)) {
128-
// include("*.js")
129-
// include("*.txt")
130-
// }
117+
// includeEmptyDirs = false
118+
// into(dest) {
119+
// downloadFlareArtifacts.get().outputFiles.filter { it.name.endsWith(".zip") }.forEach {
120+
// println("Extracting flare from ${it}")
121+
// dest.get().file(it.parentFile.name).asFile.createNewFile()
122+
// from(zipTree(it)) {
123+
// include("*.js")
124+
// include("*.txt")
131125
// }
132126
// }
133127
// }
134-
}
128+
//}
135129

136130
tasks.withType<PrepareSandboxTask>().configureEach {
137131
from(file("contrib/QCT-Maven-6-16.jar")) {
138132
into(intellijPlatform.projectName.map { "$it/lib" })
139133
}
140-
from(prepareBundledFlare) {
141-
into(intellijPlatform.projectName.map { "$it/flare" })
142-
}
134+
// from(prepareBundledFlare) {
135+
// into(intellijPlatform.projectName.map { "$it/flare" })
136+
// }
143137
}

plugins/toolkit/jetbrains-core/build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ dependencies {
4040
}
4141
}
4242

43-
//val changelog = tasks.register<GeneratePluginChangeLog>("pluginChangeLog") {
44-
// includeUnreleased.set(true)
45-
// changeLogFile.set(project.layout.buildDirectory.file("changelog/change-notes.xml"))
46-
//}
43+
val changelog = tasks.register<GeneratePluginChangeLog>("pluginChangeLog") {
44+
includeUnreleased.set(true)
45+
changeLogFile.set(project.layout.buildDirectory.file("changelog/change-notes.xml"))
46+
}
4747

4848
tasks.compileJava {
4949
// https://github.com/gradle/gradle/issues/26006
@@ -60,10 +60,10 @@ patchPluginXml.configure {
6060
}
6161

6262
tasks.jar {
63-
// dependsOn(patchPluginXml, changelog)
64-
// from(changelog) {
65-
// into("META-INF")
66-
// }
63+
dependsOn(patchPluginXml, changelog)
64+
from(changelog) {
65+
into("META-INF")
66+
}
6767

6868
from(patchPluginXml) {
6969
duplicatesStrategy = DuplicatesStrategy.INCLUDE

0 commit comments

Comments
 (0)