Skip to content

Commit a08180b

Browse files
committed
License and checkstyle
1 parent efb65b0 commit a08180b

File tree

8 files changed

+216
-20
lines changed

8 files changed

+216
-20
lines changed

canteen/canteen-bootstrap/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2019, Salesforce.com, Inc.
4+
~ All rights reserved.
5+
~ Licensed under the BSD 3-Clause license.
6+
~ For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7+
-->
8+
29
<project xmlns="http://maven.apache.org/POM/4.0.0"
310
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
411
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

canteen/canteen-it/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2019, Salesforce.com, Inc.
4+
~ All rights reserved.
5+
~ Licensed under the BSD 3-Clause license.
6+
~ For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7+
-->
8+
29
<project xmlns="http://maven.apache.org/POM/4.0.0"
310
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
411
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

canteen/canteen-it/src/main/java/com/salesforce/servicelibs/canteen/it/Main.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
/*
2+
* Copyright (c) 2019, Salesforce.com, Inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
18
package com.salesforce.servicelibs.canteen.it;
29

310
import java.io.BufferedReader;
411
import java.io.InputStreamReader;
512

6-
public class Main {
13+
public final class Main {
14+
private Main() { }
15+
16+
private static final int THE_ANSWER_TO_EVERYTHING = 42;
17+
718
public static void main(String[] args) throws Exception {
819
String choice;
920

@@ -20,7 +31,7 @@ public static void main(String[] args) throws Exception {
2031
System.exit(0);
2132
} else {
2233
System.err.println("failure");
23-
System.exit(42);
34+
System.exit(THE_ANSWER_TO_EVERYTHING);
2435
}
2536
}
2637
}

canteen/canteen-it/src/test/java/com/salesforce/servicelibs/canteen/it/CanteenExecutableIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019, Salesforce.com, Inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
18
package com.salesforce.servicelibs.canteen.it;
29

310
import org.codehaus.plexus.util.cli.CommandLineUtils;

canteen/canteen-it/src/test/java/com/salesforce/servicelibs/canteen/it/CanteenImageIT.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
/*
2+
* Copyright (c) 2019, Salesforce.com, Inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
18
package com.salesforce.servicelibs.canteen.it;
29

310
import org.junit.Test;
411

512
import java.io.File;
613
import java.io.FileInputStream;
714
import java.io.IOException;
8-
import java.nio.charset.Charset;
915
import java.nio.charset.StandardCharsets;
1016
import java.util.Arrays;
1117

canteen/canteen-maven-plugin/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2019, Salesforce.com, Inc.
4+
~ All rights reserved.
5+
~ Licensed under the BSD 3-Clause license.
6+
~ For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7+
-->
8+
29
<project xmlns="http://maven.apache.org/POM/4.0.0"
310
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
411
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -39,4 +46,6 @@
3946
<scope>provided</scope>
4047
</dependency>
4148
</dependencies>
49+
50+
4251
</project>

canteen/canteen-maven-plugin/src/main/java/com/salesforce/servicelibs/canteen/BootstrapMojo.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
/*
2+
* Copyright (c) 2019, Salesforce.com, Inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
18
package com.salesforce.servicelibs.canteen;
29

310
import com.google.common.io.ByteStreams;
4-
import com.google.common.io.Files;
511
import org.apache.maven.artifact.Artifact;
612
import org.apache.maven.artifact.repository.ArtifactRepository;
713
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@@ -29,53 +35,53 @@
2935
import static java.util.Collections.emptyMap;
3036
import static java.util.Collections.singleton;
3137

32-
@Mojo( name = "bootstrap", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
38+
@Mojo(name = "bootstrap", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
3339
public class BootstrapMojo extends AbstractMojo {
3440
private static final String CANTEEN_BOOTSTRAP = "canteen-bootstrap";
3541
private static final List<String> PLATFORMS = Arrays.asList("osx-x86_64", "linux-x86_64", "windows-x86_64");
3642

3743
@Component
38-
protected RepositorySystem repositorySystem;
44+
private RepositorySystem repositorySystem;
3945

4046
@Component
41-
protected ResolutionErrorHandler resolutionErrorHandler;
47+
private ResolutionErrorHandler resolutionErrorHandler;
4248

4349
@Component
4450
private MavenProjectHelper projectHelper;
4551

46-
@Parameter( defaultValue = "${plugin}", readonly = true ) // Maven 3 only
47-
protected PluginDescriptor plugin;
52+
@Parameter(defaultValue = "${plugin}", readonly = true)
53+
private PluginDescriptor plugin;
4854

4955
@Parameter(defaultValue = "${project}", readonly = true, required = true)
50-
protected MavenProject project;
56+
private MavenProject project;
5157

5258
@Parameter(defaultValue = "${session}", readonly = true, required = true)
53-
protected MavenSession session;
59+
private MavenSession session;
5460

5561
@Parameter(required = true, readonly = true, property = "localRepository")
56-
protected ArtifactRepository localRepository;
62+
private ArtifactRepository localRepository;
5763

5864
@Parameter(required = true, readonly = true, defaultValue = "${project.remoteArtifactRepositories}")
59-
protected List<ArtifactRepository> remoteRepositories;
65+
private List<ArtifactRepository> remoteRepositories;
6066

6167
@Parameter(defaultValue = "${project.build.directory}", required = true)
62-
protected File outputDirectory;
68+
private File outputDirectory;
6369

6470
@Parameter(defaultValue = "${project.build.finalName}", readonly = true)
65-
protected String finalName;
71+
private String finalName;
6672

6773
/**
6874
* The directory (typically under /target) where Canteen bootstrap binaries are temporarily staged.
6975
*/
7076
@Parameter(required = true, defaultValue = "${project.build.directory}/" + CANTEEN_BOOTSTRAP)
71-
protected File canteenBootstrapDirectory;
77+
private File canteenBootstrapDirectory;
7278

