-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from RA-Consulting-GmbH/misc
Misc changes to versioning
- Loading branch information
Showing
9 changed files
with
83 additions
and
14 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
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
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
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
63 changes: 63 additions & 0 deletions
63
...rac.openscenario.generator/src/main/java/de/rac/generator/main/util/CountCodeLines.groovy
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,63 @@ | ||
package de.rac.generator.main.util | ||
|
||
import java.nio.file.FileVisitResult; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.SimpleFileVisitor; | ||
|
||
import java.nio.file.StandardCopyOption | ||
import java.nio.file.attribute.BasicFileAttributes | ||
|
||
|
||
|
||
|
||
class CountCodeLines { | ||
|
||
static int linesOfCode = 0; | ||
static int linesOfGeneratedCode = 0; | ||
static void main(String[] args) | ||
{ | ||
if (args.length != 2) { | ||
println("Usage: CountCodeLines rootCodePath rootGeneratedCodePath"); | ||
System.exit(1); | ||
} | ||
|
||
List<File> codePaths = [new File(args[0]),new File(args[1])]; | ||
|
||
codePaths.each { directory -> | ||
try { | ||
|
||
println(countLinesFromFileTree(directory)); | ||
|
||
} catch (IOException e) { | ||
println("Cannot find directory ${directory}"); | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
} | ||
|
||
} | ||
|
||
public static int countLinesFromFileTree(File src) throws IOException { | ||
|
||
int lines = 0; | ||
if (src.exists()) { | ||
Files.walkFileTree(src.toPath(), new SimpleFileVisitor<Path>() { | ||
@Override | ||
public FileVisitResult visitFile(Path file, | ||
BasicFileAttributes attrs) throws IOException { | ||
|
||
BufferedReader reader = new BufferedReader(new FileReader(file.toString())); | ||
|
||
while (reader.readLine() != null) lines++; | ||
reader.close(); | ||
return FileVisitResult.CONTINUE; | ||
} | ||
|
||
}); | ||
} | ||
return lines; | ||
} | ||
|
||
|
||
} |
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