-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-250: Add integration tests for the includes/excludes functionality
- Loading branch information
Showing
12 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
protobuf-maven-plugin/src/it/gh-250-excludes/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (C) 2023 - 2024, Ashley Scopes. | ||
# | ||
# 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. | ||
# | ||
|
||
invoker.goals = clean package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2023 - 2024, Ashley Scopes. | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>protobuf-maven-plugin-parent</artifactId> | ||
<version>@project.version@</version> | ||
<relativePath>../../../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>gh-250-excludes</groupId> | ||
<artifactId>gh-250-excludes</artifactId> | ||
|
||
<properties> | ||
<protobuf.version>4.27.1</protobuf.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>${protobuf.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
|
||
<configuration> | ||
<protocVersion>${protobuf.version}</protocVersion> | ||
|
||
<excludes> | ||
<include>**/channel.proto</include> | ||
<include>**/message.proto</include> | ||
</excludes> | ||
</configuration> | ||
|
||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
protobuf-maven-plugin/src/it/gh-250-excludes/src/main/protobuf/org/example/channel.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright (C) 2023 - 2024, Ashley Scopes. | ||
// | ||
// 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. | ||
// | ||
|
||
syntax = "proto3"; | ||
|
||
package users; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.example"; | ||
|
||
message Channel { | ||
string id = 1; | ||
string name = 2; | ||
} |
32 changes: 32 additions & 0 deletions
32
protobuf-maven-plugin/src/it/gh-250-excludes/src/main/protobuf/org/example/message.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Copyright (C) 2023 - 2024, Ashley Scopes. | ||
// | ||
// 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. | ||
// | ||
|
||
syntax = "proto3"; | ||
|
||
package users; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.example"; | ||
|
||
import "org/example/user.proto"; | ||
import "org/example/channel.proto"; | ||
|
||
message Message { | ||
string id = 1; | ||
string content = 2; | ||
org.example.User author = 3; | ||
org.example.Channel channel = 4; | ||
} |
28 changes: 28 additions & 0 deletions
28
protobuf-maven-plugin/src/it/gh-250-excludes/src/main/protobuf/org/example/user.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Copyright (C) 2023 - 2024, Ashley Scopes. | ||
// | ||
// 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. | ||
// | ||
|
||
syntax = "proto3"; | ||
|
||
package users; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.example"; | ||
|
||
message User { | ||
string id = 1; | ||
string name = 2; | ||
optional string nickname = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2023 - 2024, Ashley Scopes. | ||
* | ||
* 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. | ||
*/ | ||
import java.nio.file.Path | ||
|
||
import static org.assertj.core.api.Assertions.assertThat | ||
|
||
Path baseDirectory = basedir.toPath().toAbsolutePath() | ||
Path generatedSourcesDir = baseDirectory.resolve("target/generated-sources/protobuf") | ||
def classesDir = baseDirectory.resolve("target/classes") | ||
def expectedGeneratedFiles = [ | ||
"org/example/User", | ||
] | ||
def expectedNotGeneratedFiles = [ | ||
"org/example/Channel", | ||
"org/example/Message", | ||
] | ||
|
||
assertThat(generatedSourcesDir).isDirectory() | ||
|
||
assertThat(classesDir).isDirectory() | ||
|
||
expectedGeneratedFiles.forEach { | ||
assertThat(generatedSourcesDir.resolve("${it}.java")) | ||
.exists() | ||
.isNotEmptyFile() | ||
assertThat(classesDir.resolve("${it}.class")) | ||
.exists() | ||
.isNotEmptyFile() | ||
} | ||
|
||
expectedNotGeneratedFiles.forEach { | ||
assertThat(generatedSourcesDir.resolve("${it}.java")) | ||
.doesNotExist() | ||
assertThat(classesDir.resolve("${it}.class")) | ||
.doesNotExist() | ||
} | ||
|
||
return true |
17 changes: 17 additions & 0 deletions
17
protobuf-maven-plugin/src/it/gh-250-includes/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (C) 2023 - 2024, Ashley Scopes. | ||
# | ||
# 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. | ||
# | ||
|
||
invoker.goals = clean package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2023 - 2024, Ashley Scopes. | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>protobuf-maven-plugin-parent</artifactId> | ||
<version>@project.version@</version> | ||
<relativePath>../../../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>gh-250-includes</groupId> | ||
<artifactId>gh-250-includes</artifactId> | ||
|
||
<properties> | ||
<protobuf.version>4.27.1</protobuf.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>${protobuf.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
|
||
<configuration> | ||
<protocVersion>${protobuf.version}</protocVersion> | ||
|
||
<includes> | ||
<include>**/user.proto</include> | ||
</includes> | ||
</configuration> | ||
|
||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
protobuf-maven-plugin/src/it/gh-250-includes/src/main/protobuf/org/example/channel.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright (C) 2023 - 2024, Ashley Scopes. | ||
// | ||
// 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. | ||
// | ||
|
||
syntax = "proto3"; | ||
|
||
package users; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.example"; | ||
|
||
message Channel { | ||
string id = 1; | ||
string name = 2; | ||
} |
32 changes: 32 additions & 0 deletions
32
protobuf-maven-plugin/src/it/gh-250-includes/src/main/protobuf/org/example/message.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Copyright (C) 2023 - 2024, Ashley Scopes. | ||
// | ||
// 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. | ||
// | ||
|
||
syntax = "proto3"; | ||
|
||
package users; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.example"; | ||
|
||
import "org/example/user.proto"; | ||
import "org/example/channel.proto"; | ||
|
||
message Message { | ||
string id = 1; | ||
string content = 2; | ||
org.example.User author = 3; | ||
org.example.Channel channel = 4; | ||
} |
Oops, something went wrong.