本文整理汇总了Java中org.srcdeps.core.shell.IoRedirects类的典型用法代码示例。如果您正苦于以下问题:Java IoRedirects类的具体用法?Java IoRedirects怎么用?Java IoRedirects使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IoRedirects类属于org.srcdeps.core.shell包,在下文中一共展示了IoRedirects类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BuildRequest
import org.srcdeps.core.shell.IoRedirects; //导入依赖的package包/类
private BuildRequest(Path dependentProjectRootDirectory, Path projectRootDirectory, SrcVersion srcVersion,
GavSet gavSet, List<String> scmUrls, List<String> buildArguments, boolean skipTests,
boolean addDefaultBuildArguments, Set<String> forwardProperties, Map<String, String> buildEnvironment,
boolean addDefaultBuildEnvironment, Verbosity verbosity, IoRedirects ioRedirects, long timeoutMs,
String versionsMavenPluginVersion, CharStreamSource gradleModelTransformer) {
super();
SrcdepsCoreUtils.assertArgNotNull(dependentProjectRootDirectory, "dependentProjectRootDirectory");
SrcdepsCoreUtils.assertArgNotNull(projectRootDirectory, "projectRootDirectory");
SrcdepsCoreUtils.assertArgNotNull(srcVersion, "srcVersion");
SrcdepsCoreUtils.assertArgNotNull(scmUrls, "scmUrls");
SrcdepsCoreUtils.assertCollectionNotEmpty(scmUrls, "scmUrls");
SrcdepsCoreUtils.assertArgNotNull(buildArguments, "buildArguments");
SrcdepsCoreUtils.assertArgNotNull(forwardProperties, "forwardProperties");
SrcdepsCoreUtils.assertArgNotNull(buildEnvironment, "buildEnvironment");
SrcdepsCoreUtils.assertArgNotNull(ioRedirects, "ioRedirects");
SrcdepsCoreUtils.assertArgNotNull(versionsMavenPluginVersion, "versionsMavenPluginVersion");
SrcdepsCoreUtils.assertArgNotNull(gradleModelTransformer, "gradleModelTransformer");
this.dependentProjectRootDirectory = dependentProjectRootDirectory;
this.projectRootDirectory = projectRootDirectory;
this.srcVersion = srcVersion;
this.gavSet = gavSet;
this.scmUrls = scmUrls;
this.buildArguments = buildArguments;
this.skipTests = skipTests;
this.buildEnvironment = buildEnvironment;
this.addDefaultBuildEnvironment = addDefaultBuildEnvironment;
this.verbosity = verbosity;
this.timeoutMs = timeoutMs;
this.addDefaultBuildArguments = addDefaultBuildArguments;
this.forwardProperties = forwardProperties;
this.ioRedirects = ioRedirects;
this.versionsMavenPluginVersion = versionsMavenPluginVersion;
this.gradleModelTransformer = gradleModelTransformer;
}
示例2: buildIfNecessary
import org.srcdeps.core.shell.IoRedirects; //导入依赖的package包/类
/**
* Builds the artifact given by the arguments if necessary and installs it to the Local Maven Repository.
*
* @param groupId
* @param artifactId
* @param version
*/
public void buildIfNecessary(String groupId, String artifactId, String version) {
final Configuration configuration = configurationService.getConfiguration();
if (configuration.isSkip()) {
log.info("srcdeps: Skipped");
}
Gavtc artifactGavtc = new Gavtc(groupId, artifactId, version, "jar"); // FIXME: "jar" should not be hard
// coded but Gradle does not seem to have
// a notion of type an classifier (does
// it?)
Path artfactPath = localRepository.resolve(artifactGavtc);
if (!Files.exists(artfactPath)) {
ScmRepository scmRepo = findScmRepo(configuration.getRepositories(), groupId, artifactId, version);
SrcVersion srcVersion = SrcVersion.parse(version);
try (PathLock projectBuildDir = buildDirectoriesManager.openBuildDirectory(scmRepo.getIdAsPath(),
srcVersion)) {
/* query the delegate again, because things may have changed since we requested the lock */
if (Files.exists(artfactPath)) {
log.debug("srcdeps: Found in the local repo and using it as is: {}", artfactPath);
return;
} else {
/* no change in the local repo, let's build */
BuilderIo builderIo = scmRepo.getBuilderIo();
IoRedirects ioRedirects = IoRedirects.builder() //
.stdin(IoRedirects.parseUri(builderIo.getStdin())) //
.stdout(IoRedirects.parseUri(builderIo.getStdout())) //
.stderr(IoRedirects.parseUri(builderIo.getStderr())) //
.build();
List<String> buildArgs = enhanceBuildArguments(scmRepo.getBuildArguments(),
configurationService.getConfigurationLocation(),
localRepository.getRootDirectory().toString());
BuildRequest buildRequest = BuildRequest.builder() //
.dependentProjectRootDirectory(configurationService.getMultimoduleProjectRootDirectory())
.projectRootDirectory(projectBuildDir.getPath()) //
.scmUrls(scmRepo.getUrls()) //
.srcVersion(srcVersion) //
.buildArguments(buildArgs) //
.timeoutMs(scmRepo.getBuildTimeout().toMilliseconds()) //
.skipTests(scmRepo.isSkipTests()) //
.forwardProperties(configuration.getForwardProperties()) //
.addDefaultBuildArguments(scmRepo.isAddDefaultBuildArguments()) //
.verbosity(scmRepo.getVerbosity()) //
.ioRedirects(ioRedirects) //
.versionsMavenPluginVersion(scmRepo.getMaven().getVersionsMavenPluginVersion())
.gradleModelTransformer(scmRepo.getGradle().getModelTransformer()).build();
buildService.build(buildRequest);
/* check once again if the delegate sees the newly built artifact */
if (!Files.exists(artfactPath)) {
log.error(
"srcdeps: Build succeeded but the artifact {}:{}:{} is still not available in the local repository",
groupId, artifactId, version);
}
}
} catch (BuildException | IOException e) {
log.error("srcdeps: Could not build {}:{}:{}" + groupId, artifactId, version, e);
}
}
}
示例3: getIoRedirects
import org.srcdeps.core.shell.IoRedirects; //导入依赖的package包/类
/**
* @return the {@link IoRedirects} to use when the {@link Builder} spawns new {@link Process}es
*/
public IoRedirects getIoRedirects() {
return ioRedirects;
}
示例4: find
import org.srcdeps.core.shell.IoRedirects; //导入依赖的package包/类
/**
* In case the {@link #delegate} does not find the given artifact and the given artifact's version string is a
* srcdeps version string, then the version is built from source and returned.
*
* @see org.eclipse.aether.repository.LocalRepositoryManager#find(org.eclipse.aether.RepositorySystemSession,
* org.eclipse.aether.repository.LocalArtifactRequest)
*/
@Override
public LocalArtifactResult find(RepositorySystemSession session, LocalArtifactRequest request) {
log.debug("Srcdeps looking up locally {}", request.getArtifact());
final LocalArtifactResult result = delegate.find(session, request);
Artifact artifact = request.getArtifact();
String version = artifact.getVersion();
if (!result.isAvailable() && SrcVersion.isSrcVersion(version)) {
final Configuration configuration = configurationProducer.getConfiguration();
if (!configuration.isSkip()) {
final ScmRepository scmRepo = findScmRepo(configuration.getRepositories(), artifact.getGroupId(), artifact.getArtifactId(),
version);
SrcVersion srcVersion = SrcVersion.parse(version);
try (PathLock projectBuildDir = buildDirectoriesManager.openBuildDirectory(scmRepo.getIdAsPath(),
srcVersion)) {
/* query the delegate again, because things may have changed since we requested the lock */
final LocalArtifactResult result2 = delegate.find(session, request);
if (result2.isAvailable()) {
return result2;
} else {
/* no change in the local repo, let's build */
BuilderIo builderIo = scmRepo.getBuilderIo();
IoRedirects ioRedirects = IoRedirects.builder() //
.stdin(IoRedirects.parseUri(builderIo.getStdin())) //
.stdout(IoRedirects.parseUri(builderIo.getStdout())) //
.stderr(IoRedirects.parseUri(builderIo.getStderr())) //
.build();
List<String> buildArgs = enhanceBuildArguments(scmRepo.getBuildArguments(),
configurationProducer.getConfigurationLocation(),
delegate.getRepository().getBasedir().getAbsolutePath());
BuildRequest buildRequest = BuildRequest.builder() //
.dependentProjectRootDirectory(configurationProducer.getMultimoduleProjectRootDirectory()) //
.projectRootDirectory(projectBuildDir.getPath()) //
.scmUrls(scmRepo.getUrls()) //
.srcVersion(srcVersion) //
.buildArguments(buildArgs) //
.timeoutMs(scmRepo.getBuildTimeout().toMilliseconds()) //
.skipTests(scmRepo.isSkipTests()) //
.forwardProperties(configuration.getForwardProperties()) //
.addDefaultBuildArguments(scmRepo.isAddDefaultBuildArguments()) //
.verbosity(scmRepo.getVerbosity()) //
.ioRedirects(ioRedirects) //
.versionsMavenPluginVersion(scmRepo.getMaven().getVersionsMavenPluginVersion())
.gradleModelTransformer(scmRepo.getGradle().getModelTransformer()).build();
buildService.build(buildRequest);
/* check once again if the delegate sees the newly built artifact */
final LocalArtifactResult newResult = delegate.find(session, request);
if (!newResult.isAvailable()) {
log.error(
"Srcdeps build succeeded but the artifact {} is still not available in the local repository",
artifact);
}
return newResult;
}
} catch (BuildException | IOException e) {
log.error("Srcdeps could not build " + request, e);
}
}
}
return result;
}