|
1 |
| -//version: 1660899027 |
| 1 | +//version: 1660994461 |
2 | 2 | /*
|
3 | 3 | DO NOT CHANGE THIS FILE!
|
4 | 4 | Also, you may replace this file at any time if there is an update available.
|
@@ -59,7 +59,8 @@ plugins {
|
59 | 59 | id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
|
60 | 60 | id 'com.diffplug.spotless' version '6.7.2' apply false
|
61 | 61 | }
|
62 |
| -verifySettingsGradle() |
| 62 | +if(verifySettingsGradle() || verifyGitAttributes()) |
| 63 | + throw new GradleException("Settings has been updated, please re-run task.") |
63 | 64 |
|
64 | 65 | dependencies {
|
65 | 66 | implementation 'com.diffplug:blowdryer:1.6.0'
|
@@ -666,28 +667,47 @@ if (!project.getGradle().startParameter.isOffline() && isNewBuildScriptVersionAv
|
666 | 667 | }
|
667 | 668 |
|
668 | 669 | static URL availableBuildScriptUrl() {
|
669 |
| - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") |
| 670 | + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") |
670 | 671 | }
|
671 | 672 | static URL exampleSettingsGradleUrl() {
|
672 |
| - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example") |
| 673 | + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example") |
| 674 | +} |
| 675 | +static URL exampleGitAttributesUrl() { |
| 676 | + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes") |
673 | 677 | }
|
674 | 678 |
|
675 | 679 |
|
676 |
| -def verifySettingsGradle() { |
| 680 | +boolean verifyGitAttributes() { |
| 681 | + def gitattributesFile = getFile(".gitattributes") |
| 682 | + if (!gitattributesFile.exists()) { |
| 683 | + println("Downloading default .gitattributes") |
| 684 | + exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } } |
| 685 | + exec { |
| 686 | + workingDir '.' |
| 687 | + commandLine 'git', 'add', '--renormalize', '.' |
| 688 | + } |
| 689 | + return true |
| 690 | + } |
| 691 | + return false |
| 692 | +} |
| 693 | + |
| 694 | +boolean verifySettingsGradle() { |
677 | 695 | def settingsFile = getFile("settings.gradle")
|
678 | 696 | if (!settingsFile.exists()) {
|
679 | 697 | println("Downloading default settings.gradle")
|
680 | 698 | exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
681 |
| - throw new GradleException("Settings.gradle has been updated, please re-run task.") |
| 699 | + return true |
682 | 700 | }
|
| 701 | + return false |
683 | 702 | }
|
684 | 703 |
|
685 | 704 | boolean performBuildScriptUpdate(String projectDir) {
|
686 | 705 | if (isNewBuildScriptVersionAvailable(projectDir)) {
|
687 | 706 | def buildscriptFile = getFile("build.gradle")
|
688 | 707 | availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
689 | 708 | out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
690 |
| - verifySettingsGradle() |
| 709 | + if(verifySettingsGradle() || verifyGitAttributes()) |
| 710 | + throw new GradleException("Settings has been updated, please re-run task.") |
691 | 711 | return true
|
692 | 712 | }
|
693 | 713 | return false
|
|
0 commit comments