Compare commits
154 commits
Author | SHA1 | Date | |
---|---|---|---|
|
92909eca41 | ||
|
d2ab1a8399 | ||
|
004edc9419 | ||
|
ee5ed04e2d | ||
|
1a17ee9a4d | ||
|
1eef78c506 | ||
|
d469fca424 | ||
|
1342ce6795 | ||
|
f42ab782fb | ||
|
075239cf4c | ||
|
1e59f588f3 | ||
|
15c7cbe2ae | ||
|
67ddee43c0 | ||
|
f5c8396da0 | ||
|
ec21f6b8d9 | ||
|
c8e939f45b | ||
|
fcbe858fbd | ||
|
a2d1ccc0ce | ||
|
1a64fb2eb3 | ||
|
c31352f2ef | ||
|
7260681ddd | ||
|
7f9cc67604 | ||
|
17a695ad4b | ||
|
9e96d519ab | ||
|
537ea9a652 | ||
|
f83c47a82e | ||
|
9f79dac3c2 | ||
|
8d3324ecb8 | ||
|
f5666d769c | ||
|
754cfad122 | ||
|
a72efce7f5 | ||
|
b74072c553 | ||
|
6a327c2ccb | ||
|
734a33a5b5 | ||
|
58c34f9eba | ||
|
6bf9899b87 | ||
|
0781d4b424 | ||
|
198006568d | ||
|
baa37a506e | ||
|
6a5ceddfc0 | ||
|
4e8aec841e | ||
|
ea3a10b2ab | ||
|
ab53555b56 | ||
|
27f73ff007 | ||
|
56d622f9d9 | ||
|
4d686311ef | ||
|
45e6fbbcca | ||
|
b3ba713de9 | ||
|
fa031afa43 | ||
|
6b32e9dca7 | ||
|
30f6d5bd1b | ||
|
df7393c4b5 | ||
|
8b4bce9f93 | ||
|
1e7b0b56fe | ||
|
d640c77dde | ||
|
d83ec6ab8b | ||
|
f72b406a33 | ||
|
ac1019f247 | ||
|
3820e4c13d | ||
|
eb0f10f79b | ||
|
126cbea108 | ||
|
2ff61c134d | ||
|
c51e6b1a47 | ||
|
d548fb71d7 | ||
|
d2b0546dfb | ||
|
76e8394eda | ||
|
b3c61b2ac7 | ||
|
ca57783ec2 | ||
|
166b19e3a3 | ||
|
dd886a6d8e | ||
|
fec16abdb8 | ||
|
db34e6e535 | ||
|
d3127d801f | ||
|
fc8ceba7f5 | ||
|
456fce719e | ||
|
55f742cf34 | ||
|
dfabe5f7b9 | ||
|
420cb8013e | ||
|
b98577c20a | ||
|
0219641878 | ||
|
813f9a85da | ||
|
a8510843d7 | ||
|
7d09b4d2ca | ||
|
371cf0c09c | ||
|
456f24c086 | ||
|
cac5ecdf88 | ||
|
0c954afddf | ||
|
4dc812e292 | ||
|
4ef8c9dd2c | ||
|
66ca6bc759 | ||
|
97162da0f8 | ||
|
2125a3b57b | ||
|
1b16aae200 | ||
|
a565d6551a | ||
|
2abe9e5cbd | ||
|
e480e2c7eb | ||
|
54044a6f11 | ||
|
0e0208da7e | ||
|
3aaf741129 | ||
|
8728fd190c | ||
|
b5024925a0 | ||
|
b76212d1e8 | ||
|
2484b034ae | ||
|
36f105a220 | ||
|
1afb81590e | ||
|
6d4aa25f26 | ||
|
f57505e1e3 | ||
|
463119b1ac | ||
|
c676f8ac0c | ||
|
2860547770 | ||
|
68b8f18f84 | ||
|
6c9f338e17 | ||
|
9e4790db41 | ||
|
a4390e0cf0 | ||
|
0374f38e84 | ||
|
f2bd5576ba | ||
|
eb4259d41a | ||
|
38bc433b1e | ||
|
dac18d3bfe | ||
|
5f85487cc0 | ||
|
e71773deb3 | ||
|
113a84d057 | ||
|
ba0017b71b | ||
|
82bbc91fe9 | ||
|
235d3be83f | ||
|
b4461f984b | ||
|
62b50909e5 | ||
|
8d2839429d | ||
|
d190241cf6 | ||
|
028cd7889e | ||
|
42f66e6db1 | ||
|
d3690b4c79 | ||
|
ced34a050b | ||
|
98afa4ebba | ||
|
33626dd019 | ||
|
dee37d2dc0 | ||
|
a54f4db5d1 | ||
|
8103679fd7 | ||
|
355927ab75 | ||
|
f4abf43a02 | ||
|
e3cefe82f2 | ||
|
ad1c935f0c | ||
|
168ed96708 | ||
|
3c87deed6e | ||
|
838c2ab11f | ||
|
4557aa6eb3 | ||
|
79c0161a97 | ||
|
4a93d003d5 | ||
|
3ba831ee86 | ||
|
3740bcb672 | ||
|
4caa6153f9 | ||
|
ee6aa0c5eb | ||
|
6858c84823 | ||
|
7e9bcf1bbd |
37 changed files with 1414 additions and 404 deletions
|
@ -1,15 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!--
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
|
||||
Palantir Baseline Checkstyle configuration.
|
||||
Authors: Robert Fink, Brian Worth, Merrick Zoubeiri, and many other contributors. Based in part on http://checkstyle.sourceforge.net/google_style.html
|
||||
Please keep checks alphabetized with one exception: "relaxed" checks are grouped together at the bottom for easier disabling.
|
||||
Check-specific comments reference documents internal to Palantir and can be safely ignored or removed.
|
||||
-->
|
||||
|
||||
--><!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<property name="severity" value="error"/>
|
||||
|
@ -18,15 +12,6 @@
|
|||
<module name="NewlineAtEndOfFile"> <!-- Java Style Guide: Line ending: LF -->
|
||||
<property name="lineSeparator" value="lf"/>
|
||||
</module>
|
||||
<module name="RegexpHeader">
|
||||
<property name="header" value="^/\*$\n^ \* \(c\) Copyright \d{4} Palantir Technologies Inc\. All rights reserved\.$"/>
|
||||
<property name="fileExtensions" value=".java,.ts"/>
|
||||
</module>
|
||||
<module name="RegexpMultiline"> <!-- Development Practices: Writing good unit tests -->
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="format" value="@VisibleForTesting\s+(protected|public)"/>
|
||||
<property name="message" value="@VisibleForTesting members should be package-private."/>
|
||||
</module>
|
||||
<module name="RegexpSingleline"> <!-- No reference needed as this is evident. -->
|
||||
<property name="format" value="<<<<<<<"/>
|
||||
<property name="message" value="Found (<<<<<<<), so it looks like you had a merge conflict that compiles. Please fix it."/>
|
||||
|
@ -56,6 +41,10 @@
|
|||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||
</module>
|
||||
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
|
||||
<property name="max" value="120"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|\{@link"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="SuppressionCommentFilter"/> <!-- baseline-gradle: README.md -->
|
||||
<module name="SuppressionCommentFilter">
|
||||
|
@ -74,7 +63,9 @@
|
|||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="AnnotationUseStyle"/> <!-- Java Style Guide: Annotations -->
|
||||
<module name="AnnotationUseStyle"> <!-- Java Style Guide: Annotations -->
|
||||
<property name="trailingArrayComma" value="ignore"/>
|
||||
</module>
|
||||
<module name="ArrayTypeStyle"/> <!-- Java Style Guide: No C-style array declarations -->
|
||||
<module name="AvoidEscapedUnicodeCharacters"> <!-- Java Style Guide: Non-ASCII characters -->
|
||||
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||
|
@ -86,14 +77,7 @@
|
|||
</module>
|
||||
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
|
||||
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
|
||||
<property name="excludes" value="
|
||||
com.google.common.base.Preconditions.*,
|
||||
com.palantir.logsafe.Preconditions.*,
|
||||
java.util.Collections.*,
|
||||
java.util.stream.Collectors.*,
|
||||
org.apache.commons.lang3.Validate.*,
|
||||
org.assertj.core.api.Assertions.*,
|
||||
org.mockito.Mockito.*"/>
|
||||
<property name="excludes" value="com.google.common.base.Preconditions.*, com.palantir.logsafe.Preconditions.*, java.util.Collections.*, java.util.stream.Collectors.*, org.apache.commons.lang3.Validate.*, org.assertj.core.api.Assertions.*, org.mockito.Mockito.*"/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName"> <!-- Java Style Guide: Type variable names -->
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
|
@ -143,12 +127,12 @@
|
|||
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
|
||||
<property name="id" value="BanShadedClasses"/>
|
||||
<property name="illegalPkgs" value=".*\.(repackaged|shaded|thirdparty)"/>
|
||||
<property name="regexp" value="true" />
|
||||
<property name="regexp" value="true"/>
|
||||
<message key="import.illegal" value="Must not import repackaged classes."/>
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
<property name="illegalPkgs" value="^org\.gradle\.(internal|.*\.internal)"/>
|
||||
<property name="regexp" value="true" />
|
||||
<property name="regexp" value="true"/>
|
||||
<message key="import.illegal" value="Do not rely on gradle internal classes as these may change in minor releases - use org.gradle.api versions instead."/>
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
|
@ -201,12 +185,9 @@
|
|||
<property name="separated" value="true"/>
|
||||
<property name="sortStaticImportsAlphabetically" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="InnerAssignment"/> <!-- Java Coding Guidelines: Inner assignments: Not used -->
|
||||
<module name="LeftCurly"/> <!-- Java Style Guide: Nonempty blocks: K & R style -->
|
||||
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
|
||||
<property name="max" value="120"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<!-- Java Style Guide: Nonempty blocks: K & R style -->
|
||||
<module name="MemberName"> <!-- Java Style Guide: Non-constant field names -->
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
|
||||
<message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
|
@ -247,7 +228,7 @@
|
|||
<message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterAssignment"/> <!-- Java Coding Guidelines: Final variables and parameters -->
|
||||
<module name="ParenPad"/> <!-- Java Style Guide: Horizontal whitespace -->
|
||||
<!-- Java Style Guide: Horizontal whitespace -->
|
||||
<module name="RedundantImport"/> <!-- Java Style Guide: No unused imports -->
|
||||
<module name="RedundantModifier"/> <!-- Java Coding Guidelines: Avoid redundant modifiers -->
|
||||
<module name="RegexpSinglelineJava"> <!-- Java Coding Guidelines: Use appropriate assertion methods -->
|
||||
|
@ -363,7 +344,7 @@
|
|||
</module>
|
||||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="\bCharset.defaultCharset\("/>
|
||||
<property name="message" value="Use explicit charset (e.g. StandardCharsets.UTF-8) instead of default."/>
|
||||
<property name="message" value="Use explicit charset (e.g. StandardCharsets.UTF_8) instead of default."/>
|
||||
</module>
|
||||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="\bIOUtils\.toString\("/>
|
||||
|
@ -372,6 +353,7 @@
|
|||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="\/\/TODO|\/\/ TODO(?!\([^()\s]+\): )"/>
|
||||
<property name="message" value="TODO format: // TODO(#issue): explanation"/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
</module>
|
||||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="(void setUp\(\))|(void setup\(\))|(void setupStatic\(\))|(void setUpStatic\(\))|(void beforeTest\(\))|(void teardown\(\))|(void tearDown\(\))|(void beforeStatic\(\))|(void afterStatic\(\))"/>
|
||||
|
@ -379,11 +361,11 @@
|
|||
</module>
|
||||
<module name="RightCurly"> <!-- Java Style Guide: Nonempty blocks: K & R style -->
|
||||
<property name="option" value="same"/>
|
||||
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
|
||||
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly"> <!-- Java Style Guide: Nonempty blocks: K & R style -->
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
|
||||
<property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap"> <!-- Java Style Guide: Where to break -->
|
||||
<property name="tokens" value="DOT"/>
|
||||
|
@ -401,28 +383,18 @@
|
|||
<module name="SuppressWarnings">
|
||||
<property name="format" value="serial"/>
|
||||
</module>
|
||||
<module name="SuppressWarningsHolder" /> <!-- Required for SuppressWarningsFilter -->
|
||||
<module name="SuppressWarningsHolder"/> <!-- Required for SuppressWarningsFilter -->
|
||||
<module name="TypeName"> <!-- Java Style Guide: Class names -->
|
||||
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="TypecastParenPad"/> <!-- Java Style Guide: Horizontal whitespace -->
|
||||
<module name="UnnecessaryParentheses"/>
|
||||
<module name="UnusedImports"> <!-- Java Style Guide: No unused imports -->
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="UpperEll"/> <!-- Java Style Guide: Numeric Literals -->
|
||||
<module name="VisibilityModifier"/> <!-- Java Coding Guidelines: Minimize mutability -->
|
||||
<module name="WhitespaceAfter"/> <!-- Java Style Guide: Horizontal whitespace -->
|
||||
<module name="WhitespaceAround"> <!-- Java Style Guide: Horizontal whitespace -->
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<property name="allowEmptyLambdas" value="true"/>
|
||||
<property name="ignoreEnhancedForColon" value="false"/>
|
||||
<message key="ws.notFollowed" value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||
<message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
|
||||
|
||||
<!-- Stricter checks begin: delete some or all of the following for faster prototyping, but please restore before pushing to production. -->
|
||||
|
||||
|
@ -430,18 +402,17 @@
|
|||
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="CyclomaticComplexity"/> <!-- Java Coding Guidelines: Reduce Cyclomatic Complexity -->
|
||||
<module name="CyclomaticComplexity"> <!-- Java Coding Guidelines: Reduce Cyclomatic Complexity -->
|
||||
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
|
||||
</module>
|
||||
<module name="DesignForExtension"> <!-- Java Coding Guidelines: Design for extension -->
|
||||
<property name="ignoredAnnotations" value="ParameterizedTest, Test, Before, BeforeEach, After, AfterEach, BeforeClass, BeforeAll, AfterClass, AfterAll"/>
|
||||
</module>
|
||||
<module name="JavadocMethod"> <!-- Java Style Guide: Where Javadoc is used -->
|
||||
<property name="scope" value="public"/>
|
||||
<property name="accessModifiers" value="public"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingThrowsTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="minLineCount" value="99999999"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
</module>
|
||||
<module name="JavadocStyle"/> <!-- Java Style Guide: Javadoc -->
|
||||
<module name="JavadocTagContinuationIndentation"> <!-- Java Style Guide: At-clauses -->
|
||||
|
@ -474,4 +445,4 @@
|
|||
|
||||
<!-- Stricter checks end -->
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
|
@ -8,9 +8,9 @@ org.eclipse.jdt.ui.ignorelowercasenames=true
|
|||
org.eclipse.jdt.ui.importorder=;
|
||||
org.eclipse.jdt.ui.javadoc=false
|
||||
org.eclipse.jdt.ui.keywordthis=false
|
||||
org.eclipse.jdt.ui.ondemandthreshold=99
|
||||
org.eclipse.jdt.ui.ondemandthreshold=999
|
||||
org.eclipse.jdt.ui.overrideannotation=true
|
||||
org.eclipse.jdt.ui.staticondemandthreshold=99
|
||||
org.eclipse.jdt.ui.staticondemandthreshold=999
|
||||
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment"/><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*\n * (c) Copyright ${year} Palantir Technologies Inc. All rights reserved.\n */\n\n${package_declaration}\n\n/**\n * \n */\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">throw new RuntimeException(${exception_var});</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
|
@ -30,9 +30,10 @@
|
|||
<package name="" static="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
|
||||
<GroovyCodeStyleSettings>
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value />
|
||||
</option>
|
||||
|
@ -43,6 +44,21 @@
|
|||
<package name="" withSubpackages="true" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
<!-- Should be a superset of https://github.com/google/error-prone/blob/c481b3f9c2da112db36ccfcbf64e755261a127ab/core/src/main/java/com/google/errorprone/bugpatterns/BadImport.java#L63 -->
|
||||
<DO_NOT_IMPORT_INNER>
|
||||
<CLASS name="Builder" />
|
||||
<CLASS name="BuilderFactory" />
|
||||
<CLASS name="Callback" />
|
||||
<CLASS name="Class" />
|
||||
<CLASS name="Entry" />
|
||||
<CLASS name="Enum" />
|
||||
<CLASS name="Factory" />
|
||||
<CLASS name="Type" />
|
||||
<CLASS name="Key" />
|
||||
<CLASS name="Id" />
|
||||
<CLASS name="Identifier" />
|
||||
<CLASS name="Provider" />
|
||||
</DO_NOT_IMPORT_INNER>
|
||||
</GroovyCodeStyleSettings>
|
||||
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
|
||||
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
|
||||
|
@ -55,7 +71,7 @@
|
|||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="OPTIMIZE_IMPORTS_ON_THE_FLY" value="true" />
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
version: 1
|
||||
merge:
|
||||
whitelist:
|
||||
trigger:
|
||||
labels: ["merge when ready"]
|
||||
blacklist:
|
||||
ignore:
|
||||
labels: ["do not merge"]
|
||||
method: squash
|
||||
options:
|
||||
|
@ -13,5 +13,5 @@ merge:
|
|||
message_delimiter: ==COMMIT_MSG==
|
||||
delete_after_merge: true
|
||||
update:
|
||||
whitelist:
|
||||
trigger:
|
||||
labels: ["update me"]
|
||||
|
|
|
@ -1,74 +1,148 @@
|
|||
version: 2
|
||||
# This file was generated by the excavator check 'excavator/manage-circleci' as specified in .circleci/template.sh.
|
||||
# To request a modification to the general template, file an issue on Excavator.
|
||||
# To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file.
|
||||
|
||||
version: 2.1
|
||||
jobs:
|
||||
compile:
|
||||
docker: [{ image: 'circleci/openjdk:8-node' }]
|
||||
resource_class: medium+
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- run: ./gradlew --profile --parallel --stacktrace resolveConfigurations
|
||||
- save_cache:
|
||||
key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
|
||||
paths: [ ~/.gradle/wrapper ]
|
||||
- save_cache:
|
||||
key: 'gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
|
||||
paths: [ ~/.gradle/caches ]
|
||||
- run: ./gradlew --profile --parallel --stacktrace classes testClasses
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: [ . ]
|
||||
|
||||
check:
|
||||
docker: [{ image: 'circleci/openjdk:8-node' }]
|
||||
resource_class: medium+
|
||||
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
|
||||
resource_class: large
|
||||
environment:
|
||||
CIRCLE_TEST_REPORTS: /home/circleci/junit
|
||||
CIRCLE_ARTIFACTS: /home/circleci/artifacts
|
||||
GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
|
||||
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
|
||||
steps:
|
||||
- attach_workspace: { at: . }
|
||||
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- restore_cache: { key: 'graal-cache' }
|
||||
- run: sudo apt-get update && sudo apt-get install build-essential zlib1g-dev
|
||||
- run: ./gradlew --profile --parallel --stacktrace --continue check
|
||||
- checkout
|
||||
- run:
|
||||
name: delete_unrelated_tags
|
||||
command: |
|
||||
ALL_TAGS=$(git tag --points-at HEAD)
|
||||
|
||||
if [ -z "$ALL_TAGS" ]; then
|
||||
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${CIRCLE_TAG:+x}" ]; then
|
||||
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
|
||||
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
|
||||
if [ -z "$TAGS_TO_DELETE" ]; then
|
||||
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
|
||||
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
|
||||
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- run:
|
||||
name: check-setup
|
||||
command: |
|
||||
if [ -x .circleci/check-setup.sh ]; then
|
||||
echo "Running check-setup" && .circleci/check-setup.sh && echo "check-setup complete"
|
||||
fi
|
||||
- run: ./gradlew --parallel --stacktrace --continue --max-workers=2 check -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
|
||||
- persist_to_workspace:
|
||||
root: /home/circleci
|
||||
paths: [ project ]
|
||||
- save_cache:
|
||||
key: 'graal-cache'
|
||||
paths: [ ~/.gradle/caches/com.palantir.graal ]
|
||||
- store_test_results: { path: build/test-results }
|
||||
- store_artifacts: { path: build/reports/tests }
|
||||
key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
|
||||
paths: [ ~/.gradle/wrapper ]
|
||||
- save_cache:
|
||||
key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
|
||||
paths: [ ~/.gradle/caches ]
|
||||
- run:
|
||||
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
|
||||
when: always
|
||||
- store_test_results: { path: ~/junit }
|
||||
- store_artifacts: { path: ~/artifacts }
|
||||
|
||||
trial-publish:
|
||||
docker: [{ image: 'circleci/openjdk:8-node' }]
|
||||
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
|
||||
resource_class: medium
|
||||
environment:
|
||||
CIRCLE_TEST_REPORTS: /home/circleci/junit
|
||||
CIRCLE_ARTIFACTS: /home/circleci/artifacts
|
||||
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
|
||||
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
|
||||
steps:
|
||||
- attach_workspace: { at: . }
|
||||
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- run: ./gradlew --profile --stacktrace publishToMavenLocal
|
||||
- checkout
|
||||
- run:
|
||||
name: delete_unrelated_tags
|
||||
command: |
|
||||
ALL_TAGS=$(git tag --points-at HEAD)
|
||||
|
||||
if [ -z "$ALL_TAGS" ]; then
|
||||
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${CIRCLE_TAG:+x}" ]; then
|
||||
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
|
||||
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
|
||||
if [ -z "$TAGS_TO_DELETE" ]; then
|
||||
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
|
||||
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
|
||||
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- run: ./gradlew --stacktrace publishToMavenLocal -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
|
||||
- run:
|
||||
command: git status --porcelain
|
||||
when: always
|
||||
- save_cache:
|
||||
key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
|
||||
paths: [ ~/.gradle/caches ]
|
||||
- store_test_results: { path: ~/junit }
|
||||
- store_artifacts: { path: ~/artifacts }
|
||||
|
||||
publish:
|
||||
docker: [{ image: 'circleci/openjdk:8-node' }]
|
||||
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
|
||||
resource_class: medium
|
||||
environment:
|
||||
CIRCLE_TEST_REPORTS: /home/circleci/junit
|
||||
CIRCLE_ARTIFACTS: /home/circleci/artifacts
|
||||
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
|
||||
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
|
||||
steps:
|
||||
- attach_workspace: { at: . }
|
||||
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- attach_workspace: { at: /home/circleci }
|
||||
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
|
||||
- restore_cache: { key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
|
||||
- deploy:
|
||||
command: ./gradlew --profile --parallel --stacktrace --continue publish
|
||||
- deploy:
|
||||
command: ./gradlew --profile --parallel --stacktrace -Pgradle.publish.key=$GRADLE_KEY -Pgradle.publish.secret=$GRADLE_SECRET publishPlugins
|
||||
command: ./gradlew --parallel --stacktrace --continue publish -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
|
||||
- run:
|
||||
command: git status --porcelain
|
||||
when: always
|
||||
- save_cache:
|
||||
key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
|
||||
paths: [ ~/.gradle/caches ]
|
||||
- store_test_results: { path: ~/junit }
|
||||
- store_artifacts: { path: ~/artifacts }
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- compile:
|
||||
filters: { tags: { only: /.*/ } }
|
||||
|
||||
- check:
|
||||
requires: [ compile ]
|
||||
filters: { tags: { only: /.*/ } }
|
||||
|
||||
- trial-publish:
|
||||
requires: [ compile ]
|
||||
filters: { branches: { ignore: develop } }
|
||||
|
||||
- publish:
|
||||
requires: [ check ]
|
||||
requires: [ check, trial-publish ]
|
||||
filters: { tags: { only: /.*/ }, branches: { only: develop } }
|
||||
|
||||
|
|
3
.circleci/template.sh
Normal file
3
.circleci/template.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
export CIRCLECI_TEMPLATE=java-library-oss
|
||||
export JDK=11
|
|
@ -7,3 +7,4 @@ auto-label:
|
|||
tags:
|
||||
roomba: [ "merge when ready" ]
|
||||
automerge: [ "merge when ready" ]
|
||||
autorelease: [ "autorelease" ]
|
||||
|
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -2,8 +2,8 @@
|
|||
<!-- What's wrong with the current state of the world and why change it now? -->
|
||||
|
||||
## After this PR
|
||||
<!-- User-facing outcomes this PR delivers go below -->
|
||||
==COMMIT_MSG==
|
||||
<!-- User-facing outcomes this PR delivers -->
|
||||
==COMMIT_MSG==
|
||||
|
||||
## Possible downsides?
|
||||
|
|
31
.policy.yml
31
.policy.yml
|
@ -3,12 +3,11 @@
|
|||
policy:
|
||||
approval:
|
||||
- or:
|
||||
- infrastructure-notify has been notified
|
||||
- one admin has approved (PR contributors not allowed)
|
||||
- two admins have approved
|
||||
- changelog only and contributor approval
|
||||
- fixing excavator
|
||||
- excavator only touched baseline, circle, gradle files, godel files, docker-compose-rule config or versions.props
|
||||
- excavator only touched baseline, circle, gradle files, godel files, generated code, go dependencies, docker-compose-rule config or versions.props
|
||||
- excavator only touched config files
|
||||
- bots updated package.json and lock files
|
||||
disapproval:
|
||||
|
@ -16,15 +15,6 @@ policy:
|
|||
organizations: [ "palantir" ]
|
||||
|
||||
approval_rules:
|
||||
- name: infrastructure-notify has been notified
|
||||
options:
|
||||
allow_contributor: false
|
||||
request_review:
|
||||
enabled: true
|
||||
requires:
|
||||
count: 1
|
||||
teams: [ "palantir/infrastructure-notify" ]
|
||||
|
||||
- name: one admin has approved (PR contributors not allowed)
|
||||
options:
|
||||
allow_contributor: false
|
||||
|
@ -60,7 +50,7 @@ approval_rules:
|
|||
has_author_in:
|
||||
users: [ "svc-excavator-bot" ]
|
||||
|
||||
- name: excavator only touched baseline, circle, gradle files, godel files, docker-compose-rule config or versions.props
|
||||
- name: excavator only touched baseline, circle, gradle files, godel files, generated code, go dependencies, docker-compose-rule config or versions.props
|
||||
requires:
|
||||
count: 0
|
||||
if:
|
||||
|
@ -75,15 +65,24 @@ approval_rules:
|
|||
- "^\\.circleci/.*$"
|
||||
- "^\\.docker-compose-rule\\.yml$"
|
||||
- "^.*gradle$"
|
||||
- "^\\.palantir/go-version$"
|
||||
- "^gradle/wrapper/.*"
|
||||
- "^gradlew$"
|
||||
- "^gradlew.bat$"
|
||||
- "^gradle.properties$"
|
||||
- "^settings.gradle$"
|
||||
- "^godelw$"
|
||||
- "^godel/config/godel.properties$"
|
||||
- "^.*go.mod$"
|
||||
- "^.*go.sum$"
|
||||
- "^.*godelw$"
|
||||
- "^.*godel/config/godel.properties$"
|
||||
- "^.*godel/config/godel.yml$"
|
||||
- "^.*vendor/.*$"
|
||||
- "^versions.props$"
|
||||
- "^versions.lock$"
|
||||
- "^internal/generated/.*"
|
||||
- "^internal/generated_src/.*"
|
||||
has_valid_signatures_by_keys:
|
||||
key_ids: ["C9AF124A484882E0"]
|
||||
|
||||
- name: excavator only touched config files
|
||||
requires:
|
||||
|
@ -95,6 +94,8 @@ approval_rules:
|
|||
paths:
|
||||
- "^\\..*.yml$"
|
||||
- "^\\.github/.*$"
|
||||
has_valid_signatures_by_keys:
|
||||
key_ids: ["C9AF124A484882E0"]
|
||||
|
||||
- name: bots updated package.json and lock files
|
||||
requires:
|
||||
|
@ -108,3 +109,5 @@ approval_rules:
|
|||
paths:
|
||||
- "^.*yarn.lock$"
|
||||
- "^.*package.json$"
|
||||
has_valid_signatures_by_keys:
|
||||
key_ids: ["C9AF124A484882E0"]
|
||||
|
|
10
README.md
10
README.md
|
@ -23,14 +23,20 @@ Configuration
|
|||
Configure this plugin and its wrappers around GraalVM tools through the `graal` extension with the following options:
|
||||
|
||||
**General GraalVM controls**
|
||||
* `graalVersion`: the version string to use when downloading GraalVM (defaults to `19.2.0`)
|
||||
* `graalVersion`: the version string to use when downloading GraalVM (defaults to `20.2.0`)
|
||||
* `downloadBaseUrl`: the base download URL to use (defaults to `https://github.com/oracle/graal/releases/download/`)
|
||||
* `javaVersion`: the Java version to use (can be either `8` or `11`, defaults to `8`)
|
||||
* for `8`: Windows SDK 7.1 will be used (`C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd`)
|
||||
* for `11`: Visual Studio Build Tools will be used (`C:\Program Files (x86)\Microsoft Visual Studio\{version}\\{edition}\\VC\\Auxiliary\\Build\\vcvars64.bat`)
|
||||
* `windowsVsVersion`: the version of Visual Studio to use (can be either `2017` or `2019`, by default a search will be performed and the newest will be selected)
|
||||
* `windowsVsEdition`: the edition of Visual Studio to use (can be either `Community`, `Professional` or `Enterprise`, by default a search will be performed and the biggest will be selected)
|
||||
* `windowsVsVarsPath`: path to vcvars64.bat (optional, if it's set it will disable the 2 searches for `vsVersion` and `vsEdition`)
|
||||
|
||||
|
||||
**`native-image` controls**
|
||||
* `outputName`: the name to use for the image output
|
||||
* `mainClass`: the main class entry-point for the image to run
|
||||
* `option`: additional native-image options `https://github.com/oracle/graal/blob/master/substratevm/OPTIONS.md`
|
||||
* `option`: additional native-image options (see https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/Options.md)
|
||||
|
||||
Local GraalVM Tooling Cache
|
||||
---------------------------
|
||||
|
|
92
build.gradle
92
build.gradle
|
@ -13,67 +13,66 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import net.ltgt.gradle.errorprone.CheckSeverity
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://palantir.bintray.com/releases'}
|
||||
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
|
||||
gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.palantir.javaformat:gradle-palantir-java-format:1.0.0'
|
||||
classpath 'com.netflix.nebula:gradle-info-plugin:7.1.4'
|
||||
classpath 'com.gradle.publish:plugin-publish-plugin:0.11.0'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
|
||||
classpath 'com.netflix.nebula:nebula-publishing-plugin:17.2.1'
|
||||
classpath 'com.palantir.baseline:gradle-baseline-java:2.49.1'
|
||||
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.17.3'
|
||||
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.3'
|
||||
classpath 'gradle.plugin.org.inferred:gradle-processors:3.3.0'
|
||||
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.5.0'
|
||||
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.31.0'
|
||||
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.7.0'
|
||||
classpath 'com.gradle.publish:plugin-publish-plugin:1.1.0'
|
||||
classpath 'com.palantir.baseline:gradle-baseline-java:4.188.0'
|
||||
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.12.0'
|
||||
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.11.0'
|
||||
classpath 'com.palantir.gradle.gitversion:gradle-git-version:1.0.0'
|
||||
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.28.0'
|
||||
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://palantir.bintray.com/releases'}
|
||||
allprojects {
|
||||
apply plugin: 'com.palantir.jakarta-package-alignment'
|
||||
}
|
||||
|
||||
apply plugin: 'com.gradle.plugin-publish'
|
||||
apply plugin: 'com.palantir.baseline'
|
||||
apply plugin: 'com.palantir.git-version'
|
||||
apply plugin: 'com.palantir.consistent-versions'
|
||||
apply plugin: 'nebula.maven-publish'
|
||||
apply plugin: 'nebula.source-jar'
|
||||
apply plugin: 'org.inferred.processors'
|
||||
apply plugin: 'java-gradle-plugin'
|
||||
apply plugin: 'groovy'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
|
||||
apply plugin: 'com.palantir.baseline'
|
||||
apply plugin: 'com.palantir.baseline-java-versions'
|
||||
apply plugin: 'com.palantir.consistent-versions'
|
||||
apply plugin: 'com.palantir.external-publish-gradle-plugin'
|
||||
apply plugin: 'com.palantir.external-publish-jar'
|
||||
apply plugin: 'com.palantir.git-version'
|
||||
apply plugin: 'com.palantir.java-format'
|
||||
apply from: "${rootDir}/gradle/bintray-publish.gradle"
|
||||
apply plugin: 'com.palantir.jdks.latest'
|
||||
apply plugin: 'org.inferred.processors'
|
||||
|
||||
group 'com.palantir.graal'
|
||||
version gitVersion()
|
||||
|
||||
dependencies {
|
||||
compile localGroovy()
|
||||
compile gradleApi()
|
||||
repositories {
|
||||
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
|
||||
}
|
||||
|
||||
testCompile gradleTestKit()
|
||||
testCompile 'com.netflix.nebula:nebula-test'
|
||||
testCompile 'com.squareup.okhttp3:mockwebserver'
|
||||
dependencies {
|
||||
implementation localGroovy()
|
||||
implementation gradleApi()
|
||||
|
||||
testImplementation gradleTestKit()
|
||||
testImplementation 'com.netflix.nebula:nebula-test'
|
||||
testImplementation 'com.squareup.okhttp3:mockwebserver'
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
// do not add new task to publish to plugins.gradle.org
|
||||
automatedPublishing = false
|
||||
|
||||
plugins {
|
||||
graal {
|
||||
id = 'com.palantir.graal'
|
||||
displayName = 'Palantir Graal Plugin'
|
||||
implementationClass = 'com.palantir.gradle.graal.GradleGraalPlugin'
|
||||
}
|
||||
}
|
||||
|
@ -84,18 +83,19 @@ pluginBundle {
|
|||
vcsUrl = 'https://github.com/palantir/gradle-graal'
|
||||
description = 'A plugin for Gradle that adds tasks to download, extract and interact with GraalVM tooling.'
|
||||
tags = ['graal', 'native-image']
|
||||
}
|
||||
|
||||
plugins {
|
||||
graal {
|
||||
id = 'com.palantir.graal'
|
||||
displayName = 'Palantir Graal Plugin'
|
||||
}
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs += ['-Werror']
|
||||
options.errorprone {
|
||||
check("PreferSafeLogger", CheckSeverity.OFF)
|
||||
check("PreferSafeLoggingPreconditions", CheckSeverity.OFF)
|
||||
check("PreferSafeLoggableExceptions", CheckSeverity.OFF)
|
||||
check("Slf4jLogsafeArgs", CheckSeverity.OFF)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.errorprone.errorproneArgs += [
|
||||
'-Xep:PreferSafeLoggableExceptions:OFF',
|
||||
'-Xep:PreferSafeLoggingPreconditions:OFF',
|
||||
]
|
||||
javaVersions {
|
||||
libraryTarget = 11
|
||||
runtime = 17
|
||||
}
|
||||
|
|
5
changelog/0.12.0/pr-485.v2.yml
Normal file
5
changelog/0.12.0/pr-485.v2.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
type: improvement
|
||||
improvement:
|
||||
description: Publish to gradle plugin portal
|
||||
links:
|
||||
- https://github.com/palantir/gradle-graal/pull/485
|
6
changelog/0.6.1/pr-255.v2.yml
Normal file
6
changelog/0.6.1/pr-255.v2.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
type: feature
|
||||
feature:
|
||||
description: Add property javaVersion to support GraalVM 19.3+
|
||||
links:
|
||||
- https://github.com/palantir/dialogue/pull/255
|
||||
- https://github.com/palantir/dialogue/pull/239
|
7
changelog/0.7.1/pr-353.v2.yml
Normal file
7
changelog/0.7.1/pr-353.v2.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
type: fix
|
||||
fix:
|
||||
description: Fix gu on Windows and multi-module project path.
|
||||
links:
|
||||
- https://github.com/palantir/gradle-graal/pull/353
|
||||
- https://github.com/palantir/gradle-graal/issues/352
|
||||
- https://github.com/palantir/gradle-graal/issues/344
|
5
changelog/0.7.2/pr-396.v2.yml
Normal file
5
changelog/0.7.2/pr-396.v2.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
type: improvement
|
||||
improvement:
|
||||
description: Bump default graal version to 20.2.0
|
||||
links:
|
||||
- https://github.com/palantir/gradle-graal/pull/396
|
5
changelog/0.8.0/pr-432.v2.yml
Normal file
5
changelog/0.8.0/pr-432.v2.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
type: feature
|
||||
feature:
|
||||
description: Support Java 16 for GraalVM 21.1.0 and greater
|
||||
links:
|
||||
- https://github.com/palantir/gradle-graal/pull/432
|
0
changelog/@unreleased/.gitkeep
Normal file
0
changelog/@unreleased/.gitkeep
Normal file
|
@ -1,2 +1,8 @@
|
|||
org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
com.palantir.baseline-versions.disable = true
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
286
gradlew
vendored
286
gradlew
vendored
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -17,78 +17,113 @@
|
|||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
|
@ -105,84 +140,105 @@ location of your Java installation."
|
|||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
38
gradlew.bat
vendored
38
gradlew.bat
vendored
|
@ -14,7 +14,7 @@
|
|||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
|
@ -25,10 +25,14 @@
|
|||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
|
@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
@ -51,7 +55,7 @@ goto fail
|
|||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
|
@ -61,38 +65,26 @@ echo location of your Java installation.
|
|||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.file.RegularFile;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
|
@ -47,9 +48,13 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
private final ListProperty<String> options = getProject().getObjects().listProperty(String.class);
|
||||
private final RegularFileProperty outputFile = getProject().getObjects().fileProperty();
|
||||
private final Property<String> graalVersion = getProject().getObjects().property(String.class);
|
||||
private final Property<String> javaVersion = getProject().getObjects().property(String.class);
|
||||
private final Property<String> windowsVsVarsPath = getProject().getObjects().property(String.class);
|
||||
private final Property<Configuration> classpath = getProject().getObjects().property(Configuration.class);
|
||||
private final RegularFileProperty jarFile = getProject().getObjects().fileProperty();
|
||||
private final Property<Path> cacheDir = getProject().getObjects().property(Path.class);
|
||||
private final Property<String> graalDirectoryName =
|
||||
getProject().getObjects().property(String.class);
|
||||
|
||||
public BaseGraalCompileTask() {
|
||||
setGroup(GradleGraalPlugin.TASK_GROUP);
|
||||
|
@ -60,6 +65,7 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
.map(d -> d.file(outputName.get() + getArchitectureSpecifiedOutputExtension())));
|
||||
}
|
||||
|
||||
@Input
|
||||
protected abstract String getArchitectureSpecifiedOutputExtension();
|
||||
|
||||
protected final File maybeCreateOutputDirectory() throws IOException {
|
||||
|
@ -68,9 +74,10 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
return directory;
|
||||
}
|
||||
|
||||
@Input
|
||||
protected final String getExecutable() {
|
||||
return cacheDir.get()
|
||||
.resolve(Paths.get(graalVersion.get(), "graalvm-ce-" + graalVersion.get()))
|
||||
.resolve(Paths.get(graalVersion.get(), javaVersion.get(), graalDirectoryName.get()))
|
||||
.resolve(getArchitectureSpecifiedBinaryPath())
|
||||
.toFile()
|
||||
.getAbsolutePath();
|
||||
|
@ -146,9 +153,15 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
outputRedirection = " >nul 2>&1";
|
||||
}
|
||||
|
||||
String argsString = spec.getArgs().stream().collect(Collectors.joining(" ", " ", "\r\n"));
|
||||
if (windowsVsVarsPath.get().isEmpty()) {
|
||||
throw new GradleException("Couldn't find an installation of Windows SDK 7.1 suitable for GraalVM.");
|
||||
}
|
||||
|
||||
String argsString =
|
||||
spec.getArgs().stream().map(s -> "\"" + s + "\"").collect(Collectors.joining(" ", " ", "\r\n"));
|
||||
String command = "call \"" + windowsVsVarsPath.get() + "\"";
|
||||
String cmdContent = "@echo off\r\n"
|
||||
+ "call \"C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\SetEnv.cmd\""
|
||||
+ command
|
||||
+ outputRedirection + "\r\n"
|
||||
+ "\"" + spec.getExecutable() + "\"" + argsString;
|
||||
Path buildPath = getProject().getBuildDir().toPath();
|
||||
|
@ -197,6 +210,24 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
graalVersion.set(provider);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final Provider<String> getJavaVersion() {
|
||||
return javaVersion;
|
||||
}
|
||||
|
||||
public final void setJavaVersion(Provider<String> provider) {
|
||||
javaVersion.set(provider);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final Provider<String> getWindowsVsVarsPath() {
|
||||
return windowsVsVarsPath;
|
||||
}
|
||||
|
||||
public final void setWindowsVsVarsPath(Provider<String> provider) {
|
||||
windowsVsVarsPath.set(provider);
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
@Classpath
|
||||
public final Provider<Configuration> getClasspath() {
|
||||
|
@ -229,19 +260,16 @@ public abstract class BaseGraalCompileTask extends DefaultTask {
|
|||
cacheDir.set(value);
|
||||
}
|
||||
|
||||
final void setGraalDirectoryName(Provider<String> value) {
|
||||
graalDirectoryName.set(value);
|
||||
}
|
||||
|
||||
public final void setOptions(Provider<List<String>> options) {
|
||||
this.options.set(options);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final ListProperty<String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public final RegularFileProperty getJarFile() {
|
||||
return jarFile;
|
||||
}
|
||||
|
||||
public final Property<Path> getCacheDir() {
|
||||
return cacheDir;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,13 +35,14 @@ public class DownloadGraalTask extends DefaultTask {
|
|||
|
||||
// RC versions don't have a windows variant, so no [ext] is needed
|
||||
private static final String ARTIFACT_PATTERN_RC_VERSION =
|
||||
"[url]/vm-[version]/graalvm-ce-[version]-[os]-[arch].tar.gz";
|
||||
"[url]/vm-[version]/graalvm-ce-[javaVersion]-[version]-[os]-[arch].tar.gz";
|
||||
private static final String ARTIFACT_PATTERN_RELEASE_VERSION =
|
||||
"[url]/vm-[version]/graalvm-ce-[os]-[arch]-[version].[ext]";
|
||||
"[url]/vm-[version]/graalvm-ce-[javaVersion]-[os]-[arch]-[version].[ext]";
|
||||
|
||||
private static final String FILENAME_PATTERN = "graalvm-ce-[version]-[arch].[ext]";
|
||||
private static final String FILENAME_PATTERN = "graalvm-ce-[javaVersion]-[version]-[arch].[ext]";
|
||||
|
||||
private final Property<String> graalVersion = getProject().getObjects().property(String.class);
|
||||
private final Property<String> javaVersion = getProject().getObjects().property(String.class);
|
||||
private final Property<String> downloadBaseUrl = getProject().getObjects().property(String.class);
|
||||
private final Property<Path> cacheDir = getProject().getObjects().property(Path.class);
|
||||
|
||||
|
@ -49,13 +50,12 @@ public class DownloadGraalTask extends DefaultTask {
|
|||
setGroup(GradleGraalPlugin.TASK_GROUP);
|
||||
setDescription("Downloads and caches GraalVM binaries.");
|
||||
|
||||
onlyIf(task -> !getArchive().get().getAsFile().exists());
|
||||
onlyIf(_task -> !getArchive().get().getAsFile().exists());
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
public final void downloadGraal() throws IOException {
|
||||
Path cache = getCacheSubdirectory().get();
|
||||
Files.createDirectories(cache);
|
||||
Files.createDirectories(getArchive().get().getAsFile().toPath().getParent());
|
||||
|
||||
final String artifactPattern =
|
||||
isGraalRcVersion() ? ARTIFACT_PATTERN_RC_VERSION : ARTIFACT_PATTERN_RELEASE_VERSION;
|
||||
|
@ -67,7 +67,8 @@ public class DownloadGraalTask extends DefaultTask {
|
|||
|
||||
@OutputFile
|
||||
public final Provider<RegularFile> getArchive() {
|
||||
return getProject().getLayout().file(getCacheSubdirectory().map(dir -> dir.resolve(render(FILENAME_PATTERN))
|
||||
return getProject().getLayout().file(getCacheSubdirectory().map(dir -> dir.resolve(javaVersion.get())
|
||||
.resolve(render(FILENAME_PATTERN))
|
||||
.toFile()));
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,15 @@ public class DownloadGraalTask extends DefaultTask {
|
|||
graalVersion.set(provider);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final Provider<String> getJavaVersion() {
|
||||
return javaVersion;
|
||||
}
|
||||
|
||||
public final void setJavaVersion(Provider<String> provider) {
|
||||
javaVersion.set(provider);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final Provider<String> getDownloadBaseUrl() {
|
||||
return downloadBaseUrl;
|
||||
|
@ -94,11 +104,16 @@ public class DownloadGraalTask extends DefaultTask {
|
|||
}
|
||||
|
||||
private String render(String pattern) {
|
||||
final String computedJavaVersion = GraalVersionUtil.isGraalVersionGreaterOrEqualThan(graalVersion.get(), 19, 3)
|
||||
? "java" + javaVersion.get()
|
||||
: ""; // for GraalVM >= 19.3 the naming contains java8 or java11
|
||||
return pattern.replaceAll("\\[url\\]", downloadBaseUrl.get())
|
||||
.replaceAll("\\[version\\]", graalVersion.get())
|
||||
.replaceAll("\\[javaVersion\\]", computedJavaVersion)
|
||||
.replaceAll("\\[os\\]", getOperatingSystem())
|
||||
.replaceAll("\\[arch\\]", getArchitecture())
|
||||
.replaceAll("\\[ext\\]", getArchiveExtension());
|
||||
.replaceAll("\\[ext\\]", getArchiveExtension())
|
||||
.replaceAll("--", "-"); // for GraalVM < 19.3 there's only a Java8 package
|
||||
}
|
||||
|
||||
private String getOperatingSystem() {
|
||||
|
|
|
@ -41,25 +41,29 @@ public class ExtractGraalTask extends DefaultTask {
|
|||
* These binaries get .cmd as their filename extension, instead of .cmd (on Windows).
|
||||
*/
|
||||
private static final Set<String> WINDOWS_CMD_BINARIES =
|
||||
new HashSet<>(Arrays.asList("native-image", "native-image-configure", "polyglot"));
|
||||
new HashSet<>(Arrays.asList("native-image", "native-image-configure", "polyglot", "gu"));
|
||||
|
||||
private final RegularFileProperty inputArchive = getProject().getObjects().fileProperty();
|
||||
private final Property<String> graalVersion = getProject().getObjects().property(String.class);
|
||||
private final Property<String> javaVersion = getProject().getObjects().property(String.class);
|
||||
private final DirectoryProperty outputDirectory = getProject().getObjects().directoryProperty();
|
||||
private final Property<Path> cacheDir = getProject().getObjects().property(Path.class);
|
||||
private final Property<String> graalDirectoryName =
|
||||
getProject().getObjects().property(String.class);
|
||||
|
||||
public ExtractGraalTask() {
|
||||
setGroup(GradleGraalPlugin.TASK_GROUP);
|
||||
setDescription("Extracts GraalVM tooling from downloaded archive using the system's tar command or Gradle's"
|
||||
+ " copy method.");
|
||||
|
||||
onlyIf(task -> !getOutputDirectory().get().getAsFile().exists());
|
||||
outputDirectory.set(graalVersion.map(v -> getProject()
|
||||
onlyIf(_task -> !getOutputDirectory().get().getAsFile().exists());
|
||||
outputDirectory.set(cacheDir.map(_cd -> getProject()
|
||||
.getLayout()
|
||||
.getProjectDirectory()
|
||||
.dir(cacheDir.get().toFile().getAbsolutePath())
|
||||
.dir(v)
|
||||
.dir("graalvm-ce-" + v)));
|
||||
.dir(graalVersion.get())
|
||||
.dir(javaVersion.get())
|
||||
.dir(graalDirectoryName.get())));
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
|
@ -70,7 +74,7 @@ public class ExtractGraalTask extends DefaultTask {
|
|||
|
||||
Project project = getProject();
|
||||
File inputArchiveFile = inputArchive.get().getAsFile();
|
||||
Path versionedCacheDir = cacheDir.get().resolve(graalVersion.get());
|
||||
Path versionedCacheDir = cacheDir.get().resolve(Paths.get(graalVersion.get(), javaVersion.get()));
|
||||
|
||||
if (inputArchiveFile.getName().endsWith(".zip")) {
|
||||
project.copy(copySpec -> {
|
||||
|
@ -113,7 +117,7 @@ public class ExtractGraalTask extends DefaultTask {
|
|||
}
|
||||
|
||||
return cacheDir.get()
|
||||
.resolve(Paths.get(graalVersion.get(), "graalvm-ce-" + graalVersion.get()))
|
||||
.resolve(Paths.get(graalVersion.get(), javaVersion.get(), graalDirectoryName.get()))
|
||||
.resolve(getArchitectureSpecifiedBinaryPath(binaryName + binaryExtension))
|
||||
.toFile();
|
||||
}
|
||||
|
@ -148,6 +152,15 @@ public class ExtractGraalTask extends DefaultTask {
|
|||
graalVersion.set(provider);
|
||||
}
|
||||
|
||||
@Input
|
||||
public final Provider<String> getJavaVersion() {
|
||||
return javaVersion;
|
||||
}
|
||||
|
||||
public final void setJavaVersion(Provider<String> provider) {
|
||||
javaVersion.set(provider);
|
||||
}
|
||||
|
||||
@OutputDirectory
|
||||
public final Provider<Directory> getOutputDirectory() {
|
||||
return outputDirectory;
|
||||
|
@ -156,4 +169,8 @@ public class ExtractGraalTask extends DefaultTask {
|
|||
final void setCacheDir(Path value) {
|
||||
cacheDir.set(value);
|
||||
}
|
||||
|
||||
final void setGraalDirectoryName(Provider<String> value) {
|
||||
graalDirectoryName.set(value);
|
||||
}
|
||||
}
|
||||
|
|
44
src/main/java/com/palantir/gradle/graal/FileUtil.java
Normal file
44
src/main/java/com/palantir/gradle/graal/FileUtil.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.palantir.gradle.graal;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class FileUtil {
|
||||
public static String getFirstFromDirectory(File directory, List<String> searchList) {
|
||||
if (!directory.exists()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AbstractSet<String> subDirectoriesNames = new HashSet<String>();
|
||||
File[] subDirectories = directory.listFiles(File::isDirectory);
|
||||
for (File subDirectory : subDirectories) {
|
||||
subDirectoriesNames.add(subDirectory.getName());
|
||||
}
|
||||
for (String stringToSearch : searchList) {
|
||||
if (subDirectoriesNames.contains(stringToSearch)) {
|
||||
return stringToSearch;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private FileUtil() {}
|
||||
}
|
|
@ -16,35 +16,64 @@
|
|||
|
||||
package com.palantir.gradle.graal;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.provider.ListProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.provider.ProviderFactory;
|
||||
|
||||
/** Contains options and settings for tuning GraalVM use. */
|
||||
/**
|
||||
* Contains options and settings for tuning GraalVM use.
|
||||
*/
|
||||
public class GraalExtension {
|
||||
private static final String WINDOWS_7_ENV_PATH =
|
||||
"C:\\Program Files\\Microsoft SDKs\\" + "Windows\\v7.1\\Bin\\SetEnv.cmd";
|
||||
private static final List<String> SUPPORTED_WINDOWS_VS_VERSIONS = Arrays.asList("2019", "2017");
|
||||
private static final List<String> SUPPORTED_WINDOWS_VS_EDITIONS =
|
||||
Arrays.asList("Enterprise", "Professional", "Community");
|
||||
private static final String DEFAULT_WINDOWS_VS_PATH = "C:\\Program Files (x86)\\" + "Microsoft Visual Studio";
|
||||
private static final String DEFAULT_WINDOWS_VS_VARS_PATH = "C:\\Program Files (x86)\\Microsoft Visual Studio\\"
|
||||
+ "{version}\\{edition}\\VC\\Auxiliary\\"
|
||||
+ "Build\\vcvars64.bat";
|
||||
|
||||
private static final String DEFAULT_DOWNLOAD_BASE_URL = "https://github.com/oracle/graal/releases/download/";
|
||||
private static final String DEFAULT_GRAAL_VERSION = "19.2.0";
|
||||
private static final String DOWNLOAD_BASE_URL_GRAAL_19_3 =
|
||||
"https://github.com/graalvm/graalvm-ce-builds/" + "releases/download/";
|
||||
private static final String DEFAULT_GRAAL_VERSION = "20.2.0";
|
||||
private static final List<String> SUPPORTED_JAVA_VERSIONS = Arrays.asList("17", "16", "11", "8");
|
||||
private static final String DEFAULT_JAVA_VERSION = "8";
|
||||
|
||||
private final Property<String> downloadBaseUrl;
|
||||
private final Property<String> graalVersion;
|
||||
private final Property<String> javaVersion;
|
||||
private final Property<String> windowsVsVarsPath;
|
||||
private final Property<String> windowsVsVersion;
|
||||
private final Property<String> windowsVsEdition;
|
||||
private final Property<String> mainClass;
|
||||
private final Property<String> outputName;
|
||||
private final ListProperty<String> options;
|
||||
|
||||
private ProviderFactory providerFactory;
|
||||
|
||||
public GraalExtension(Project project) {
|
||||
downloadBaseUrl = project.getObjects().property(String.class);
|
||||
graalVersion = project.getObjects().property(String.class);
|
||||
javaVersion = project.getObjects().property(String.class);
|
||||
windowsVsVarsPath = project.getObjects().property(String.class);
|
||||
windowsVsVersion = project.getObjects().property(String.class);
|
||||
windowsVsEdition = project.getObjects().property(String.class);
|
||||
mainClass = project.getObjects().property(String.class);
|
||||
outputName = project.getObjects().property(String.class);
|
||||
options = project.getObjects().listProperty(String.class).empty(); // .empty() required to initialize
|
||||
providerFactory = project.getProviders();
|
||||
|
||||
// defaults
|
||||
downloadBaseUrl.set(DEFAULT_DOWNLOAD_BASE_URL);
|
||||
graalVersion.set(DEFAULT_GRAAL_VERSION);
|
||||
javaVersion.set(DEFAULT_JAVA_VERSION);
|
||||
}
|
||||
|
||||
public final void downloadBaseUrl(String value) {
|
||||
|
@ -54,17 +83,20 @@ public class GraalExtension {
|
|||
/**
|
||||
* Returns the base URL to use for downloading GraalVM binaries.
|
||||
*
|
||||
* <p>Defaults to {@link #DEFAULT_DOWNLOAD_BASE_URL}.</p>
|
||||
* <p>Defaults to {@link #DEFAULT_DOWNLOAD_BASE_URL} for GraalVM lower than 19.3.</p>
|
||||
* <p>Defaults to {@link #DOWNLOAD_BASE_URL_GRAAL_19_3} for GraalVM higher or equal to 19.3.</p>
|
||||
*/
|
||||
public final Provider<String> getDownloadBaseUrl() {
|
||||
return downloadBaseUrl;
|
||||
return downloadBaseUrl.orElse(getDefaultDownloadBaseUrl());
|
||||
}
|
||||
|
||||
public final void mainClass(String value) {
|
||||
mainClass.set(value);
|
||||
}
|
||||
|
||||
/** Returns the main class to use as the entry point to the generated executable file. */
|
||||
/**
|
||||
* Returns the main class to use as the entry point to the generated executable file.
|
||||
*/
|
||||
public final Provider<String> getMainClass() {
|
||||
return mainClass;
|
||||
}
|
||||
|
@ -86,6 +118,78 @@ public class GraalExtension {
|
|||
graalVersion.set(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the javaVersion for GraalVM to use.
|
||||
*
|
||||
* <p>Defaults to {@link #DEFAULT_JAVA_VERSION}</p>
|
||||
*/
|
||||
public final Provider<String> getJavaVersion() {
|
||||
return javaVersion;
|
||||
}
|
||||
|
||||
public final void javaVersion(String value) {
|
||||
if (!SUPPORTED_JAVA_VERSIONS.contains(value)) {
|
||||
throw new GradleException(
|
||||
"Java version " + value + " is not supported. Supported versions are: " + SUPPORTED_JAVA_VERSIONS);
|
||||
}
|
||||
javaVersion.set(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the VS 64-bit Variables Path to use.
|
||||
*
|
||||
* <p>Defaults to {@link #DEFAULT_WINDOWS_VS_VARS_PATH} for JDK higher or equal to 11</p>
|
||||
* <p>Defaults to {@link #WINDOWS_7_ENV_PATH} for JDK lower than 11</p>
|
||||
*/
|
||||
public final Provider<String> getWindowsVsVarsPath() {
|
||||
return windowsVsVarsPath.orElse(searchWindowsVsVarsPath());
|
||||
}
|
||||
|
||||
private String searchWindowsVsVarsPath() {
|
||||
String searchedVsVersion = windowsVsVersion.getOrElse(getNewestWindowsVsVersionInstalled());
|
||||
String searchedVsEdition = windowsVsEdition.getOrElse(getBiggestWindowsVsEditionInstalled(searchedVsVersion));
|
||||
if (searchedVsEdition == null || searchedVsVersion == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String searchedVsVarsPath = Integer.parseInt(javaVersion.get()) >= 11
|
||||
? DEFAULT_WINDOWS_VS_VARS_PATH
|
||||
.replaceAll("\\{version}", searchedVsVersion)
|
||||
.replaceAll("\\{edition}", searchedVsEdition)
|
||||
: WINDOWS_7_ENV_PATH;
|
||||
if (WINDOWS_7_ENV_PATH.equals(searchedVsVarsPath)) {
|
||||
if (!new File(WINDOWS_7_ENV_PATH).exists()) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return searchedVsVarsPath;
|
||||
}
|
||||
|
||||
private String getNewestWindowsVsVersionInstalled() {
|
||||
return FileUtil.getFirstFromDirectory(new File(DEFAULT_WINDOWS_VS_PATH), SUPPORTED_WINDOWS_VS_VERSIONS);
|
||||
}
|
||||
|
||||
private String getBiggestWindowsVsEditionInstalled(String version) {
|
||||
if (version == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return FileUtil.getFirstFromDirectory(
|
||||
new File(DEFAULT_WINDOWS_VS_PATH, version), SUPPORTED_WINDOWS_VS_EDITIONS);
|
||||
}
|
||||
|
||||
public final void windowsVsVarsPath(String value) {
|
||||
windowsVsVarsPath.set(value);
|
||||
}
|
||||
|
||||
public final void windowsVsVersion(String value) {
|
||||
windowsVsVersion.set(value);
|
||||
}
|
||||
|
||||
public final void windowsVsEdition(String value) {
|
||||
windowsVsEdition.set(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the graalVersion of GraalVM to use.
|
||||
*
|
||||
|
@ -96,7 +200,7 @@ public class GraalExtension {
|
|||
}
|
||||
|
||||
public final Provider<List<String>> getOptions() {
|
||||
return this.options;
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,4 +212,30 @@ public class GraalExtension {
|
|||
}
|
||||
this.options.add(option);
|
||||
}
|
||||
|
||||
public final Provider<String> getGraalDirectoryName() {
|
||||
return providerFactory.provider(() -> {
|
||||
if (GraalVersionUtil.isGraalVersionGreaterOrEqualThan(graalVersion.get(), 19, 3)) {
|
||||
return "graalvm-ce-java" + javaVersion.get() + "-" + graalVersion.get();
|
||||
}
|
||||
return "graalvm-ce-" + graalVersion.get();
|
||||
});
|
||||
}
|
||||
|
||||
private String getDefaultDownloadBaseUrl() {
|
||||
if (javaVersion.get().equals("17")
|
||||
&& !GraalVersionUtil.isGraalVersionGreaterOrEqualThan(graalVersion.get(), 21, 3)) {
|
||||
throw new GradleException(
|
||||
"Unsupported GraalVM version " + graalVersion.get() + " for Java 17, needs >= 21.3.0.");
|
||||
} else if (javaVersion.get().equals("16")
|
||||
&& !GraalVersionUtil.isGraalVersionGreaterOrEqualThan(graalVersion.get(), 21, 1)) {
|
||||
throw new GradleException(
|
||||
"Unsupported GraalVM version " + graalVersion.get() + " for Java 16, needs >= 21.1.0.");
|
||||
} else if (GraalVersionUtil.isGraalVersionGreaterOrEqualThan(graalVersion.get(), 19, 3)) {
|
||||
return DOWNLOAD_BASE_URL_GRAAL_19_3;
|
||||
} else if (!javaVersion.get().equals("8")) {
|
||||
throw new GradleException("Unsupported Java version for GraalVM version.");
|
||||
}
|
||||
return DEFAULT_DOWNLOAD_BASE_URL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.palantir.gradle.graal;
|
||||
|
||||
public final class GraalVersionUtil {
|
||||
public static boolean isGraalVersionGreaterOrEqualThan(String graalVersion, int majorVersion, int minorVersion) {
|
||||
try {
|
||||
final String[] versionSplit = graalVersion.split("\\.", -1);
|
||||
final int majorVersion0 = Integer.valueOf(versionSplit[0]);
|
||||
final int minorVersion0 = Integer.valueOf(versionSplit[1]);
|
||||
return majorVersion0 > majorVersion || (majorVersion0 == majorVersion && minorVersion0 >= minorVersion);
|
||||
} catch (NumberFormatException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private GraalVersionUtil() {}
|
||||
}
|
|
@ -62,6 +62,7 @@ public class GradleGraalPlugin implements Plugin<Project> {
|
|||
TaskProvider<DownloadGraalTask> downloadGraal = project.getTasks()
|
||||
.register("downloadGraalTooling", DownloadGraalTask.class, task -> {
|
||||
task.setGraalVersion(extension.getGraalVersion());
|
||||
task.setJavaVersion(extension.getJavaVersion());
|
||||
task.setDownloadBaseUrl(extension.getDownloadBaseUrl());
|
||||
task.setCacheDir(cacheDir);
|
||||
});
|
||||
|
@ -69,8 +70,10 @@ public class GradleGraalPlugin implements Plugin<Project> {
|
|||
TaskProvider<ExtractGraalTask> extractGraal = project.getTasks()
|
||||
.register("extractGraalTooling", ExtractGraalTask.class, task -> {
|
||||
task.setGraalVersion(extension.getGraalVersion());
|
||||
task.setJavaVersion(extension.getJavaVersion());
|
||||
task.setInputArchive(downloadGraal.get().getArchive());
|
||||
task.setCacheDir(cacheDir);
|
||||
task.setGraalDirectoryName(extension.getGraalDirectoryName());
|
||||
task.dependsOn(downloadGraal);
|
||||
});
|
||||
|
||||
|
@ -79,9 +82,12 @@ public class GradleGraalPlugin implements Plugin<Project> {
|
|||
task.setMainClass(extension.getMainClass());
|
||||
task.setOutputName(extension.getOutputName());
|
||||
task.setGraalVersion(extension.getGraalVersion());
|
||||
task.setJavaVersion(extension.getJavaVersion());
|
||||
task.setWindowsVsVarsPath(extension.getWindowsVsVarsPath());
|
||||
task.setJarFile(jar.map(j -> j.getOutputs().getFiles().getSingleFile()));
|
||||
task.setClasspath(project.getConfigurations().named("runtimeClasspath"));
|
||||
task.setCacheDir(cacheDir);
|
||||
task.setGraalDirectoryName(extension.getGraalDirectoryName());
|
||||
task.setOptions(extension.getOptions());
|
||||
task.dependsOn(extractGraal);
|
||||
task.dependsOn(jar);
|
||||
|
@ -91,9 +97,12 @@ public class GradleGraalPlugin implements Plugin<Project> {
|
|||
project.getTasks().register("sharedLibrary", SharedLibraryTask.class, task -> {
|
||||
task.setOutputName(extension.getOutputName());
|
||||
task.setGraalVersion(extension.getGraalVersion());
|
||||
task.setJavaVersion(extension.getJavaVersion());
|
||||
task.setWindowsVsVarsPath(extension.getWindowsVsVarsPath());
|
||||
task.setJarFile(sharedLibrary.map(j -> j.getOutputs().getFiles().getSingleFile()));
|
||||
task.setClasspath(project.getConfigurations().named("runtimeClasspath"));
|
||||
task.setCacheDir(cacheDir);
|
||||
task.setGraalDirectoryName(extension.getGraalDirectoryName());
|
||||
task.setOptions(extension.getOptions());
|
||||
task.dependsOn(extractGraal);
|
||||
task.dependsOn(sharedLibrary);
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
implementation-class=com.palantir.gradle.graal.GradleGraalPlugin
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.palantir.gradle.graal
|
||||
|
||||
import com.palantir.gradle.graal.util.JavaVersionUtil
|
||||
import nebula.test.ProjectSpec
|
||||
import org.gradle.api.GradleException
|
||||
import spock.lang.Requires
|
||||
|
||||
class GradleExtensionSpec extends ProjectSpec {
|
||||
GraalExtension extension
|
||||
|
||||
def setup() {
|
||||
extension = new GraalExtension(project)
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for default Java version and graalVersion 19.2.0'() {
|
||||
when:
|
||||
extension.graalVersion("19.2.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/oracle/graal/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-19.2.0"
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for default Java version and graalVersion 19.3.0'() {
|
||||
when:
|
||||
extension.graalVersion("19.3.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/graalvm/graalvm-ce-builds/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-java8-19.3.0"
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for Java version 8 and graalVersion 19.2.0'() {
|
||||
when:
|
||||
extension.javaVersion("8")
|
||||
extension.graalVersion("19.2.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/oracle/graal/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-19.2.0"
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for Java version 8 and graalVersion 19.3.0'() {
|
||||
when:
|
||||
extension.javaVersion("8")
|
||||
extension.graalVersion("19.3.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/graalvm/graalvm-ce-builds/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-java8-19.3.0"
|
||||
}
|
||||
|
||||
def 'extension should throw exception for graalVersion 19.2.0 and Java version 11'() {
|
||||
when:
|
||||
extension.javaVersion("11")
|
||||
extension.graalVersion("19.2.0")
|
||||
extension.getDownloadBaseUrl().get()
|
||||
|
||||
then:
|
||||
thrown GradleException
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for Java version 11 and graalVersion 19.3.0'() {
|
||||
when:
|
||||
extension.javaVersion("11")
|
||||
extension.graalVersion("19.3.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/graalvm/graalvm-ce-builds/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-java11-19.3.0"
|
||||
}
|
||||
|
||||
def 'extension should throw exception for graalVersion 21.0.0 and Java version 16'() {
|
||||
when:
|
||||
extension.javaVersion("16")
|
||||
extension.graalVersion("21.0.0")
|
||||
extension.getDownloadBaseUrl().get()
|
||||
|
||||
then:
|
||||
thrown GradleException
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for Java version 16 and graalVersion 21.1.0'() {
|
||||
when:
|
||||
extension.javaVersion("16")
|
||||
extension.graalVersion("21.1.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/graalvm/graalvm-ce-builds/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-java16-21.1.0"
|
||||
}
|
||||
|
||||
def 'extension should throw exception for graalVersion 21.1.0 and Java version 17'() {
|
||||
when:
|
||||
extension.javaVersion("17")
|
||||
extension.graalVersion("21.1.0")
|
||||
extension.getDownloadBaseUrl().get()
|
||||
|
||||
then:
|
||||
thrown GradleException
|
||||
}
|
||||
|
||||
def 'extension returns the correct Graal download URL and directory name for Java version 17 and graalVersion 21.3.0'() {
|
||||
when:
|
||||
extension.javaVersion("17")
|
||||
extension.graalVersion("21.3.0")
|
||||
|
||||
then:
|
||||
extension.getDownloadBaseUrl().get() =~ "https://github.com/graalvm/graalvm-ce-builds/releases/download/"
|
||||
extension.getGraalDirectoryName().get() =~ "graalvm-ce-java17-21.3.0"
|
||||
}
|
||||
|
||||
def 'extension should throw exception for unsupported Java version'() {
|
||||
when:
|
||||
extension.javaVersion("12")
|
||||
|
||||
then:
|
||||
thrown GradleException
|
||||
}
|
||||
|
||||
@Requires({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS && JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'extension returns the correct Windows VS Vars Path for default Java version 8'() {
|
||||
expect:
|
||||
extension.getWindowsVsVarsPath().get() == "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Bin\\SetEnv.cmd"
|
||||
}
|
||||
|
||||
@Requires({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS && JavaVersionUtil.runtimeMajorVersion() == 11 })
|
||||
def 'extension returns the correct Windows VS Vars Path for Java version 11 and set Windows VS Version and Edition'() {
|
||||
when:
|
||||
extension.javaVersion("11")
|
||||
extension.windowsVsVersion("2019")
|
||||
extension.windowsVsEdition("Enterprise")
|
||||
|
||||
then:
|
||||
extension.getWindowsVsVarsPath().get() == "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
|
||||
}
|
||||
|
||||
def 'extension returns the provided Windows VS Vars Path'() {
|
||||
when:
|
||||
extension.windowsVsVarsPath("path")
|
||||
|
||||
then:
|
||||
extension.getWindowsVsVarsPath().get() =~ "path"
|
||||
}
|
||||
}
|
|
@ -16,9 +16,11 @@
|
|||
|
||||
package com.palantir.gradle.graal
|
||||
|
||||
import com.palantir.gradle.graal.util.JavaVersionUtil
|
||||
import nebula.test.IntegrationSpec
|
||||
import nebula.test.functional.ExecutionResult
|
||||
import spock.lang.IgnoreIf
|
||||
import spock.lang.Requires
|
||||
|
||||
import static com.palantir.gradle.graal.Platform.OperatingSystem.LINUX
|
||||
import static com.palantir.gradle.graal.Platform.OperatingSystem.MAC
|
||||
|
@ -26,6 +28,7 @@ import static com.palantir.gradle.graal.Platform.OperatingSystem.WINDOWS
|
|||
|
||||
class GradleGraalEndToEndSpec extends IntegrationSpec {
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'test default version nativeImage'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
|
@ -86,7 +89,195 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
output.getAbsolutePath().execute().text.equals("hello, world (modified)!" + System.lineSeparator())
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'test version 19.3.0 nativeImage'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
mainClass 'com.palantir.test.Main'
|
||||
outputName 'hello-world'
|
||||
graalVersion '19.3.0'
|
||||
}
|
||||
'''
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('nativeImage') // note, this accesses your real ~/.gradle cache
|
||||
println "Gradle Standard Out:\n" + result.standardOutput
|
||||
println "Gradle Standard Error:\n" + result.standardError
|
||||
def outputPath = "build/graal/hello-world"
|
||||
if (Platform.operatingSystem() == WINDOWS) {
|
||||
outputPath += ".exe"
|
||||
}
|
||||
File output = new File(getProjectDir(), outputPath)
|
||||
|
||||
then:
|
||||
output.exists()
|
||||
output.getAbsolutePath().execute().text.equals("hello, world!" + System.lineSeparator())
|
||||
|
||||
when:
|
||||
ExecutionResult result2 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
result2.wasUpToDate(':nativeImage')
|
||||
|
||||
when:
|
||||
new File(getProjectDir(), "src/main/java/com/palantir/test/Main.java").text = '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world (modified)!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
ExecutionResult result3 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
println result3.standardOutput
|
||||
!result3.wasUpToDate(':nativeImage')
|
||||
output.getAbsolutePath().execute().text.equals("hello, world (modified)!" + System.lineSeparator())
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'test version 20.1.0 nativeImage'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
mainClass 'com.palantir.test.Main'
|
||||
outputName 'hello-world'
|
||||
graalVersion '20.1.0'
|
||||
}
|
||||
'''
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('nativeImage') // note, this accesses your real ~/.gradle cache
|
||||
println "Gradle Standard Out:\n" + result.standardOutput
|
||||
println "Gradle Standard Error:\n" + result.standardError
|
||||
def outputPath = "build/graal/hello-world"
|
||||
if (Platform.operatingSystem() == WINDOWS) {
|
||||
outputPath += ".exe"
|
||||
}
|
||||
File output = new File(getProjectDir(), outputPath)
|
||||
|
||||
then:
|
||||
output.exists()
|
||||
output.getAbsolutePath().execute().text.equals("hello, world!" + System.lineSeparator())
|
||||
|
||||
when:
|
||||
ExecutionResult result2 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
result2.wasUpToDate(':nativeImage')
|
||||
|
||||
when:
|
||||
new File(getProjectDir(), "src/main/java/com/palantir/test/Main.java").text = '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world (modified)!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
ExecutionResult result3 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
println result3.standardOutput
|
||||
!result3.wasUpToDate(':nativeImage')
|
||||
output.getAbsolutePath().execute().text.equals("hello, world (modified)!" + System.lineSeparator())
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 11 })
|
||||
def 'test version 19.3.0 nativeImage Java 11'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
mainClass 'com.palantir.test.Main'
|
||||
outputName 'hello-world'
|
||||
graalVersion '19.3.0'
|
||||
javaVersion '11'
|
||||
}
|
||||
'''
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('nativeImage') // note, this accesses your real ~/.gradle cache
|
||||
println "Gradle Standard Out:\n" + result.standardOutput
|
||||
println "Gradle Standard Error:\n" + result.standardError
|
||||
def outputPath = "build/graal/hello-world"
|
||||
if (Platform.operatingSystem() == WINDOWS) {
|
||||
outputPath += ".exe"
|
||||
}
|
||||
File output = new File(getProjectDir(), outputPath)
|
||||
|
||||
then:
|
||||
output.exists()
|
||||
output.getAbsolutePath().execute().text.equals("hello, world!" + System.lineSeparator())
|
||||
|
||||
when:
|
||||
ExecutionResult result2 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
result2.wasUpToDate(':nativeImage')
|
||||
|
||||
when:
|
||||
new File(getProjectDir(), "src/main/java/com/palantir/test/Main.java").text = '''
|
||||
package com.palantir.test;
|
||||
|
||||
public final class Main {
|
||||
public static final void main(String[] args) {
|
||||
System.out.println("hello, world (modified)!");
|
||||
}
|
||||
}
|
||||
'''
|
||||
ExecutionResult result3 = runTasksSuccessfully('nativeImage')
|
||||
|
||||
then:
|
||||
println result3.standardOutput
|
||||
!result3.wasUpToDate(':nativeImage')
|
||||
output.getAbsolutePath().execute().text.equals("hello, world (modified)!" + System.lineSeparator())
|
||||
}
|
||||
|
||||
// there is no RC version for Windows
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
@IgnoreIf({ Platform.operatingSystem() == WINDOWS })
|
||||
def 'test 1.0.0-rc5 nativeImage'() {
|
||||
setup:
|
||||
|
@ -149,7 +340,8 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
output.getAbsolutePath().execute().text.equals("hello, world (modified)!" + System.lineSeparator())
|
||||
}
|
||||
|
||||
def 'allows specifying additional properties'() {
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'allows specifying additional properties on default version'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
|
@ -198,6 +390,7 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
output.getAbsolutePath().execute().text.toLowerCase().contains("<html")
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'can build shared libraries on default version'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
|
@ -220,7 +413,57 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
dylibFile.exists()
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'can build shared libraries on version 19.3.0'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
package com.palantir.test;
|
||||
public final class Main {}
|
||||
'''
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
graal {
|
||||
outputName 'hello-world'
|
||||
graalVersion '19.3.0'
|
||||
}
|
||||
'''
|
||||
|
||||
when:
|
||||
runTasksSuccessfully('sharedLibrary')
|
||||
File dylibFile = new File(getProjectDir(), "build/graal/hello-world." + getSharedLibPrefixByOs())
|
||||
|
||||
then:
|
||||
dylibFile.exists()
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 11 })
|
||||
def 'can build shared libraries on version 19.3.0 Java 11'() {
|
||||
setup:
|
||||
directory("src/main/java/com/palantir/test")
|
||||
file("src/main/java/com/palantir/test/Main.java") << '''
|
||||
package com.palantir.test;
|
||||
public final class Main {}
|
||||
'''
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
graal {
|
||||
outputName 'hello-world'
|
||||
graalVersion '19.3.0'
|
||||
javaVersion '11'
|
||||
}
|
||||
'''
|
||||
|
||||
when:
|
||||
runTasksSuccessfully('sharedLibrary')
|
||||
File dylibFile = new File(getProjectDir(), "build/graal/hello-world." + getSharedLibPrefixByOs())
|
||||
|
||||
then:
|
||||
dylibFile.exists()
|
||||
}
|
||||
|
||||
// there is no RC version for Windows
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
@IgnoreIf({ Platform.operatingSystem() == WINDOWS })
|
||||
def 'can build shared libraries on 1.0.0-rc5'() {
|
||||
setup:
|
||||
|
@ -245,19 +488,7 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
dylibFile.exists()
|
||||
}
|
||||
|
||||
def getSharedLibPrefixByOs() {
|
||||
switch (Platform.operatingSystem()) {
|
||||
case MAC:
|
||||
return "dylib"
|
||||
case LINUX:
|
||||
return "so"
|
||||
case WINDOWS:
|
||||
return "dll"
|
||||
default:
|
||||
throw new IllegalStateException("No GraalVM support for " + Platform.operatingSystem())
|
||||
}
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'should not allow empty mainClass on nativeImage'() {
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
@ -278,6 +509,7 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
result.standardError.contains("No value has been specified for property 'mainClass'")
|
||||
}
|
||||
|
||||
@Requires({ JavaVersionUtil.runtimeMajorVersion() == 8 })
|
||||
def 'should not allow to add -H:Name'() {
|
||||
buildFile << '''
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
@ -299,4 +531,18 @@ class GradleGraalEndToEndSpec extends IntegrationSpec {
|
|||
then:
|
||||
result.standardError.contains("Use 'outputName' instead of")
|
||||
}
|
||||
|
||||
def getSharedLibPrefixByOs() {
|
||||
switch (Platform.operatingSystem()) {
|
||||
case MAC:
|
||||
return "dylib"
|
||||
case LINUX:
|
||||
return "so"
|
||||
case WINDOWS:
|
||||
return "dll"
|
||||
default:
|
||||
throw new IllegalStateException("No GraalVM support for " + Platform.operatingSystem())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class GradleGraalPluginIntegrationSpec extends IntegrationSpec {
|
|||
server.takeRequest().requestUrl.toString() =~ "http://(localhost|127\\.0\\.0\\.1):${server.port}" +
|
||||
"/oracle/graal/releases/download//vm-1.0.0-rc3/graalvm-ce-1.0.0-rc3-(macos|linux)-amd64.tar.gz"
|
||||
|
||||
file("cacheDir/1.0.0-rc3/graalvm-ce-1.0.0-rc3-amd64.tar.gz").text == '<<tgz>>'
|
||||
file("cacheDir/1.0.0-rc3/8/graalvm-ce-1.0.0-rc3-amd64.tar.gz").text == '<<tgz>>'
|
||||
}
|
||||
|
||||
// for Windows the download is a .zip, this is tested below
|
||||
|
@ -108,7 +108,7 @@ class GradleGraalPluginIntegrationSpec extends IntegrationSpec {
|
|||
server.takeRequest().path =~
|
||||
"/oracle/graal/releases/download//vm-19.0.0/graalvm-ce-(darwin|linux)-amd64-19.0.0.tar.gz"
|
||||
|
||||
file("cacheDir/19.0.0/graalvm-ce-19.0.0-amd64.tar.gz").text == '<<tgz>>'
|
||||
file("cacheDir/19.0.0/8/graalvm-ce-19.0.0-amd64.tar.gz").text == '<<tgz>>'
|
||||
}
|
||||
|
||||
@Requires({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS })
|
||||
|
@ -138,9 +138,141 @@ class GradleGraalPluginIntegrationSpec extends IntegrationSpec {
|
|||
// e.g. Docker Desktop puts "127.0.0.1 kubernetes.docker.internal" in there, which ends up in `requestUrl`
|
||||
// so the comparison is only made for `path`
|
||||
server.takeRequest().path =~
|
||||
"/oracle/graal/releases/download//vm-19.0.0/graalvm-ce-windows-amd64-19.0.0.zip"
|
||||
"/oracle/graal/releases/download//vm-19.0.0/graalvm-ce-windows-amd64-19.0.0.zip"
|
||||
|
||||
file("cacheDir/19.0.0/graalvm-ce-19.0.0-amd64.zip").text == '<<zip>>'
|
||||
file("cacheDir/19.0.0/8/graalvm-ce-19.0.0-amd64.zip").text == '<<zip>>'
|
||||
}
|
||||
|
||||
// for Windows the download is a .zip, this is tested below
|
||||
@IgnoreIf({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS })
|
||||
def 'allows specifying GA graal version Java 8 19.3+ (non-windows)'() {
|
||||
setup:
|
||||
buildFile << """
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
graalVersion '19.3.0'
|
||||
downloadBaseUrl '${fakeBaseUrl}'
|
||||
}
|
||||
"""
|
||||
server.enqueue(new MockResponse().setBody('<<tgz>>'))
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('downloadGraalTooling')
|
||||
|
||||
then:
|
||||
println result.getStandardOutput()
|
||||
result.wasExecuted(':downloadGraalTooling')
|
||||
!result.wasUpToDate(':downloadGraalTooling')
|
||||
!result.wasSkipped(':downloadGraalTooling')
|
||||
|
||||
// `requestUrl` can contain "127.0.0.1" instead of "localhost"
|
||||
// worse yet, it can contain any hostname that is defined for 127.0.0.1 in the hosts file
|
||||
// e.g. Docker Desktop puts "127.0.0.1 kubernetes.docker.internal" in there, which ends up in `requestUrl`
|
||||
// so the comparison is only made for `path`
|
||||
server.takeRequest().path =~
|
||||
"oracle/graal/releases/download//vm-19.3.0/graalvm-ce-java8-(darwin|linux)-amd64-19.3.0.tar.gz"
|
||||
|
||||
file("cacheDir/19.3.0/8/graalvm-ce-java8-19.3.0-amd64.tar.gz").text == '<<tgz>>'
|
||||
}
|
||||
|
||||
@Requires({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS })
|
||||
def 'allows specifying GA graal version Java 8 19.3+ (windows)'() {
|
||||
setup:
|
||||
buildFile << """
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
graalVersion '19.3.0'
|
||||
downloadBaseUrl '${fakeBaseUrl}'
|
||||
}
|
||||
"""
|
||||
server.enqueue(new MockResponse().setBody('<<zip>>'))
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('downloadGraalTooling')
|
||||
|
||||
then:
|
||||
println result.getStandardOutput()
|
||||
result.wasExecuted(':downloadGraalTooling')
|
||||
!result.wasUpToDate(':downloadGraalTooling')
|
||||
!result.wasSkipped(':downloadGraalTooling')
|
||||
|
||||
// `requestUrl` can contain "127.0.0.1" instead of "localhost"
|
||||
// worse yet, it can contain any hostname that is defined for 127.0.0.1 in the hosts file
|
||||
// e.g. Docker Desktop puts "127.0.0.1 kubernetes.docker.internal" in there, which ends up in `requestUrl`
|
||||
// so the comparison is only made for `path`
|
||||
server.takeRequest().path =~
|
||||
"oracle/graal/releases/download//vm-19.3.0/graalvm-ce-java8-windows-amd64-19.3.0.zip"
|
||||
|
||||
file("cacheDir/19.3.0/8/graalvm-ce-java8-19.3.0-amd64.zip").text == '<<zip>>'
|
||||
}
|
||||
|
||||
// for Windows the download is a .zip, this is tested below
|
||||
@IgnoreIf({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS })
|
||||
def 'allows specifying GA graal version Java 11 19.3+ (non-windows)'() {
|
||||
setup:
|
||||
buildFile << """
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
graalVersion '19.3.0'
|
||||
javaVersion '11'
|
||||
downloadBaseUrl '${fakeBaseUrl}'
|
||||
}
|
||||
"""
|
||||
server.enqueue(new MockResponse().setBody('<<tgz>>'))
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('downloadGraalTooling')
|
||||
|
||||
then:
|
||||
println result.getStandardOutput()
|
||||
result.wasExecuted(':downloadGraalTooling')
|
||||
!result.wasUpToDate(':downloadGraalTooling')
|
||||
!result.wasSkipped(':downloadGraalTooling')
|
||||
|
||||
// `requestUrl` can contain "127.0.0.1" instead of "localhost"
|
||||
// worse yet, it can contain any hostname that is defined for 127.0.0.1 in the hosts file
|
||||
// e.g. Docker Desktop puts "127.0.0.1 kubernetes.docker.internal" in there, which ends up in `requestUrl`
|
||||
// so the comparison is only made for `path`
|
||||
server.takeRequest().path =~
|
||||
"oracle/graal/releases/download//vm-19.3.0/graalvm-ce-java11-(darwin|linux)-amd64-19.3.0.tar.gz"
|
||||
|
||||
file("cacheDir/19.3.0/11/graalvm-ce-java11-19.3.0-amd64.tar.gz").text == '<<tgz>>'
|
||||
}
|
||||
|
||||
@Requires({ Platform.operatingSystem() == Platform.OperatingSystem.WINDOWS })
|
||||
def 'allows specifying GA graal version Java 11 19.3+ (windows)'() {
|
||||
setup:
|
||||
buildFile << """
|
||||
apply plugin: 'com.palantir.graal'
|
||||
|
||||
graal {
|
||||
graalVersion '19.3.0'
|
||||
javaVersion '11'
|
||||
downloadBaseUrl '${fakeBaseUrl}'
|
||||
}
|
||||
"""
|
||||
server.enqueue(new MockResponse().setBody('<<zip>>'))
|
||||
|
||||
when:
|
||||
ExecutionResult result = runTasksSuccessfully('downloadGraalTooling')
|
||||
|
||||
then:
|
||||
println result.getStandardOutput()
|
||||
result.wasExecuted(':downloadGraalTooling')
|
||||
!result.wasUpToDate(':downloadGraalTooling')
|
||||
!result.wasSkipped(':downloadGraalTooling')
|
||||
|
||||
// `requestUrl` can contain "127.0.0.1" instead of "localhost"
|
||||
// worse yet, it can contain any hostname that is defined for 127.0.0.1 in the hosts file
|
||||
// e.g. Docker Desktop puts "127.0.0.1 kubernetes.docker.internal" in there, which ends up in `requestUrl`
|
||||
// so the comparison is only made for `path`
|
||||
server.takeRequest().path =~
|
||||
"oracle/graal/releases/download//vm-19.3.0/graalvm-ce-java11-windows-amd64-19.3.0.zip"
|
||||
|
||||
file("cacheDir/19.3.0/11/graalvm-ce-java11-19.3.0-amd64.zip").text == '<<zip>>'
|
||||
}
|
||||
|
||||
def 'downloadGraalTooling behaves incrementally'() {
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.palantir.gradle.graal
|
||||
|
||||
import nebula.test.ProjectSpec
|
||||
import org.gradle.api.GradleException
|
||||
import spock.lang.Specification
|
||||
|
||||
class GradleVersionUtilSpec extends Specification {
|
||||
def 'should detect Graal version 19.2.0 is not 19.3+'() {
|
||||
expect:
|
||||
!GraalVersionUtil.isGraalVersionGreaterOrEqualThan("19.2.0", 19, 3)
|
||||
}
|
||||
|
||||
def 'should detect Graal version 19.3.0 is 19.3+'() {
|
||||
expect:
|
||||
GraalVersionUtil.isGraalVersionGreaterOrEqualThan("19.3.0", 19, 3)
|
||||
}
|
||||
|
||||
def 'should detect Graal version empty is not 19.3+'() {
|
||||
expect:
|
||||
!GraalVersionUtil.isGraalVersionGreaterOrEqualThan("", 19, 3)
|
||||
}
|
||||
|
||||
def 'should detect Graal version 21.1.0 is 21.1+'() {
|
||||
expect:
|
||||
GraalVersionUtil.isGraalVersionGreaterOrEqualThan("21.1.0", 21, 1)
|
||||
}
|
||||
|
||||
def 'should detect Graal version 21.0.0 is not 21.1+'() {
|
||||
expect:
|
||||
!GraalVersionUtil.isGraalVersionGreaterOrEqualThan("21.0.0", 21, 1)
|
||||
}
|
||||
}
|
|
@ -14,23 +14,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
package com.palantir.gradle.graal.util;
|
||||
|
||||
bintray {
|
||||
user = System.env.BINTRAY_USERNAME
|
||||
key = System.env.BINTRAY_PASSWORD
|
||||
publish = true
|
||||
pkg {
|
||||
repo = 'releases'
|
||||
name = rootProject.name
|
||||
userOrg = 'palantir'
|
||||
licenses = ['Apache-2.0']
|
||||
publications = ['nebula']
|
||||
public class JavaVersionUtil {
|
||||
public static int runtimeMajorVersion() {
|
||||
String version = System.getProperty("java.version");
|
||||
if (version.startsWith("1.")) {
|
||||
version = version.substring(2, 3);
|
||||
} else {
|
||||
int dot = version.indexOf(".");
|
||||
if (dot != -1) {
|
||||
version = version.substring(0, dot);
|
||||
}
|
||||
}
|
||||
return Integer.parseInt(version);
|
||||
}
|
||||
}
|
||||
|
||||
publish.dependsOn bintrayUpload
|
||||
bintrayUpload.onlyIf {
|
||||
versionDetails().isCleanTag
|
||||
private JavaVersionUtil() {}
|
||||
}
|
||||
|
|
@ -2,20 +2,18 @@
|
|||
|
||||
[Test dependencies]
|
||||
cglib:cglib-nodep:3.2.2 (1 constraints: 490ded24)
|
||||
com.google.code.findbugs:jsr305:3.0.2 (2 constraints: 1d0fb186)
|
||||
com.google.errorprone:error_prone_annotations:2.3.4 (2 constraints: 200f3287)
|
||||
com.google.guava:failureaccess:1.0.1 (1 constraints: 140ae1b4)
|
||||
com.google.guava:guava:27.0.1-jre (2 constraints: c7135868)
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (1 constraints: bd17c918)
|
||||
com.google.j2objc:j2objc-annotations:1.1 (1 constraints: b609eba0)
|
||||
com.netflix.nebula:nebula-test:7.8.6 (1 constraints: 17052c36)
|
||||
com.netflix.nebula:nebula-test:10.2.0 (1 constraints: 35052d3b)
|
||||
com.squareup.okhttp3:mockwebserver:3.14.1 (1 constraints: 3b05423b)
|
||||
com.squareup.okhttp3:okhttp:3.14.1 (1 constraints: 680fa37c)
|
||||
com.squareup.okio:okio:1.17.2 (1 constraints: 850cc309)
|
||||
commons-io:commons-io:2.5 (1 constraints: eb0c8d0a)
|
||||
junit:junit:4.12 (2 constraints: 0c1c0d9c)
|
||||
org.checkerframework:checker-qual:2.5.3 (2 constraints: 260f6187)
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.17 (1 constraints: ed09d8aa)
|
||||
junit:junit:4.13.2 (2 constraints: 221d6f12)
|
||||
org.apiguardian:apiguardian-api:1.1.2 (2 constraints: 5523ed36)
|
||||
org.codehaus.groovy:groovy:3.0.9 (2 constraints: 241bc56d)
|
||||
org.hamcrest:hamcrest:2.2 (1 constraints: d20cdc04)
|
||||
org.hamcrest:hamcrest-core:1.3 (1 constraints: cc05fe3f)
|
||||
org.junit.platform:junit-platform-commons:1.8.1 (1 constraints: 6e119ed9)
|
||||
org.junit.platform:junit-platform-engine:1.8.1 (1 constraints: 360d1a1f)
|
||||
org.objenesis:objenesis:2.4 (1 constraints: ea0c8c0a)
|
||||
org.spockframework:spock-core:1.3-groovy-2.4 (1 constraints: 7c10f3af)
|
||||
org.opentest4j:opentest4j:1.2.0 (1 constraints: 67118bd9)
|
||||
org.spockframework:spock-core:2.1-M2-groovy-3.0 (2 constraints: e622905a)
|
||||
org.spockframework:spock-junit4:2.1-M2-groovy-3.0 (1 constraints: 241154df)
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
com.google.guava:guava = 27.0.1-jre
|
||||
com.netflix.nebula:nebula-test = 7.8.6
|
||||
com.fasterxml.jackson.core:jackson-databind = 2.13.2.1
|
||||
com.google.guava:guava = 31.1-jre
|
||||
com.netflix.nebula:nebula-test = 10.2.0
|
||||
com.squareup.okhttp3:* = 3.14.1
|
||||
|
||||
# conflict resolution
|
||||
com.google.code.findbugs:jsr305 = 3.0.2
|
||||
com.google.errorprone:error_prone_annotations = 2.3.4
|
||||
org.checkerframework:checker-qual = 2.5.3
|
||||
|
|
Loading…
Reference in a new issue