mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 00:38:56 +00:00
Passing path to shell scripts as argument, created README.md
This commit is contained in:
parent
7852a799fe
commit
dea769a93c
4 changed files with 27 additions and 14 deletions
15
splitting/README.md
Normal file
15
splitting/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Repository Splitting
|
||||
|
||||
This project provides tools for splitting the Xtext repository as described [in the Wiki](https://github.com/eclipse/xtext/wiki/Restructuring). This is the proposed work flow:
|
||||
|
||||
1. `../gradlew findProjects` creates `build/splitting/all-projects.txt`, a list of all projects (paths with a `.project` file) that have ever been in the history, and `build/splitting/unmapped-paths.txt`, a list of paths that are not covered by any project.
|
||||
2. Create `splitting.txt` based on the results of the previous step. This file must consist of lines of the form `path >> target-repos`, where `path` can be any file or directory in the repository and `target-repos` is either `delete` or a list of repository ids where that path should be included.
|
||||
3. `../gradlew clean validateSplitting` checks whether `splitting.txt` covers all files found in the history.
|
||||
4. `../gradlew generateRemovals` creates `build/splitting/removals-*.txt` for each target repository.
|
||||
|
||||
Now you have all necessary data to perform the actual splitting. In order to do this:
|
||||
|
||||
1. Create and checkout a new branch.
|
||||
2. Run `../gradlew *FilterBranch`, where `*` is the target repository id.
|
||||
3. Find something else to do (on my machine the previous command takes more than one hour).
|
||||
4. Push the resulting branch to the corresponding repository.
|
|
@ -61,6 +61,6 @@ repositories.each { targetRepo ->
|
|||
dependsOn(generateRemovals)
|
||||
inputs.file removalsFile
|
||||
workingDir '..'
|
||||
commandLine 'splitting/git-filter-branch.sh', removalsFile.path
|
||||
commandLine 'splitting/git-filter-branch.sh', removalsFile.path, file('.').canonicalPath
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
REMOVALS=`cat $1 | tr '\n' ' '`
|
||||
git filter-branch -f --prune-empty \
|
||||
--index-filter "git rm -qrf --cached --ignore-unmatch $REMOVALS" \
|
||||
--parent-filter splitting/parent-filter.sh \
|
||||
--parent-filter $2/parent-filter.sh \
|
||||
HEAD
|
||||
|
|
|
@ -39,17 +39,16 @@ public class ValidateSplitting {
|
|||
while ((line = reader.readLine()) != null) {
|
||||
if (!line.isEmpty()) {
|
||||
String[] parts = line.split(">>");
|
||||
if (parts.length != 2) {
|
||||
if (parts.length != 2)
|
||||
fail("Invalid line: " + line);
|
||||
}
|
||||
String[] repos = parts[1].split(",");
|
||||
if (repos.length == 0) {
|
||||
fail("Invalid line: " + line);
|
||||
}
|
||||
for (String repo : repos) {
|
||||
String trimmed = repo.trim();
|
||||
if (!(REPOSITORIES.contains(trimmed) || DELETE.equals(trimmed))) {
|
||||
fail("Invalid repository: " + trimmed);
|
||||
if (!DELETE.equals(parts[1].trim())) {
|
||||
String[] repos = parts[1].split(",");
|
||||
if (repos.length == 0)
|
||||
fail("Invalid line: " + line);
|
||||
for (String repo : repos) {
|
||||
String trimmed = repo.trim();
|
||||
if (!REPOSITORIES.contains(trimmed))
|
||||
fail("Invalid repository: " + trimmed);
|
||||
}
|
||||
}
|
||||
String path = parts[0].trim();
|
||||
|
@ -74,9 +73,8 @@ public class ValidateSplitting {
|
|||
if (specifiedPaths.contains(file.substring(0, lastMatch)))
|
||||
foundSplitting = true;
|
||||
}
|
||||
if (!foundSplitting) {
|
||||
if (!foundSplitting)
|
||||
fail("File not covered by splitting: " + file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue