Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next version, 2.3.1 #233

Merged
merged 4 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ plugins {
defaultTasks 'check'

group = 'com.athaydes'
version = "2.3.0-groovy-3.0"
version = "2.3.1-groovy-3.0"
description = 'This project is a global extension for Spock to create test (or, in Spock terms, Specifications) reports.'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

def groovyVersion = '3.0.9'
def spockVersion = '2.0-groovy-3.0'
def spockVersion = '2.1-groovy-3.0'

repositories {
mavenCentral()
Expand Down
4 changes: 4 additions & 0 deletions news.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

> Most recent first

* `25th of August 2022`

Minor bug fixes release. See release notes.

* `06th of February 2022`

One bug fix and one new, small feature make up this release.
Expand Down
6 changes: 6 additions & 0 deletions releases/Release_Notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.3.1-groovy-3.0 - 2022 Aug 25

* #231 fixed disappearing blocks in vivid reports when spec uses annotations (thanks to @ArkiMargust).
* #228 more efficient generation of aggregated report.
* upgraded Spock to 2.1-groovy-3.0.

2.3.0-groovy-3.0 - 2022 Feb 06

* #222 fixed null-pointer when executing child specification (bug introduced in version `2.1-groovy-3.0`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.athaydes.spockframework.report.internal

import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.transform.CompileStatic
import groovy.transform.PackageScope
import groovy.util.logging.Slf4j

Expand All @@ -16,12 +17,13 @@ import java.util.regex.Pattern
* This is necessary to support parallel builds.
*/
@Slf4j
@CompileStatic
class ReportDataAggregator {

static final AGGREGATED_DATA_FILE = 'aggregated_report.json'
static final String AGGREGATED_DATA_FILE = 'aggregated_report.json'

static final charset = Charset.forName( 'utf-8' )
static final jsonParser = new JsonSlurper()
static final Charset charset = Charset.forName( 'utf-8' )
static final JsonSlurper jsonParser = new JsonSlurper()

static Map<String, Map> getAllAggregatedDataAndPersistLocalData( File dir, Map localData ) {
if ( dir != null && !dir.exists() ) {
Expand All @@ -41,7 +43,7 @@ class ReportDataAggregator {

return withFileLock( dataFile ) {
def persistedData = readTextFrom( dataFile ) ?: '{}'
def allData = jsonParser.parseText( persistedData ) + localData
Map allData = jsonParser.parseText( persistedData ) as Map + localData
appendDataToFile( dataFile, localData )
allData.asImmutable() as Map<String, Map>
}
Expand Down Expand Up @@ -87,14 +89,9 @@ class ReportDataAggregator {

@PackageScope
static String readTextFrom( RandomAccessFile file ) {
def buffer = new byte[8]
def result = new StringBuilder( file.length() as int )

int bytesRead
while ( ( bytesRead = file.read( buffer ) ) > 0 ) {
result.append( new String( buffer[ 0..( bytesRead - 1 ) ] as byte[], charset ) )
}
return result.toString()
def buffer = new byte[file.length()]
file.readFully( buffer )
new String( buffer, charset )
}

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.athaydes.spockframework.report.vivid


import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.codehaus.groovy.ast.*
import org.codehaus.groovy.ast.AnnotatedNode
import org.codehaus.groovy.ast.ClassCodeVisitorSupport
import org.codehaus.groovy.ast.ClassNode
import org.codehaus.groovy.ast.MethodNode
import org.codehaus.groovy.ast.stmt.BlockStatement
import org.codehaus.groovy.ast.stmt.Statement
import org.codehaus.groovy.control.*
import org.codehaus.groovy.control.CompilationFailedException
import org.codehaus.groovy.control.CompilationUnit
import org.codehaus.groovy.control.CompilePhase
import org.codehaus.groovy.control.CompilerConfiguration
import org.codehaus.groovy.control.SourceUnit
import org.spockframework.util.Nullable
import org.spockframework.util.inspector.AstInspectorException

Expand Down Expand Up @@ -152,8 +158,9 @@ class VividASTVisitor extends ClassCodeVisitorSupport {
visitStatements = previousIsTestMethod
}

@Override // This is overridden to avoid visiting annotations.
void visitAnnotations(AnnotatedNode node) {
// This is overridden to avoid visiting annotations.
@Override
void visitAnnotations( AnnotatedNode node ) {
// do nothing - we don't want to visit annotations (see #231)
}

Expand Down