-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source.getLocation may return either a URI or a file path, protect ag…
- Loading branch information
Showing
10 changed files
with
328 additions
and
4 deletions.
There are no files selected for viewing
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
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,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) | ||
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> | ||
|
||
<groupId>fr.brouillard.oss.it</groupId> | ||
<artifactId>issue-30-pre</artifactId> | ||
<version>0</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<description>Build a jar file and install it without POM inside the repository</description> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
<executions> | ||
<execution> | ||
<id>install-jar-without-pom</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>install-file</goal> | ||
</goals> | ||
<configuration> | ||
<file>${project.build.directory}/${project.build.finalName}.jar</file> | ||
<groupId>fr.brouillard.oss.it</groupId> | ||
<artifactId>int-set-builder</artifactId> | ||
<version>0.4</version> | ||
<packaging>jar</packaging> | ||
<generatePom>false</generatePom> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
32 changes: 32 additions & 0 deletions
32
src/it/issues/issue-30-pre/src/main/java/outside/IntSetBuilder.java
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 @@ | ||
// @formatter:off | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) | ||
* | ||
* 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. | ||
*/ | ||
// @formatter:on | ||
|
||
package outside; | ||
|
||
public class IntSetBuilder | ||
extends java.util.HashSet<Integer> | ||
implements java.util.function.IntConsumer | ||
{ | ||
public long accepted = 0; | ||
|
||
public void accept( int i ) | ||
{ | ||
++ accepted; | ||
add( i ); | ||
} | ||
} |
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,25 @@ | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) | ||
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. | ||
--> | ||
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd"> | ||
<extension> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
</extension> | ||
</extensions> |
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 @@ | ||
invoker.goals = install project-info-reports:dependencies |
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,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) | ||
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> | ||
|
||
<groupId>fr.brouillard.oss.it</groupId> | ||
<artifactId>issue-30</artifactId> | ||
<version>0</version> | ||
|
||
<description>NullPointerException in JGitverModelProcessor.provisionModel when POM unavailable.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>fr.brouillard.oss.it</groupId> | ||
<artifactId>int-set-builder</artifactId> | ||
<version>0.4</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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,53 @@ | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
* | ||
* 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. | ||
*/ | ||
|
||
def log = new PrintWriter( new File(basedir, "prebuild.log").newWriter("UTF-8"), true ) | ||
log.println( "Prebuild started at: " + new Date() + " in: " + basedir ) | ||
|
||
[ | ||
|
||
"git --version", | ||
"rm -rf .git", | ||
"git init", | ||
"git config user.name nobody", | ||
"git config user.email [email protected]", | ||
"echo A > content", | ||
"git add .", | ||
"git commit --message=initial_commit", | ||
"git tag -a 1.0.0 --message=release_1.0.0", | ||
"echo B > content", | ||
"git add -u", | ||
"git commit --message=added_B_data", | ||
"git log --graph --oneline" | ||
|
||
].each{ command -> | ||
|
||
def proc = command.execute(null, basedir) | ||
def sout = new StringBuilder(), serr = new StringBuilder() | ||
proc.waitForProcessOutput(sout, serr) | ||
|
||
log.println( "cmd: " + command ) | ||
log.println( "out:" ) ; log.println( sout.toString().trim() ) | ||
log.println( "err:" ) ; log.println( serr.toString().trim() ) | ||
log.println( "ret: " + proc.exitValue() ) | ||
|
||
assert proc.exitValue() == 0 | ||
|
||
} | ||
|
||
log.println( "Prebuild completed at: " + new Date() ) | ||
log.close() | ||
return true |
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,39 @@ | ||
// @formatter:off | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] ([email protected]) | ||
* | ||
* 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. | ||
*/ | ||
// @formatter:on | ||
|
||
package inside; | ||
|
||
import outside.IntSetBuilder; | ||
|
||
public class Main | ||
{ | ||
public static double codePointsOverLength( String value ) | ||
{ | ||
IntSetBuilder isb = new IntSetBuilder(); | ||
value.codePoints().forEach( isb ); | ||
return isb.size() / (double) isb.accepted; | ||
} | ||
|
||
public static void main( String[] args ) | ||
{ | ||
String value = args.length > 0 | ||
? String.join( " ", java.util.Arrays.asList(args) ) | ||
: "The quick brown fox jumps over the lazy dog."; | ||
System.out.println( codePointsOverLength(value) + " " + value ); | ||
} | ||
} |
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,54 @@ | ||
/** | ||
* Copyright (C) 2016 Matthieu Brouillard [http://oss.brouillard.fr/jgitver-maven-plugin] (matthieu@brouillard.fr) | ||
* | ||
* 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. | ||
*/ | ||
|
||
def log = new PrintWriter( new File(basedir, "verify.log").newWriter("UTF-8"), true ) | ||
log.println( "Verify started at: " + new Date() + " in: " + basedir ) | ||
|
||
[ | ||
"rm -rf .git" | ||
].each{ command -> | ||
|
||
def proc = command.execute(null, basedir) | ||
def sout = new StringBuilder(), serr = new StringBuilder() | ||
proc.waitForProcessOutput(sout, serr) | ||
|
||
log.println( "cmd: " + command ) | ||
log.println( "out:" ) ; log.println( sout.toString().trim() ) | ||
log.println( "err:" ) ; log.println( serr.toString().trim() ) | ||
log.println( "ret: " + proc.exitValue() ) | ||
|
||
assert proc.exitValue() == 0 | ||
|
||
} | ||
|
||
def buildLog = new File(basedir, "build.log").readLines() | ||
|
||
// Check the version was used by the plugin execution | ||
def versionChanges = buildLog.findAll { it =~ /fr.brouillard.oss.it::issue-30::0 -> 1.0.1-SNAPSHOT/ } | ||
log.println( "versionChanges: " + versionChanges ) | ||
assert 0 < versionChanges.size() | ||
|
||
// And check that the produced artifact was installed with the good version | ||
File installedPomFile = new File(localRepositoryPath, "fr/brouillard/oss/it/issue-30/1.0.1-SNAPSHOT/issue-30-1.0.1-SNAPSHOT.pom") | ||
log.println( "installedPomFile: " + installedPomFile.isFile() + " " + installedPomFile ) | ||
assert installedPomFile.isFile() | ||
def installedPomFileVersion = installedPomFile.readLines().findAll { it =~ /<version>1.0.1-SNAPSHOT<\/version>/ } | ||
log.println( "installedPomFileVersion: " + installedPomFileVersion ) | ||
assert 1 == installedPomFileVersion.size() | ||
|
||
log.println( "Verify completed at: " + new Date() ) | ||
log.close() | ||
return true |
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