Skip to content

Commit

Permalink
JDK 11+ - update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Mar 31, 2023
1 parent 5796b80 commit ee80641
Show file tree
Hide file tree
Showing 25 changed files with 274 additions and 163 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/maven-master-pulls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR build - master

on:
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11 ]

steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B -U verify --file pom.xml
70 changes: 70 additions & 0 deletions .github/workflows/maven-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: PR build - master

on:
push:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11 ]

steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Docker Login
run: |
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
set -e
- uses: s4u/maven-settings-action@v2.8.0
name: setup maven settings.xml
with:
servers: |
[{
"id": "sonatype-nexus-staging",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
},
{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}]
- name: Build with Maven
run: |
export MY_POM_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
- name: Build with Maven
run: mvn -B -U verify --file pom.xml
- name: Deploy Maven Snapshot
if: ${{ matrix.java == 11 }}
run: |
export MY_POM_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
./mvnw clean deploy -U --settings $HOME/.m2/settings.xml
docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME:unstable ./modules/swagger-generator
docker tag $DOCKER_GENERATOR_IMAGE_NAME:unstable
docker push $DOCKER_GENERATOR_IMAGE_NAME:unstable
docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable ./modules/swagger-codegen-cli
docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable
docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME:unstable
else
echo "not deploying release nor building and pushing release docker image: " ${MY_POM_VERSION}
fi
14 changes: 7 additions & 7 deletions .github/workflows/test-generation-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
java: [ 8 ]
java: [ 11 ]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

strategy:
matrix:
java: [ 8 ]
java: [ 11 ]


outputs:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
###############################################
matrix:
ruby: ['2.2']
java: [ 8 ]
java: [ 11 ]
###############################################
##### END DYNAMIC: Dependent on build environment
###############################################
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:

strategy:
matrix:
java: [ 8 ]
java: [ 11 ]


outputs:
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
###############################################
matrix:
node-version: [12.x]
java: [ 8 ]
java: [ 11 ]
###############################################
##### END DYNAMIC: Dependent on build environment
###############################################
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:

strategy:
matrix:
java: [ 8 ]
java: [ 11 ]


outputs:
Expand Down Expand Up @@ -369,7 +369,7 @@ jobs:
###############################################
matrix:
node-version: [12.x]
java: [ 8 ]
java: [ 11 ]
###############################################
##### END DYNAMIC: Dependent on build environment
###############################################
Expand Down
15 changes: 8 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# for CI with appveyor.yml
# Ref: http://www.yegor256.com/2015/01/10/windows-appveyor-maven.html
version: '{branch}-{build}'
os: Windows Server 2012
skip_branch_with_pr: true
hosts:
petstore.swagger.io: 127.0.0.1
Expand All @@ -10,19 +9,17 @@ install:
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip',
'https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
}
- cmd: SET PATH=C:\maven\apache-maven-3.5.4\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g
- cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g
- cmd: SET M2_HOME=C:\maven\apache-maven-3.5.4
- cmd: SET JAVA_HOME="C:\Program Files\Java\jdk11"
- cmd: SET PATH="C:\Program Files\Java\jdk11\bin";%PATH%
- cmd: dir/w
# - cmd: RMDIR "C:\projects\swagger-codegen\swagger-samples" /S /Q
- git clone https://github.com/wing328/swagger-samples
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.5.4\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
- ps: Start-Process "C:\Program Files (x86)\Apache\Maven\bin\mvn.cmd" -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
build_script:
# build C# API client
- nuget restore samples\client\petstore\csharp\SwaggerClient\IO.Swagger.sln
Expand All @@ -34,6 +31,10 @@ build_script:
- nuget restore samples\client\petstore\csharp\SwaggerClientNetStandard\IO.Swagger.sln
- msbuild samples\client\petstore\csharp\SwaggerClientNetStandard\IO.Swagger.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# install swagger codegen locally
- echo %JAVA_HOME%
- echo %PATH%
- set
- mvn --version
- mvn clean install --batch-mode
test_script:
# test c# API client
Expand Down
8 changes: 6 additions & 2 deletions modules/swagger-codegen-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<!-- <version>${testng-version}</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<!-- <version>${jmockit-version}</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,6 @@ private void setupAndRunTest(String specFlag, final String spec, String langFlag
new Expectations() {
{
CodegenConfigurator.fromFile(anyString);
result = null;

new CodegenConfigurator();
times = 1;
result = configurator;
}
};
Expand All @@ -522,19 +518,15 @@ private void setupAndRunTest(String specFlag, final String spec, String langFlag
{

configurator.toClientOptInput();
times = 1;
result = clientOptInput;
minTimes = 1;

new DefaultGenerator();
times = 1;
result = generator;
DefaultGenerator g = new DefaultGenerator();

generator.opts(clientOptInput);
times = 1;
result = generator;
g.opts(clientOptInput);
result = g;

generator.generate();
times = 1;
g.generate();

}
};
Expand Down
10 changes: 7 additions & 3 deletions modules/swagger-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<!-- <version>${testng-version}</version> -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -294,10 +293,15 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.8.47</version>
<version>${mockito-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public SpringCodegen() {
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files."));
cliOptions.add(CliOption.newBoolean(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern"));
cliOptions.add(CliOption.newBoolean(SINGLE_CONTENT_TYPES, "Whether to select only one produces/consumes content-type by operation."));
cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 features like the new date library"));
cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers"));
cliOptions.add(new CliOption(RESPONSE_WRAPPER, "wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)"));
cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void generatesCorrectDirectoryStructure() throws IOException {

IntegrationTestPathsConfig integrationTestPathsConfig = getIntegrationTestPathsConfig();

String specContent = Files.readFile(integrationTestPathsConfig.getSpecPath().toFile());
String specContent = Files.readFile(java.nio.file.Files.newInputStream(integrationTestPathsConfig.getSpecPath()));
Swagger swagger = new SwaggerParser().parse(specContent);

CodegenConfig codegenConfig = getCodegenConfig();
Expand Down
Loading

0 comments on commit ee80641

Please sign in to comment.