Skip to content

Commit

Permalink
Issue eclipse-tycho#707 - fix logic detecting custom vs none EE profile
Browse files Browse the repository at this point in the history
Fix some methods and conditions to better distinguish cases of ee=none
vs custom EE.
This allows further invocations of
TargetPlatformFactoryImpl.createTargetPlatform to work with ee=none.
  • Loading branch information
mickaelistria committed Mar 1, 2022
1 parent 6ce35b5 commit b7143d2
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ private String computeEffectiveProfileName() {

@Override
public boolean isCustomProfile() {
if (ignoreExecutionEnvironment()) {
return false;
}
String profileName = getProfileName();
boolean profileExists = ExecutionEnvironmentUtils.getProfileNames().contains(profileName);
if (!profileExists && ignoredByResolver) {
Expand All @@ -127,16 +130,16 @@ public void setFullSpecificationForCustomProfile(List<SystemCapability> systemCa

@Override
public ExecutionEnvironment getFullSpecification() throws IllegalStateException {
if (ignoreExecutionEnvironment()) {
return NoExecutionEnvironment.INSTANCE;
}
if (isCustomProfile()) {
if (customExecutionEnvironment == null) {
throw new IllegalStateException(
"Full specification of custom profile '" + getProfileName() + "' is not (yet) determined");
}
return customExecutionEnvironment;
}
if (ignoreExecutionEnvironment()) {
return NoExecutionEnvironment.INSTANCE;
}
return ExecutionEnvironmentUtils.getExecutionEnvironment(getProfileName(), toolchainManager, session, logger);
}

Expand Down
1 change: 1 addition & 0 deletions tycho-its/projects/eeProfile.none/feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = feature.xml
6 changes: 6 additions & 0 deletions tycho-its/projects/eeProfile.none/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="feature"
version="1.0.0.qualifier">

</feature>
40 changes: 40 additions & 0 deletions tycho-its/projects/eeProfile.none/feature/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tycho-its-project.eeProfile.none</groupId>
<artifactId>feature</artifactId>
<packaging>eclipse-feature</packaging>
<version>1.0.0-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<executionEnvironment>none</executionEnvironment>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<goals><goal>compare-version-with-baselines</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2022 Red Hat, Inc. and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.eclipse.tycho.test.compare;

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.junit.Test;

public class CompareWithBaselineTest extends AbstractTychoIntegrationTest {

@Test
public void testEENone() throws Exception {
Verifier verifier = getVerifier("eeProfile.none/feature", false);
verifier.executeGoal("verify");
verifier.verifyErrorFreeLog();
}
}

0 comments on commit b7143d2

Please sign in to comment.