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

OD-19448 Update Gradle to 8.8 version on Angel #1320

Closed
Closed
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
23 changes: 18 additions & 5 deletions api-doc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Copyright ish group pty ltd 2020.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*/

apply from: "$rootDir/nodeSetup.gradle"

task apiDoc(type: NpmTask, dependsOn: [':server-api:apiDocs_mergeSwagger', 'npmInstall']) {
Expand All @@ -9,22 +20,24 @@ task apiDoc(type: NpmTask, dependsOn: [':server-api:apiDocs_mergeSwagger', 'npmI
npmCommand = ['run']
args = ['build']

outputs.dir("${buildDir}/api-docs")
outputs.dir("${layout.buildDirectory.get()}/api-docs")
}

build.dependsOn(apiDoc)

task packageApiDoc (type: Zip, dependsOn: apiDoc) {
group = "documentation"
from apiDoc.outputs.files
archiveClassifier = 'documentation'
}

tasks.named('build') {
dependsOn apiDoc
}

publishing {
publications {
docs(MavenPublication) {
create("docs", MavenPublication) {
artifact(packageApiDoc) {
artifactId "apiDoc"
artifactId = "apiDoc"
}
}
}
Expand Down
20 changes: 14 additions & 6 deletions api-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import test.PrepareTestDatabase

/*
* Copyright ish group pty ltd 2020.
*
Expand All @@ -11,6 +9,17 @@ import test.PrepareTestDatabase
* See the GNU Affero General Public License for more details.
*/

import test.PrepareTestDatabase

plugins {
id 'java'
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

ext {
karateVersion = '1.0.1'
}
Expand All @@ -29,9 +38,6 @@ dependencies {
testImplementation "org.eclipse.jetty:jetty-client:$jettyVersion"
}

sourceCompatibility = 11
targetCompatibility = 11

task copyConfig(type: Copy) {
from("$rootDir/api-test/src/test/resources/") {
include 'onCourse.yml'
Expand All @@ -52,7 +58,9 @@ test {
events "failed", "standardOut"
}

tasks.getByName('prepareTestDatabase').mustRunAfter(':server:startDaemon').mustRunAfter('copyConfig')
tasks.named('prepareTestDatabase').get()
.mustRunAfter(':server:startDaemon')
.mustRunAfter('copyConfig')

dependsOn "copyConfig"
dependsOn ":server:startDaemon"
Expand Down
35 changes: 16 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

buildscript {
ext {
log4j2Version = '2.17.2'
Expand All @@ -31,11 +32,11 @@ buildscript {
}

plugins {
id 'com.github.ben-manes.versions' version '0.39.0' // adds the task 'dependencyUpdates -Drevision=release'
id 'com.github.node-gradle.node' version '3.1.1' apply false
id 'com.github.psxpaul.execfork' version '0.1.15' apply false
id 'com.github.ben-manes.versions' version '0.51.0' // adds the task 'dependencyUpdates -Drevision=release'
id 'com.github.node-gradle.node' version '7.0.1' apply false
id 'com.github.psxpaul.execfork' version '0.2.2' apply false
id 'idea'
id 'org.barfuin.gradle.taskinfo' version '1.2.0' // adds the task 'tiTree [some task]' and the task 'tiOrder [some task]'
id 'org.barfuin.gradle.taskinfo' version '2.2.0' // adds the task 'tiTree [some task]' and the task 'tiOrder [some task]'

id 'java'
id 'groovy'
Expand Down Expand Up @@ -64,7 +65,11 @@ subprojects {
// added it exactly here since api dep doesn't work without that plugin
apply plugin: 'java-library'

sourceCompatibility = 11
java {
sourceCompatibility = JavaVersion.VERSION_11
}

group = 'ish.oncourse.angel'
// get the version from the command line properties
version = project.hasProperty('releaseVersion') && project.releaseVersion ? project.releaseVersion : "99-SNAPSHOT"
version = version.replace('v','') // remove the leading v from the version
Expand All @@ -90,22 +95,15 @@ subprojects {

implementation 'javax.annotation:javax.annotation-api:1.3.2'



testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.0'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.8.0' // needed for dbunit https://sourceforge.net/p/dbunit/feature-requests/222/
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.dbunit:dbunit:2.7.0'

testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
testImplementation "org.codehaus.groovy:groovy-sql:$groovyVersion"
}
// uncomment when dbunit is detached from junit
// configurations {
// testImplementation.exclude group: 'junit' // exclude junit4
// }

group = 'ish.oncourse.angel'

publishing {
repositories {
Expand Down Expand Up @@ -140,8 +138,7 @@ subprojects {
test {
useJUnitPlatform()

systemProperties 'java.awt.headless': 'true',
'java.locale.providers': 'COMPAT,SPI'
systemProperties 'java.awt.headless': 'true', 'java.locale.providers': 'COMPAT,SPI'
maxHeapSize = '3000M'
maxParallelForks = 1
ignoreFailures = true
Expand All @@ -152,7 +149,7 @@ subprojects {
}

reports {
junitXml.enabled = true
junitXml.required = true
}

afterSuite { desc, result ->
Expand All @@ -161,17 +158,17 @@ subprojects {
}
}
doLast {
if (testFailed) {
if (ext.testFailed) {
throw new Exception("tests failed, exit code == 1")
}
}
}
}

task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
destinationDirectory = file("${layout.buildDirectory.get()}/reports/tests")
// Include the results from the `test` task in all subprojects
reportOn subprojects*.test
testResults.from = subprojects*.test
}

// Skip beta and other non-final releases in the update report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* 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 ssh copy of the License at
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Expand All @@ -18,6 +18,7 @@ package au.com.ish.docs
import groovyjarjarantlr.RecognitionException
import groovyjarjarantlr.TokenStreamException
import groovyjarjarantlr.collections.AST
import org.apache.groovy.antlr.override.GroovydocVisitor
import org.apache.commons.lang3.StringUtils
import org.codehaus.groovy.antlr.AntlrASTProcessor
import org.codehaus.groovy.antlr.SourceBuffer
Expand All @@ -29,13 +30,13 @@ import org.codehaus.groovy.antlr.java.JavaRecognizer
import org.codehaus.groovy.antlr.parser.GroovyLexer
import org.codehaus.groovy.antlr.parser.GroovyRecognizer
import org.codehaus.groovy.antlr.treewalker.PreOrderTraversal
import org.codehaus.groovy.antlr.treewalker.SourceCodeTraversal
import org.codehaus.groovy.antlr.treewalker.Visitor
import org.codehaus.groovy.ast.ModuleNode
import org.codehaus.groovy.control.*
import org.codehaus.groovy.groovydoc.GroovyClassDoc
import org.codehaus.groovy.groovydoc.GroovyRootDoc
import org.codehaus.groovy.runtime.ResourceGroovyMethods
import org.codehaus.groovy.tools.groovydoc.LinkArgument
import org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDocAssembler
import org.codehaus.groovy.tools.groovydoc.SimpleGroovyExecutableMemberDoc
import org.codehaus.groovy.tools.groovydoc.SimpleGroovyPackageDoc
import org.codehaus.groovy.tools.groovydoc.SimpleGroovyRootDoc
Expand Down Expand Up @@ -68,32 +69,56 @@ class DslGroovyRootDocBuilder {
JavaLexer lexer = new JavaLexer(unicodeReader)
unicodeReader.setLexer(lexer)
parser = JavaRecognizer.make(lexer)
parser.setSourceBuffer(sourceBuffer)
parser.compilationUnit()
} else {
GroovyLexer lexer = new GroovyLexer(unicodeReader)
unicodeReader.setLexer(lexer)
parser = GroovyRecognizer.make(lexer)
parser.setSourceBuffer(sourceBuffer)
parser.compilationUnit()
}

AST ast = parser.getAST()
if (isJava) {
// modify the Java AST into ssh Groovy AST (just token types)
Visitor java2groovyConverter = new Java2GroovyConverter(parser.getTokenNames())
AntlrASTProcessor java2groovyTraverser = new PreOrderTraversal(java2groovyConverter)
java2groovyTraverser.process(ast)

// now mutate (groovify) the ast into groovy
Visitor groovifier = new Groovifier(parser.getTokenNames(), false)
AntlrASTProcessor groovifierTraverser = new PreOrderTraversal(groovifier)
groovifierTraverser.process(ast)
if (isJava) {
parser.setSourceBuffer(sourceBuffer)
parser.compilationUnit()
AST ast = parser.getAST()

// modify the Java AST into a Groovy AST (just token types)
Visitor java2groovyConverter = new Java2GroovyConverter(parser.getTokenNames())
AntlrASTProcessor java2groovyTraverser = new PreOrderTraversal(java2groovyConverter)
java2groovyTraverser.process(ast)

// now mutate (groovify) the ast into groovy
Visitor groovifier = new Groovifier(parser.getTokenNames(), false)
AntlrASTProcessor groovifierTraverser = new PreOrderTraversal(groovifier)
groovifierTraverser.process(ast)
}

CompilerConfiguration config = new CompilerConfiguration()
config.getOptimizationOptions().put(CompilerConfiguration.GROOVYDOC, true)
CompilationUnit compUnit = new CompilationUnit(config)
SourceUnit unit = new SourceUnit(file, src, config, null, new ErrorCollector(config));
compUnit.addSource(unit);
int phase = Phases.CONVERSION;
if (properties.containsKey("phaseOverride")) {
String raw = properties.getProperty("phaseOverride")
try {
phase = Integer.parseInt(raw)
} catch(NumberFormatException ignore) {
raw = raw.toUpperCase();
switch(raw) {
// some dup here but kept simple since we may swap Phases to an enum
case "CONVERSION": phase = 3; break;
case "SEMANTIC_ANALYSIS": phase = 4; break;
case "CANONICALIZATION": phase = 5; break;
case "INSTRUCTION_SELECTION": phase = 6; break;
case "CLASS_GENERATION": phase = 7; break;
default:
System.err.println("Ignoring unrecognised or unsuitable phase and keeping default");
}
}
}
Visitor visitor = new SimpleGroovyClassDocAssembler(packagePath, file, sourceBuffer, links, properties, !isJava)
AntlrASTProcessor traverser = new SourceCodeTraversal(visitor)
traverser.process(ast)
return ((SimpleGroovyClassDocAssembler)visitor).getGroovyClassDocs()
compUnit.compile(phase);
ModuleNode root = unit.getAST()
GroovydocVisitor visitor = new GroovydocVisitor(unit, packagePath, links, properties)
root.getClasses().forEach(clazz -> visitor.visitClass(clazz))
return visitor.getGroovyClassDocs()
}

protected void setOverview() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright ish group pty ltd 2024.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*/

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.groovy.antlr.override;

import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport;
import org.codehaus.groovy.util.ArrayIterator;

/**
* Defines new groovy methods which appear on arrays inside the Groovy environment.
* Static methods are used with the first parameter being the destination class,
* i.e. <code>public static int[] each(int[] self, Closure closure)</code>
* provides an <code>each({i -> })</code> method for <code>int[]</code>.
* <p>
* NOTE: While this class contains many 'public' static methods, it is
* primarily regarded as an internal class (its internal package name
* suggests this also). We value backwards compatibility of these
* methods when used within Groovy but value less backwards compatibility
* at the Java method call level. I.e. future versions of Groovy may
* remove or move a method call in this file but would normally
* aim to keep the method available from within Groovy.
*/

// TODO: Remove after update Groovy v4, this part of code is taken from this version

public class ArrayGroovyMethods extends DefaultGroovyMethodsSupport {

private ArrayGroovyMethods() {
}

/**
* Concatenates the string representation of each item in this array,
* with the given String as a separator between each item.
*
* <pre class="groovyTestCase">
* Serializable[] array = [1,2L,-3G]
* assert array.join("+") == "1+2+-3"
* </pre>
*
* @param self an array of Object
* @param separator a String separator
* @return the joined String
* @since 1.0
*/
public static String join(Object[] self, String separator) {
return DefaultGroovyMethods.join(new ArrayIterator<>(self), separator);
}
}
Loading
Loading