Skip to content

Commit 10617ac

Browse files
adapt for new gradle
1 parent a95f022 commit 10617ac

12 files changed

+50
-52
lines changed

build.gradle

+8-10
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ plugins {
33
id 'groovy'
44

55
id 'maven-publish'
6-
id 'com.gradle.plugin-publish' version '0.9.10'
6+
id 'com.gradle.plugin-publish' version '0.15.0'
77

8-
id 'net.minecrell.licenser' version '0.4.1'
8+
id 'org.cadixdev.licenser' version '0.6.1'
99
}
1010

11-
sourceCompatibility = '1.8'
12-
targetCompatibility = '1.8'
13-
14-
group = 'org.cadixdev.gradle'
11+
group = 'cn.maxpixel.gradle'
1512
version = '0.10.0-SNAPSHOT'
1613
description = 'A Gradle plugin to manage patches for Git repositories'
1714

15+
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
16+
1817
dependencies {
1918
implementation gradleApi()
2019
}
@@ -37,21 +36,20 @@ task groovydocJar(type: Jar, dependsOn: groovydoc) {
3736
gradlePlugin {
3837
plugins {
3938
gitpatcher {
40-
id = 'org.cadixdev.gitpatcher'
39+
id = 'cn.maxpixel.gitpatcher'
4140
implementationClass = 'org.cadixdev.gradle.gitpatcher.GitPatcher'
4241
}
4342
}
4443
}
4544

4645
pluginBundle {
47-
website = 'https://github.com/CadixDev/gitpatcher'
46+
website = 'https://github.com/MaxPixelStudios/gitpatcher'
4847
vcsUrl = website
4948
description = project.description
5049
tags = ['git']
5150

5251
plugins {
53-
gitpatcherPlugin {
54-
id = 'org.cadixdev.gitpatcher'
52+
gitpatcher {
5553
displayName = 'gitpatcher'
5654
}
5755
}

gradle/wrapper/gradle-wrapper.jar

626 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ case "`uname`" in
7272
Darwin* )
7373
darwin=true
7474
;;
75-
MINGW* )
75+
MSYS* | MINGW* )
7676
msys=true
7777
;;
7878
NONSTOP* )
@@ -130,7 +130,7 @@ fi
130130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133-
133+
134134
JAVACMD=`cygpath --unix "$JAVACMD"`
135135

136136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

+3-18
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,29 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

8772

8873
@rem Execute Gradle
89-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
9075

9176
:end
9277
@rem End local scope for the variables with windows NT shell

src/main/groovy/org/cadixdev/gradle/gitpatcher/GitPatcher.groovy

