Skip to content

Commit

Permalink
track settings.gradle with script updater
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Jul 31, 2023
1 parent 1a91174 commit 696f558
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buildscript-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [ master, main ]
paths:
- build.gradle
- settings.gradle
workflow_dispatch: { }

jobs:
Expand Down
21 changes: 3 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}

if (verifySettingsGradle()) {
throw new GradleException("Settings has been updated, please re-run task.")
}

def out = services.get(StyledTextOutputFactory).create('an-output')


Expand Down Expand Up @@ -1022,29 +1018,18 @@ static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle")
}

static URL exampleSettingsGradleUrl() {
static URL availableSettingsGradleUrl() {
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/settings.gradle")
}

boolean verifySettingsGradle() {
def settingsFile = getFile("settings.gradle")
if (!settingsFile.exists()) {
println("Downloading default settings.gradle")
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
return true
}
return false
}

boolean performBuildScriptUpdate() {
if (isNewBuildScriptVersionAvailable()) {
def buildscriptFile = getFile("build.gradle")
def settingsFile = getFile("settings.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
availableSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
def out = services.get(StyledTextOutputFactory).create('buildscript-update-output')
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
if (verifySettingsGradle()) {
throw new GradleException("Settings has been updated, please re-run task.")
}
return true
}
return false
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ plugins {
blowdryerSetup {
repoSubfolder 'spotless'
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.0'
//devLocal '.' // Use this when testing config updated locally
}

rootProject.name = rootProject.projectDir.getName()

0 comments on commit 696f558

Please sign in to comment.