Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test for issue #2426 #2433

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions tycho-its/projects/product.programArgs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<groupId>tycho-its-project.product.programArgs</groupId>
<artifactId>ppa.product</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>

<properties>
<target-platform>http://download.eclipse.org/releases/latest</target-platform>
</properties>

<repositories>
<repository>
<id>e342</id>
<layout>p2</layout>
<url>${target-platform}</url>
</repository>
</repositories>

<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>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>materialize-products</id>
<goals>
<goal>materialize-products</goal>
</goals>
</execution>
<execution>
<id>archive-products</id>
<goals>
<goal>archive-products</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
15 changes: 15 additions & 0 deletions tycho-its/projects/product.programArgs/product.product
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product uid="ppa.product" id="product" application="application" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="false">

<launcherArgs>
<programArgs>-blah1 -blah2 -configuration @user.dir/configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried writing each arg in one line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, still fails. If you want I could add another product with multiline args

</programArgs>
</launcherArgs>

<plugins>
<plugin id="org.eclipse.osgi"/>
</plugins>

</product>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2023 Sonatype 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
*
* Contributors:
* Quang Tran - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.test.product;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.nio.file.Files;
import java.util.List;

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

public class ProductProgramArgsTest extends AbstractTychoIntegrationTest {
@Test
public void test() throws Exception {
Verifier verifier = getVerifier("/product.programArgs", true);
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();

File basedir = new File(verifier.getBasedir());
File productDir = new File(basedir, "target/products/ppa.product/win32/win32/x86");

assertFileExists(productDir, "eclipse.ini");

File initFile = new File(productDir, "eclipse.ini");

List<String> lines = Files.readAllLines(initFile.toPath());
assertTrue(lines.indexOf("-blah1") >= 0);
assertTrue(lines.indexOf("-blah2") >= 0);

int configurationLineIndex = lines.indexOf("-configuration");
assertTrue(configurationLineIndex >= 0);
assertEquals(configurationLineIndex + 1, lines.indexOf("@user.dir/configuration"));
}

}