Skip to content

Commit 214089d

Browse files
Creating google-cloud-compat-checker
1 parent 94f395e commit 214089d

4 files changed

Lines changed: 177 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Google Cloud Java Compatibility Checker
2+
==========================
3+
4+
Usage:
5+
6+
```
7+
git clone https://github.com/GoogleCloudPlatform/google-cloud-java.git
8+
cd google-cloud-java/google-cloud-compat-checker
9+
mvn install
10+
mvn exec:java
11+
```
12+
13+
The output should look something like this:
14+
15+
```
16+
OS details:
17+
os.detected.name: linux
18+
os.detected.arch: x86_64
19+
os.detected.classifier: linux-x86_64
20+
os.detected.release: ubuntu
21+
os.detected.release.version: 14.04
22+
Checking compatibility...
23+
This OS + architecture is supported by Forked Tomcat Native.
24+
Result: UNKNOWN (checker implementation not complete)
25+
```
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>google-cloud-compat-checker</artifactId>
5+
<version>0.21.2-alpha-SNAPSHOT</version>
6+
<packaging>jar</packaging>
7+
<name>Google Cloud Java Compatibility Checker</name>
8+
<url>https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-compat-checker</url>
9+
<description>
10+
Compatibility checker for Google Cloud Java.
11+
</description>
12+
<parent>
13+
<groupId>com.google.cloud</groupId>
14+
<artifactId>google-cloud-pom</artifactId>
15+
<version>0.21.2-alpha-SNAPSHOT</version>
16+
</parent>
17+
<properties>
18+
<site.installationModule>google-cloud-compat-checker</site.installationModule>
19+
<artifact.version>${project.version}</artifact.version>
20+
</properties>
21+
<dependencies>
22+
<dependency>
23+
<groupId>io.netty</groupId>
24+
<artifactId>netty-tcnative-boringssl-static</artifactId>
25+
<version>2.0.3.Final</version>
26+
</dependency>
27+
<dependency>
28+
<!-- It may look weird to have a compile dependency on a plugin,
29+
but we want to execute code from it at runtime, in order
30+
to not duplicate the logic ourselves -->
31+
<groupId>kr.motd.maven</groupId>
32+
<artifactId>os-maven-plugin</artifactId>
33+
<version>1.4.0.Final</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.codehaus.plexus</groupId>
37+
<artifactId>plexus-utils</artifactId>
38+
</dependency>
39+
</dependencies>
40+
<dependencyManagement>
41+
<dependencies>
42+
<dependency>
43+
<groupId>org.codehaus.plexus</groupId>
44+
<artifactId>plexus-utils</artifactId>
45+
<version>3.0.17</version>
46+
</dependency>
47+
</dependencies>
48+
</dependencyManagement>
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<version>3.5.1</version>
54+
<configuration>
55+
<source>1.7</source>
56+
<target>1.7</target>
57+
<encoding>UTF-8</encoding>
58+
<compilerArgument>-Xlint:unchecked</compilerArgument>
59+
</configuration>
60+
</plugin>
61+
<plugin>
62+
<groupId>org.codehaus.mojo</groupId>
63+
<artifactId>exec-maven-plugin</artifactId>
64+
<version>1.6.0</version>
65+
<executions>
66+
<execution>
67+
<goals>
68+
<goal>java</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
<configuration>
73+
<mainClass>com.google.cloud.compatchecker.GoogleCloudCompatChecker</mainClass>
74+
<skip>false</skip>
75+
</configuration>
76+
</plugin>
77+
</plugins>
78+
</build>
79+
</project>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2017 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.compatchecker;
17+
18+
import com.google.common.collect.ImmutableSet;
19+
import com.google.common.collect.Lists;
20+
import java.util.List;
21+
import java.util.Properties;
22+
import java.util.Set;
23+
import kr.motd.maven.os.Detector;
24+
25+
public class GoogleCloudCompatChecker {
26+
private static Set<String> supportedClassifiers =
27+
ImmutableSet.of("linux-x86_64", "osx-x86_64", "windows-x86_64");
28+
29+
private static class OsDetector extends Detector {
30+
public void detect(Properties props, List<String> classifierWithLikes) {
31+
super.detect(props, classifierWithLikes);
32+
}
33+
34+
@Override
35+
protected void log(String s) {
36+
// meh
37+
}
38+
39+
@Override
40+
protected void logProperty(String s, String s1) {
41+
// meh
42+
}
43+
}
44+
45+
public static void main(String[] args) {
46+
Properties osProperties = new Properties();
47+
new OsDetector().detect(osProperties, Lists.<String>newArrayList());
48+
System.out.println("OS details:");
49+
System.out.println(" " + Detector.DETECTED_NAME + ": " + osProperties.get(Detector.DETECTED_NAME));
50+
System.out.println(" " + Detector.DETECTED_ARCH + ": " + osProperties.get(Detector.DETECTED_ARCH));
51+
System.out.println(" " + Detector.DETECTED_CLASSIFIER + ": " + osProperties.get(Detector.DETECTED_CLASSIFIER));
52+
System.out.println(" " + Detector.DETECTED_RELEASE + ": " + osProperties.get(Detector.DETECTED_RELEASE));
53+
System.out.println(" " + Detector.DETECTED_RELEASE_VERSION + ": " + osProperties.get(Detector.DETECTED_RELEASE_VERSION));
54+
55+
String osClassifier = (String)osProperties.get(Detector.DETECTED_CLASSIFIER);
56+
57+
boolean compatible = true;
58+
System.out.println("Checking compatibility...");
59+
if (supportedClassifiers.contains(osClassifier)) {
60+
System.out.println(" This OS + architecture is supported by Forked Tomcat Native.");
61+
} else {
62+
System.out.println(" This OS + architecture is NOT supported by Forked Tomcat Native.");
63+
System.out.println(" See http://netty.io/wiki/forked-tomcat-native.html for details.");
64+
compatible = false;
65+
}
66+
if (!compatible) {
67+
System.out.println("Result: FAIL");
68+
} else {
69+
System.out.println("Result: UNKNOWN (checker implementation not complete)");
70+
}
71+
}
72+
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@
828828
<module>google-cloud-video-intelligence</module>
829829

830830
<module>google-cloud-dep-verification</module>
831+
<module>google-cloud-compat-checker</module>
831832

832833
<!--
833834
Uncomment the following lines to include google app engine (GAE) testing apps in the build.

0 commit comments

Comments
 (0)