-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no longer checks for build receipt resource, skips Install and Download #4
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
03200bd
maint: GroovyBootstrapMainStarter refactoring
keturn 1475fc5
feature: skip running Download & Install
keturn cafc197
update bundled groovy-wrapper.jar
keturn 015f8a2
update groovyw shell script from upstream
keturn 4777cf5
update groovyw batch file from upstream
keturn 66aba61
fix: README's capitalization of groovy test file
keturn d8e2f02
drop commons-io from bootstrap classpath.
keturn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
import org.gradle.cli.SystemPropertiesCommandLineConverter; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.util.HashMap; | ||
|
@@ -55,13 +54,23 @@ public static void main(String[] args) throws Exception { | |
|
||
addSystemProperties(gradleUserHome, rootDir); | ||
|
||
Logger logger = logger(options); | ||
WrapperConfiguration config = WrapperExecutor.forWrapperPropertiesFile(propertiesFile).getConfiguration(); | ||
PathAssembler.LocalDistribution localDist = new PathAssembler(gradleUserHome).getDistribution(config); | ||
File gradleHome = getAndVerifyDistributionRoot(localDist.getDistributionDir()); | ||
|
||
WrapperExecutor wrapperExecutor = WrapperExecutor.forWrapperPropertiesFile(propertiesFile); | ||
wrapperExecutor.execute( | ||
args, | ||
new Install(logger, new Download(logger, "gradlew", wrapperVersion()), new PathAssembler(gradleUserHome)), | ||
new GroovyBootstrapMainStarter()); | ||
new GroovyBootstrapMainStarter().start(args, gradleHome); | ||
} | ||
|
||
static File getAndVerifyDistributionRoot(File distDir) { | ||
// Extracted from org.gradle.wrapper.Install.getAndVerifyDistributionRoot | ||
Comment on lines
+64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and then if you keep that |
||
java.io.File[] dirs = distDir.listFiles(File::isDirectory); | ||
assert dirs != null: "directory does not exist: " + distDir; | ||
if (dirs.length != 1) { | ||
throw new RuntimeException(String.format("Gradle distribution '%s' contains %d directories. " + | ||
"Expected to find exactly 1 directory.", distDir, dirs.length)); | ||
} else { | ||
return dirs[0]; | ||
} | ||
} | ||
|
||
private static void addSystemProperties(File gradleHome, File rootDir) { | ||
|
@@ -90,36 +99,10 @@ private static File wrapperJar() { | |
return new File(location.getPath()); | ||
} | ||
|
||
static String wrapperVersion() { | ||
try { | ||
InputStream resourceAsStream = GradleWrapperMain.class.getResourceAsStream("/build-receipt.properties"); | ||
if (resourceAsStream == null) { | ||
throw new RuntimeException("No build receipt resource found."); | ||
} | ||
Properties buildReceipt = new Properties(); | ||
try { | ||
buildReceipt.load(resourceAsStream); | ||
String versionNumber = buildReceipt.getProperty("versionNumber"); | ||
if (versionNumber == null) { | ||
throw new RuntimeException("No version number specified in build receipt resource."); | ||
} | ||
return versionNumber; | ||
} finally { | ||
resourceAsStream.close(); | ||
} | ||
} catch (Exception e) { | ||
throw new RuntimeException("Could not determine wrapper version.", e); | ||
} | ||
} | ||
|
||
private static File gradleUserHome(ParsedCommandLine options) { | ||
if (options.hasOption(GRADLE_USER_HOME_OPTION)) { | ||
return new File(options.option(GRADLE_USER_HOME_OPTION).getValue()); | ||
} | ||
return GradleUserHomeLookup.gradleUserHome(); | ||
} | ||
|
||
private static Logger logger(ParsedCommandLine options) { | ||
return new Logger(options.hasOption(GRADLE_QUIET_OPTION)); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I axed all this
Install
andDownload
invocation, but if you want to keep the download-and-install functionality, you leave this in and just replace thatwrapperVersion()
with org.gradle.wrapper.Download.UNKNOWN_VERSION: https://github.com/gradle/gradle/blob/00862b8160a09051e8226736314afd16e7f418f7/subprojects/wrapper/src/main/java/org/gradle/wrapper/Download.java#L24aka
"0"