Skip to content

Commit 551323f

Browse files
committed
classifierWithLikes breaks protobuf-gradle-plugin
It causes it to try to download protoc with _fedora in its classifier.
1 parent 9987aa2 commit 551323f

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

SECURITY.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven-
5252

5353
```xml
5454
<project>
55-
<properties>
56-
<!-- Configure the os-maven-plugin extension to expand the classifier on -->
57-
<!-- Fedora-"like" systems. -->
58-
<os.detection.classifierWithLikes>fedora</os.detection.classifierWithLikes>
59-
</properties>
60-
6155
<dependencies>
6256
<dependency>
6357
<groupId>io.netty</groupId>
@@ -76,6 +70,31 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven-
7670
<version>1.4.0.Final</version>
7771
</extension>
7872
</extensions>
73+
<plugins>
74+
<!-- Use Ant to configure the appropriate "tcnative.classifier" property -->
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-antrun-plugin</artifactId>
78+
<executions>
79+
<execution>
80+
<phase>initialize</phase>
81+
<configuration>
82+
<exportAntProperties>true</exportAntProperties>
83+
<target>
84+
<condition property="tcnative.classifier"
85+
value="${os.detected.classifier}-fedora"
86+
else="${os.detected.classifier}">
87+
<isset property="os.detected.release.fedora"/>
88+
</condition>
89+
</target>
90+
</configuration>
91+
<goals>
92+
<goal>run</goal>
93+
</goals>
94+
</execution>
95+
</executions>
96+
</plugin>
97+
</plugins>
7998
</build>
8099
</project>
81100
```
@@ -97,11 +116,15 @@ buildscript {
97116
// Use the osdetector-gradle-plugin
98117
apply plugin: "com.google.osdetector"
99118
100-
// Configure a special classifier on Fedora-"like" systems.
101-
osdetector.classifierWithLikes = ['fedora']
119+
def tcnative_classifier = osdetector.classifier;
120+
// Fedora variants use a different soname for OpenSSL than other linux distributions
121+
// (see http://netty.io/wiki/forked-tomcat-native.html).
122+
if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) {
123+
tcnative_classifier += "_fedora";
124+
}
102125
103126
dependencies {
104-
compile 'io.netty:netty-tcnative:1.1.33.Fork7:' + osdetector.classifier
127+
compile 'io.netty:netty-tcnative:1.1.33.Fork7:' + tcnative_classifier
105128
}
106129
```
107130

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ subprojects {
1717
apply plugin: "jacoco"
1818

1919
apply plugin: "com.google.osdetector"
20-
// Configure a special classifier on Fedora-"like" systems.
21-
osdetector.classifierWithLikes = ['fedora']
2220

2321
group = "io.grpc"
2422
version = "0.10.0-SNAPSHOT"
@@ -112,6 +110,13 @@ subprojects {
112110
}
113111
}
114112

113+
def tcnative_suffix = osdetector.classifier;
114+
// Fedora variants use a different soname for OpenSSL than other linux distributions
115+
// (see http://netty.io/wiki/forked-tomcat-native.html).
116+
if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) {
117+
tcnative_suffix += "_fedora";
118+
}
119+
115120
def epoll_suffix = "";
116121
if (osdetector.classifier in ["linux-x86_64"]) {
117122
// The native code is only pre-compiled on certain platforms.
@@ -131,7 +136,7 @@ subprojects {
131136
protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.7.0',
132137

133138
netty: 'io.netty:netty-codec-http2:4.1.0.Beta6',
134-
netty_tcnative: 'io.netty:netty-tcnative:1.1.33.Fork7:' + osdetector.classifier,
139+
netty_tcnative: 'io.netty:netty-tcnative:1.1.33.Fork7:' + tcnative_suffix,
135140
netty_transport_native_epoll: 'io.netty:netty-transport-native-epoll:4.1.0.Beta6' + epoll_suffix,
136141

137142
// Test dependencies.

0 commit comments

Comments
 (0)