use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testEntitlementsDoesNotMergeInvalidProfileKeys.
@Test
public void testEntitlementsDoesNotMergeInvalidProfileKeys() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Info.plist"), ApplePlatform.IPHONEOS, Optional.of("00000000-0000-0000-0000-000000000000"), Optional.of(entitlementsFile), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
ProvisioningProfileMetadata selectedProfile = step.getSelectedProvisioningProfileFuture().get().get();
ImmutableMap<String, NSObject> profileEntitlements = selectedProfile.getEntitlements();
assertTrue(profileEntitlements.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
Optional<String> xcentContents = projectFilesystem.readFileIfItExists(xcentFile);
assertTrue(xcentContents.isPresent());
NSDictionary xcentPlist = (NSDictionary) PropertyListParser.parse(xcentContents.get().getBytes());
assertFalse(xcentPlist.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
assertEquals(xcentPlist.get("com.apple.developer.team-identifier"), profileEntitlements.get("com.apple.developer.team-identifier"));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testFailsWithInvalidInfoPlist.
@Test
public void testFailsWithInvalidInfoPlist() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
thrown.expect(HumanReadableException.class);
thrown.expectMessage(startsWith("Unable to get bundle ID from info.plist"));
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Invalid.plist"), ApplePlatform.IPHONEOS, Optional.empty(), Optional.empty(), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class ProvisioningProfileMetadataTest method testProvisioningProfileReadCommandOverride.
@Test
public void testProvisioningProfileReadCommandOverride() throws Exception {
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
Path testdataDir = TestDataHelper.getTestDataDirectory(this).resolve("provisioning_profiles");
ProvisioningProfileMetadata data = ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ImmutableList.of(testdataDir.resolve("fake_read_command.sh").toString()), Paths.get("unused"));
assertThat(data.getAppID(), is(equalTo(new Pair<>("0000000000", "com.example.override"))));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class LuaBinaryIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
// We don't currently support windows.
assumeThat(Platform.detect(), Matchers.not(Platform.WINDOWS));
// Verify that a Lua interpreter is available on the system.
LuaBuckConfig fakeConfig = new LuaBuckConfig(FakeBuckConfig.builder().build(), new ExecutableFinder());
Optional<Path> luaOptional = fakeConfig.getSystemLua();
assumeTrue(luaOptional.isPresent());
lua = luaOptional.get();
// Try to detect if a Lua devel package is available, which is needed to C/C++ support.
BuildRuleResolver resolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
CxxPlatform cxxPlatform = DefaultCxxPlatforms.build(Platform.detect(), new FakeProjectFilesystem(), new CxxBuckConfig(FakeBuckConfig.builder().build()));
ProcessExecutorParams params = ProcessExecutorParams.builder().setCommand(ImmutableList.<String>builder().addAll(cxxPlatform.getCc().resolve(resolver).getCommandPrefix(new SourcePathResolver(new SourcePathRuleFinder(resolver)))).add("-includelua.h", "-E", "-").build()).setRedirectInput(ProcessBuilder.Redirect.PIPE).build();
ProcessExecutor executor = new DefaultProcessExecutor(Console.createNullConsole());
ProcessExecutor.LaunchedProcess launchedProcess = executor.launchProcess(params);
launchedProcess.getOutputStream().close();
int exitCode = executor.waitForLaunchedProcess(launchedProcess).getExitCode();
luaDevel = exitCode == 0;
if (starterType == LuaBinaryDescription.StarterType.NATIVE) {
assumeTrue("Lua devel package required for native starter", luaDevel);
}
// Setup the workspace.
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "lua_binary", tmp);
workspace.setUp();
workspace.writeContentsToPath(Joiner.on(System.lineSeparator()).join(ImmutableList.of("[lua]", " starter_type = " + starterType.toString().toLowerCase(), " native_link_strategy = " + nativeLinkStrategy.toString().toLowerCase(), "[cxx]", " sandbox_sources =" + sandboxSources)), ".buckconfig");
LuaBuckConfig config = getLuaBuckConfig();
assertThat(config.getStarterType(), Matchers.equalTo(Optional.of(starterType)));
assertThat(config.getNativeLinkStrategy(), Matchers.equalTo(nativeLinkStrategy));
}
use of com.facebook.buck.util.DefaultProcessExecutor in project buck by facebook.
the class PrebuiltPythonLibraryIntegrationTest method setUp.
@Before
public void setUp() throws IOException, InterruptedException {
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_package", tmp);
workspace.setUp();
// EGGs are versioned to the version of Python they were built it, but the EGG for this test
// doesn't actually matter.
String version = new PythonBuckConfig(FakeBuckConfig.builder().build(), new ExecutableFinder()).getPythonEnvironment(new DefaultProcessExecutor(new TestConsole(Verbosity.SILENT))).getPythonVersion().getVersionString();
if (!version.startsWith("2.6")) {
workspace.move("dist/package-0.1-py2.6.egg", "dist/package-0.1-py" + version.substring(0, 3) + ".egg");
}
}
Aggregations