Skip to content

Commit

Permalink
Cache gradle artifacts (#545)
Browse files Browse the repository at this point in the history
* Cache gradle artifacts

* Attempt fix

* Attempt fix

* Attempt fix

* Don't use daemon

* Random formatting cleanup to test cache

* Try killing daemon to speed up build
  • Loading branch information
stephenjust authored Feb 16, 2025
1 parent add02b3 commit 510a938
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
32 changes: 26 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ jobs:
- job: Windows_64_Bit
pool:
vmImage: 'windows-latest'
variables:
GRADLE_USER_HOME: $(Build.SourcesDirectory)/build/.gradle
steps:
- task: JavaToolInstaller@0
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: Gradle@2
- task: Cache@2
inputs:
key: 'gradle | "$(Agent.OS)" | $(Build.SourcesDirectory)/build.gradle | $(Build.SourcesDirectory)/settings.gradle | $(Build.SourcesDirectory)/gradle/wrapper/gradle-wrapper.properties | $(Build.SourcesDirectory)/vendordeps/*'
path: $(GRADLE_USER_HOME)
displayName: 'Cache Gradle dependencies'
- task: Gradle@3
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'build --stacktrace --info'
# checkStyleRunAnalysis: true
# pmdRunAnalysis: true
- task: PublishCodeCoverageResults@1
env:
GRADLE_USER_HOME: $(GRADLE_USER_HOME)
- task: PublishCodeCoverageResults@2
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: 'build/reports/jacoco/test/jacocoTestReport.xml'
Expand All @@ -32,21 +39,34 @@ jobs:
displayName: 'Maven Authenticate'
inputs:
artifactsFeeds: XBot
- task: Gradle@2
- task: Gradle@3
displayName: 'Publish to Maven'
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: true
tasks: 'publish --info'
- task: Gradle@2
env:
GRADLE_USER_HOME: $(GRADLE_USER_HOME)
- task: Gradle@3
displayName: Generate Javadoc
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'javadoc'
env:
GRADLE_USER_HOME: $(GRADLE_USER_HOME)
- task: Gradle@3
displayName: Stop gradle daemon
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: '--stop'
env:
GRADLE_USER_HOME: $(GRADLE_USER_HOME)
- task: PublishPipelineArtifact@0
displayName: 'Publish javadoc as an artifact'
inputs:
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ repositories {

maven { url uri ("../SeriouslyCommonLib/lib/")}



mavenLocal()
}

Expand Down
23 changes: 10 additions & 13 deletions src/main/java/xbot/common/logging/RobotAssertionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@
/**
* Base class for safe assertion manager. Allows context-based management of
* exceptions and assertion conditions.
*
*/
public abstract class RobotAssertionManager {
static Logger log = LogManager.getLogger(RobotAssertionManager.class);

public final void throwException(RuntimeException e) {
log.error("Safe exception encountered (exception throw " + (this.isExceptionsEnabled() ? "enabled" : "disabled") + "): "
+ e.getMessage());
log.error("Stack trace: \n "
+ Arrays.stream(e.getStackTrace())
.map(elem -> elem.toString())
.collect(Collectors.joining("\n ")));

log.error("Safe exception encountered (exception throw {}): {}", this.isExceptionsEnabled() ? "enabled" : "disabled", e.getMessage());
log.error("Stack trace: \n {}", Arrays.stream(e.getStackTrace())
.map(StackTraceElement::toString)
.collect(Collectors.joining("\n ")));

handlePlatformException(e);
}

public final void throwException(String message, Throwable cause) {
throwException(new RuntimeException(message, cause));
}

protected abstract void handlePlatformException(RuntimeException e);

public abstract boolean isExceptionsEnabled();

public final void fail(String message) {
throwException(new RobotAssertionException(message));
}

public final void assertTrue(boolean value, String assertionFaliureCause) {
if(!value) {
fail(assertionFaliureCause);
Expand Down

0 comments on commit 510a938

Please sign in to comment.