7379
/**
7480
* Classifier to use when locating the artifact to bootstrap. If no classifier is provided, the module default
7581
* artifact will be used.
7682
*/
7783
@Parameter(required = false)
78-
protected String classifier;
84+
private String classifier;
7985

8086
@Override
8187
public void execute() throws MojoExecutionException, MojoFailureException {
@@ -208,8 +214,8 @@ private Artifact getSourceArtifact() {
208214
private Artifact getArtifact(String classifier) {
209215
if (classifier != null) {
210216
for (Artifact attachedArtifact : this.project.getAttachedArtifacts()) {
211-
if (classifier.equals(attachedArtifact.getClassifier()) && attachedArtifact.getFile() != null
212-
&& attachedArtifact.getFile().isFile()) {
217+
if (classifier.equals(attachedArtifact.getClassifier()) && attachedArtifact.getFile() != null &&
218+
attachedArtifact.getFile().isFile()) {
213219
return attachedArtifact;
214220
}
215221
}

canteen/pom.xml

Lines changed: 144 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2019, Salesforce.com, Inc.
4+
~ All rights reserved.
5+
~ Licensed under the BSD 3-Clause license.
6+
~ For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7+
-->
8+
29
<project xmlns="http://maven.apache.org/POM/4.0.0"
310
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
411
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -7,8 +14,28 @@
714
<groupId>com.salesforce.servicelibs</groupId>
815
<artifactId>canteen-parent</artifactId>
916
<packaging>pom</packaging>
10-
1117
<version>0.1.0-SNAPSHOT</version>
18+
19+
<name>Canteen</name>
20+
<description>A Maven plugin for generating self-executing jars</description>
21+
<url>https://github.com/salesforce/grpc-java-contrib</url>
22+
23+
<licenses>
24+
<license>
25+
<name>BSD 3-Clause License</name>
26+
<url>https://github.com/salesforce/grpc-java-contrib/blob/master/LICENSE</url>
27+
<distribution>repo</distribution>
28+
</license>
29+
</licenses>
30+
31+
<developers>
32+
<developer>
33+
<id>rmichela</id>
34+
<name>Ryan Michela</name>
35+
<email>rmichela@salesforce.com</email>
36+
</developer>
37+
</developers>
38+
1239
<modules>
1340
<module>canteen-bootstrap</module>
1441
<module>canteen-maven-plugin</module>
@@ -17,9 +44,125 @@
1744

1845
<properties>
1946
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
47+
<gitRepo>scm:git:git@github.com:salesforce/grpc-java-contrib.git</gitRepo>
48+
<mavenRepoId>ossrh</mavenRepoId>
49+
<mavenBaseUrl>https://oss.sonatype.org/content/repositories</mavenBaseUrl>
2050

2151
<java.version>1.8</java.version>
2252
<maven.compiler.source>${java.version}</maven.compiler.source>
2353
<maven.compiler.target>${java.version}</maven.compiler.target>
2454
</properties>
55+
56+
<scm>
57+
<url>https://github.com/salesforce/grpc-java-contrib</url>
58+
<connection>${gitRepo}</connection>
59+
<developerConnection>${gitRepo}</developerConnection>
60+
</scm>
61+
62+
<build>
63+
<plugins>
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-checkstyle-plugin</artifactId>
67+
<version>3.0.0</version>
68+
<dependencies>
69+
<dependency>
70+
<groupId>com.puppycrawl.tools</groupId>
71+
<artifactId>checkstyle</artifactId>
72+
<version>8.21</version>
73+
</dependency>
74+
</dependencies>
75+
<executions>
76+
<execution>
77+
<phase>process-sources</phase>
78+
<goals>
79+
<goal>check</goal>
80+
</goals>
81+
</execution>
82+
</executions>
83+
<configuration>
84+
<failsOnError>true</failsOnError>
85+
<failOnViolation>true</failOnViolation>
86+
<consoleOutput>true</consoleOutput>
87+
<configLocation>../checkstyle.xml</configLocation>
88+
<suppressionsLocation>../checkstyle_ignore.xml</suppressionsLocation>
89+
</configuration>
90+
</plugin>
91+
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-javadoc-plugin</artifactId>
95+
<version>3.1.0</version>
96+
<executions>
97+
<execution>
98+
<id>attach-javadocs</id>
99+
<goals>
100+
<goal>jar</goal>
101+
</goals>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-source-plugin</artifactId>
109+
<version>3.0.1</version>
110+
<executions>
111+
<execution>
112+
<id>attach-sources</id>
113+
<goals>
114+
<goal>jar</goal>
115+
</goals>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
122+
<distributionManagement>
123+
<repository>
124+
<id>${mavenRepoId}</id>
125+
<url>${mavenBaseUrl}/releases</url>
126+
</repository>
127+
<snapshotRepository>
128+
<id>${mavenRepoId}</id>
129+
<url>${mavenBaseUrl}/snapshots</url>
130+
</snapshotRepository>
131+
</distributionManagement>
132+
133+
<profiles>
134+
<profile>
135+
<id>public-release</id>
136+
<build>
137+
<plugins>
138+
<plugin>
139+
<groupId>org.apache.maven.plugins</groupId>
140+
<artifactId>maven-gpg-plugin</artifactId>
141+
<version>1.6</version>
142+
<executions>
143+
<execution>
144+
<id>sign-artifacts</id>
145+
<phase>verify</phase>
146+
<goals>
147+
<goal>sign</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
</plugin>
152+
153+
<plugin>
154+
<groupId>org.sonatype.plugins</groupId>
155+
<artifactId>nexus-staging-maven-plugin</artifactId>
156+
<version>1.6.8</version>
157+
<extensions>true</extensions>
158+
<configuration>
159+
<serverId>ossrh</serverId>
160+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
161+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
162+
</configuration>
163+
</plugin>
164+
</plugins>
165+
</build>
166+
</profile>
167+
</profiles>
25168
</project>

0 commit comments

Comments
 (0)