+13-13
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ import org.gradle.api.Project
3333
class GitPatcher implements Plugin<Project> {
3434

3535
protected Project project
36-
protected PatchExtension extension
36+
protected PatchExtension patchExtension
3737

3838
@Override
3939
void apply(Project project) {
4040
this.project = project
4141
project.with {
42-
this.extension = extensions.create('patches', PatchExtension)
43-
extension.root = projectDir
42+
this.patchExtension = extensions.create('patches', PatchExtension)
43+
patchExtension.root = projectDir
4444

4545
task('findGit', type: FindGitTask)
4646
task('updateSubmodules', type: UpdateSubmodulesTask, dependsOn: 'findGit')
@@ -49,24 +49,24 @@ class GitPatcher implements Plugin<Project> {
4949

5050
afterEvaluate {
5151
// Configure the settings from our extension
52-
tasks.findGit.submodule = extension.submodule
52+
tasks.findGit.submodule = patchExtension.submodule
5353

5454
configure([tasks.applyPatches, tasks.makePatches]) {
55-
repo = extension.target
56-
root = extension.root
57-
submodule = extension.submodule
58-
patchDir = extension.patches
55+
repo = patchExtension.target
56+
root = patchExtension.root
57+
submodule = patchExtension.submodule
58+
patchDir = patchExtension.patches
5959
}
6060

6161
tasks.makePatches.with {
62-
formatPatchArgs = extension.formatPatchArgs
62+
formatPatchArgs = patchExtension.formatPatchArgs
6363
}
6464

6565
tasks.applyPatches.updateTask = tasks.updateSubmodules
6666

6767
tasks.updateSubmodules.with {
68-
repo = extension.root
69-
submodule = extension.submodule
68+
repo = patchExtension.root
69+
submodule = patchExtension.submodule
7070
}
7171
}
7272
}
@@ -76,8 +76,8 @@ class GitPatcher implements Plugin<Project> {
7676
return project
7777
}
7878

79-
PatchExtension getExtension() {
80-
return extension
79+
PatchExtension getPatchExtension() {
80+
return patchExtension
8181
}
8282

8383
}

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/FindGitTask.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ package org.cadixdev.gradle.gitpatcher.task
2424

2525
import org.cadixdev.gradle.gitpatcher.Git
2626
import org.gradle.api.DefaultTask
27+
import org.gradle.api.tasks.Internal
2728
import org.gradle.api.tasks.TaskAction
2829

2930
class FindGitTask extends DefaultTask {
3031

32+
@Internal
3133
String submodule
3234

3335
@TaskAction

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/GitTask.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
package org.cadixdev.gradle.gitpatcher.task
2424

2525
import org.gradle.api.DefaultTask
26+
import org.gradle.api.tasks.Internal
2627

2728
abstract class GitTask extends DefaultTask {
2829

30+
@Internal
2931
File repo
3032

3133
}

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/SubmoduleTask.groovy

+3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222

2323
package org.cadixdev.gradle.gitpatcher.task
2424

25+
import org.gradle.api.tasks.Internal
26+
2527
abstract class SubmoduleTask extends GitTask {
2628

29+
@Internal
2730
String submodule
2831

2932
{

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/UpdateSubmodulesTask.groovy

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222

2323
package org.cadixdev.gradle.gitpatcher.task
2424

25-
import static java.lang.System.out
26-
2725
import org.cadixdev.gradle.gitpatcher.Git
26+
import org.gradle.api.tasks.Internal
2827
import org.gradle.api.tasks.TaskAction
2928

29+
import static java.lang.System.out
30+
3031
class UpdateSubmodulesTask extends SubmoduleTask {
3132

3233
private String ref
@@ -46,6 +47,7 @@ class UpdateSubmodulesTask extends SubmoduleTask {
4647
git.submodule('update', '--init', '--recursive') >> out
4748
}
4849

50+
@Internal
4951
String getRef() {
5052
ref
5153
}

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/patch/ApplyPatchesTask.groovy

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@
2222

2323
package org.cadixdev.gradle.gitpatcher.task.patch
2424

25-
import static java.lang.System.out
26-
2725
import org.cadixdev.gradle.gitpatcher.Git
2826
import org.cadixdev.gradle.gitpatcher.task.UpdateSubmodulesTask
29-
import org.gradle.api.tasks.InputFiles
30-
import org.gradle.api.tasks.OutputDirectory
31-
import org.gradle.api.tasks.OutputFile
32-
import org.gradle.api.tasks.TaskAction
27+
import org.gradle.api.tasks.*
28+
29+
import static java.lang.System.out
3330

3431
class ApplyPatchesTask extends PatchTask {
3532

33+
@Internal
3634
UpdateSubmodulesTask updateTask
3735

3836
@Override @InputFiles

src/main/groovy/org/cadixdev/gradle/gitpatcher/task/patch/PatchTask.groovy

+8
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
package org.cadixdev.gradle.gitpatcher.task.patch
2424

2525
import org.cadixdev.gradle.gitpatcher.task.SubmoduleTask
26+
import org.gradle.api.tasks.Internal
2627

2728
abstract class PatchTask extends SubmoduleTask {
2829

30+
@Internal
2931
File root
3032

33+
@Internal
3134
File patchDir
3235

36+
@Internal
3337
protected File[] getPatches() {
3438
if (!patchDir.directory) {
3539
return []
@@ -38,10 +42,12 @@ abstract class PatchTask extends SubmoduleTask {
3842
return patchDir.listFiles({ dir, name -> name.endsWith('.patch') } as FilenameFilter).sort()
3943
}
4044

45+
@Internal
4146
File getSubmoduleRoot() {
4247
return new File(root, submodule)
4348
}
4449

50+
@Internal
4551
File getGitDir() {
4652
return new File(repo, '.git')
4753
}
@@ -66,11 +72,13 @@ abstract class PatchTask extends SubmoduleTask {
6672
}
6773
}
6874

75+
@Internal
6976
String getCachedRef() {
7077
readCache()
7178
return cachedRefs[0]
7279
}
7380

81+
@Internal
7482
String getCachedSubmoduleRef() {
7583
readCache()
7684
return cachedRefs[1]

0 commit comments

Comments
 (0)