use of com.google.startupos.common.FileUtils in project startup-os by google.
the class HttpArchiveDepsTool method main.
public static void main(String[] args) throws IOException {
Flags.parseCurrentPackage(args);
HttpArchiveDepsTool.HttpArchiveDepsToolComponent component = DaggerHttpArchiveDepsTool_HttpArchiveDepsToolComponent.create();
FileUtils fileUtils = component.getFileUtils();
WorkspaceFile workspaceFile = component.getWorkspaceParser().getWorkspaceFile();
HttpArchiveDepsList httpArchiveDepsList = component.getHttpArchiveDepsGenerator().getHttpArchiveDeps(workspaceFile, httpArchiveNames.get());
if (!httpArchiveDepsList.getHttpArchiveDepsList().isEmpty()) {
new HttpArchiveDepsTool().write(fileUtils, httpArchiveDepsList, fileUtils.joinPaths(fileUtils.getCurrentWorkingDirectory(), HttpArchiveDepsGenerator.HTTP_ARCHIVE_DEPS_FILENAME));
}
}
use of com.google.startupos.common.FileUtils in project startup-os by google.
the class AaModule method diffNumber.
@Provides
@Named("Diff number")
public static Integer diffNumber(FileUtils fileUtils, @Named("Workspace path") String workspacePath, GitRepoFactory gitRepoFactory) {
try {
String firstWorkspacePath = fileUtils.listContents(workspacePath).stream().map(path -> fileUtils.joinToAbsolutePath(workspacePath, path)).filter(fileUtils::folderExists).findFirst().orElse(null);
if (firstWorkspacePath == null) {
throw new RuntimeException(String.format("There are no repositories in workspace %s", workspacePath));
}
GitRepo repo = gitRepoFactory.create(firstWorkspacePath);
return repo.listBranches().stream().filter(branchName -> branchName.startsWith("D")).mapToInt(branchName -> safeParsePositiveInt(branchName.replace("D", ""))).filter(number -> number > 0).findFirst().orElse(-1);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
use of com.google.startupos.common.FileUtils in project startup-os by google.
the class ThirdPartyDepsTool method main.
public static void main(String[] args) throws IOException {
Flags.parseCurrentPackage(args);
ThirdPartyDepsToolComponent component = DaggerThirdPartyDepsTool_ThirdPartyDepsToolComponent.create();
FileUtils fileUtils = component.getFileUtils();
fileUtils.writePrototxtToZip(component.getThirdPartyDepsAnalyzer().getThirdPartyDeps(buildFilePath.get()), fileUtils.joinPaths(fileUtils.getCurrentWorkingDirectory(), PATH_TO_ZIP), PROTOTXT_FILENAME_INSIDE_ZIP);
}
use of com.google.startupos.common.FileUtils in project startup-os by google.
the class CodeReviewServiceTextDiffTest method setup.
@Before
public void setup() throws IOException {
Flags.parse(new String[0], AuthService.class.getPackage(), CodeReviewService.class.getPackage());
String testFolder = Files.createTempDirectory("temp").toAbsolutePath().toString();
final String initialRepoFolder = joinToAbsolutePath(testFolder, "initial_repo");
aaBaseFolder = joinToAbsolutePath(testFolder, "base_folder");
component = DaggerCodeReviewServiceTextDiffTest_TestComponent.builder().aaModule(new AaModule() {
@Provides
@Singleton
@Override
@Named("Base path")
public String provideBasePath(FileUtils fileUtils) {
return aaBaseFolder;
}
}).build();
gitRepoFactory = component.getGitRepoFactory();
fileUtils = component.getFileUtils();
codeReviewService = new CodeReviewService(component.getAuthService(), fileUtils, aaBaseFolder, gitRepoFactory, component.getTextDifferencer());
createInitialRepo(initialRepoFolder);
initAaBase(initialRepoFolder, aaBaseFolder);
createAaWorkspace(TEST_WORKSPACE);
createBlockingStub();
writeFile(TEST_FILE_CONTENTS);
testFileCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
}
use of com.google.startupos.common.FileUtils in project startup-os by google.
the class CodeReviewServiceGetDiffFilesTest method setup.
@Before
public void setup() throws IOException {
Flags.parse(new String[0], AuthService.class.getPackage(), CodeReviewService.class.getPackage());
component = DaggerCodeReviewServiceGetDiffFilesTest_TestComponent.builder().aaModule(new AaModule() {
@Provides
@Singleton
@Override
@Named("Base path")
public String provideBasePath(FileUtils fileUtils) {
return aaBaseFolder;
}
}).build();
gitRepoFactory = component.getGitRepoFactory();
fileUtils = component.getFileUtils();
String testFolder = Files.createTempDirectory("temp").toAbsolutePath().toString();
String initialRepoFolder = fileUtils.joinToAbsolutePath(testFolder, "initial_repo");
aaBaseFolder = fileUtils.joinToAbsolutePath(testFolder, "base_folder");
codeReviewService = new CodeReviewService(component.getAuthService(), fileUtils, aaBaseFolder, gitRepoFactory, component.getTextDifferencer());
createInitialRepo(initialRepoFolder);
initAaBase(initialRepoFolder, aaBaseFolder);
createAaWorkspace(TEST_WORKSPACE);
createBlockingStub();
writeFile(TEST_FILE_CONTENTS);
testFileCommitId = repo.commit(repo.getUncommittedFiles(), COMMIT_MESSAGE).getId();
mockFirestoreClientMethods();
}
Aggregations