mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New tests for conversion and multi-version support
This commit is contained in:
parent
0c84b90020
commit
0d47484eda
5 changed files with 877 additions and 1 deletions
|
@ -3955,6 +3955,402 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</projectType>
|
</projectType>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Project type for testing Configuration Name Provider & Multiple Tool Chain versions features
|
||||||
|
Note: toolchains are cut and cannot be used for real compilation.
|
||||||
|
-->
|
||||||
|
<projectType
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.exe"
|
||||||
|
isAbstract="false"
|
||||||
|
isTest="true"
|
||||||
|
configurationNameProvider="org.eclipse.cdt.managedbuilder.core.tests.TestConfigurationNameProvider"
|
||||||
|
name="testMultipleVersions.exe">
|
||||||
|
<configuration
|
||||||
|
name="Debug"
|
||||||
|
description="debug configuration for IA32 windows"
|
||||||
|
id="cdt.managedbuild.config.testMultipleVersions.exe.debug"
|
||||||
|
cleanCommand="rm -rf"
|
||||||
|
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
|
||||||
|
<toolChain
|
||||||
|
id="cdt.managedbuild.toolchain.testMultipleVersions.exe.debug_1.1.0"
|
||||||
|
name="Debug IA32 ToolChain"
|
||||||
|
archList="x86"
|
||||||
|
osList="linux"
|
||||||
|
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<targetPlatform
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.platform.exe.debug"
|
||||||
|
name="Debug IA32 Platform"
|
||||||
|
binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
|
||||||
|
osList="solaris,linux,hpux,aix,qnx"
|
||||||
|
archList="all">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.builder.exe.debug_1.1.0"
|
||||||
|
name="Debug IA32 Builder"
|
||||||
|
command="make"
|
||||||
|
arguments="-k"
|
||||||
|
variableFormat="@="
|
||||||
|
isVariableCaseSensitive="false"
|
||||||
|
reservedMacroNames="PATH"
|
||||||
|
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="cdt.managedbuild.tool.testMultipleVersions.c.compiler.exe.debug_1.1.0"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="cdt.managedbuild.tool.testMultipleVersions.cpp.compiler.exe.debug_1.1.0"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
<configuration
|
||||||
|
name="Release"
|
||||||
|
description="release configuration for IA32 windows"
|
||||||
|
id="cdt.managedbuild.config.testMultipleVersions.exe.release"
|
||||||
|
cleanCommand="rm -rf"
|
||||||
|
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
|
||||||
|
<toolChain
|
||||||
|
archList="x86"
|
||||||
|
osList="linux"
|
||||||
|
id="cdt.managedbuild.toolchain.testMultipleVersions.exe.release"
|
||||||
|
name="Release IA32 ToolChain"
|
||||||
|
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<targetPlatform
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.platform.exe.release"
|
||||||
|
name="Release IA32 Platform"
|
||||||
|
binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
|
||||||
|
osList="solaris,linux,hpux,aix,qnx"
|
||||||
|
archList="all">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.builder.exe.release"
|
||||||
|
name="Release IA32 Builder"
|
||||||
|
command="make"
|
||||||
|
arguments="-k">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="cdt.managedbuild.tool.testMultipleVersions.c.compiler.exe.release"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
<configuration
|
||||||
|
name="Debug"
|
||||||
|
description="debug configuration for IA64 windows"
|
||||||
|
id="cdt.managedbuild.config.testMultipleVersions.exe.debug64"
|
||||||
|
cleanCommand="rm -rf">
|
||||||
|
<toolChain
|
||||||
|
archList="ia64"
|
||||||
|
osList="linux"
|
||||||
|
configurationMacroSupplier="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
|
||||||
|
id="cdt.managedbuild.toolchain.testMultipleVersions.exe.debug64_2.2.0"
|
||||||
|
name="Debug IA64 ToolChain"
|
||||||
|
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<targetPlatform
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.platform.exe.debug64"
|
||||||
|
name="Debug IA64 Platform">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.builder.exe.debug64_3.2.1"
|
||||||
|
name="Debug IA64 Builder"
|
||||||
|
command="make"
|
||||||
|
arguments="-k">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="cdt.managedbuild.tool.testMultipleVersions.c.compiler.exe.debug64_5.0.9"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
<configuration
|
||||||
|
name="Release"
|
||||||
|
description="release configuration for IA64 windows"
|
||||||
|
id="cdt.managedbuild.config.testMultipleVersions.exe.release64">
|
||||||
|
<toolChain
|
||||||
|
archList="ia64"
|
||||||
|
osList="linux"
|
||||||
|
id="cdt.managedbuild.toolchain.testMultipleVersions.exe.release64_2.2.0"
|
||||||
|
versionsSupported="1.2.0,2.0.0,2.1.3"
|
||||||
|
isToolChainSupported="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
|
||||||
|
name="Three ToolChain">
|
||||||
|
<targetPlatform
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.platform.exe.release64"
|
||||||
|
name="Release IA64 Platform">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="cdt.managedbuild.target.testMultipleVersions.builder.exe.release64_3.2.1"
|
||||||
|
name="Release IA64 Builder"
|
||||||
|
versionsSupported="2.0.0,2.1.1,3.0.3"
|
||||||
|
command="make"
|
||||||
|
isVariableCaseSensitive="true"
|
||||||
|
variableFormat="@=">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="cdt.managedbuild.tool.testMultipleVersions.c.compiler.exe.release64_5.0.9"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Project type for testing Project Converter convenience routines
|
||||||
|
Note: toolchains are cut and cannot be used for real compilation.
|
||||||
|
-->
|
||||||
|
<projectType
|
||||||
|
id="testProjectConverterConvenienceRoutines.exe"
|
||||||
|
isAbstract="false"
|
||||||
|
isTest="true"
|
||||||
|
name="testProjectConverterConvenienceRoutines.exe">
|
||||||
|
<configuration
|
||||||
|
name="Debug"
|
||||||
|
description="debug configuration for IA32 windows"
|
||||||
|
id="config.testProjectConverterConvenienceRoutines.exe.debug"
|
||||||
|
cleanCommand="rm -rf"
|
||||||
|
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
|
||||||
|
<toolChain
|
||||||
|
id="toolchain.testProjectConverterConvenienceRoutines.exe.debug_1.1.0"
|
||||||
|
name="Debug IA32 ToolChain"
|
||||||
|
archList="x86"
|
||||||
|
osList="linux">
|
||||||
|
<targetPlatform
|
||||||
|
id="target.testProjectConverterConvenienceRoutines.platform.exe.debug"
|
||||||
|
name="Debug IA32 Platform"
|
||||||
|
binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
|
||||||
|
osList="solaris,linux,hpux,aix,qnx"
|
||||||
|
archList="all">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="target.testProjectConverterConvenienceRoutines.builder.exe.debug_1.1.0"
|
||||||
|
name="Debug IA32 Builder"
|
||||||
|
command="make"
|
||||||
|
arguments="-k"
|
||||||
|
variableFormat="@="
|
||||||
|
isVariableCaseSensitive="false"
|
||||||
|
reservedMacroNames="PATH"
|
||||||
|
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="tool.testProjectConverterConvenienceRoutines.c.compiler.exe.debug_1.1.0"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="tool.testProjectConverterConvenienceRoutines.cpp.compiler.exe.debug_1.1.0"
|
||||||
|
superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<!-- Test Converters for testing the converter convenience routines -->
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.managedbuilder.core.projectConverter">
|
||||||
|
<converter
|
||||||
|
id="test.converter"
|
||||||
|
name="Test Project Converter"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.core.tests.ProjectConverter"
|
||||||
|
fromId="toolchain.testProjectConverterConvenienceRoutines.exe.debug_1.1.0"
|
||||||
|
toId="toolchain.testProjectConverterConvenienceRoutines.exe.debug_1.2.0"
|
||||||
|
mbsVersion="3.0.0">
|
||||||
|
</converter>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<!-- Test Converters for testing the conversion while importing a CDT2.1 project -->
|
||||||
|
|
||||||
|
<extension point="org.eclipse.cdt.managedbuilder.core.projectConverter">
|
||||||
|
<converter
|
||||||
|
id="test.ToolChainConverter"
|
||||||
|
name="Test Tool Chain Converter"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.core.tests.ProjectConverter21"
|
||||||
|
fromId="test.toolChain_1.0.0"
|
||||||
|
toId="test.toolChain_2.0.0"
|
||||||
|
mbsVersion="3.0.0">
|
||||||
|
</converter>
|
||||||
|
<converter
|
||||||
|
id="test.Tool1Converter"
|
||||||
|
name="Test Tool1 Converter"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.core.tests.ProjectConverter21"
|
||||||
|
fromId="test.tool1_1.0.0"
|
||||||
|
toId="test.tool1_2.0.0"
|
||||||
|
mbsVersion="3.0.0">
|
||||||
|
</converter>
|
||||||
|
<converter
|
||||||
|
id="test.Tool2Converter"
|
||||||
|
name="Test Tool2 Converter"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.core.tests.ProjectConverter21"
|
||||||
|
fromId="test.tool2_1.0.0"
|
||||||
|
toId="test.tool2_2.0.0"
|
||||||
|
mbsVersion="3.0.0">
|
||||||
|
</converter>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<!-- Test Converters for testing the conversion while importing a CDT2.0 & CDT2.1 projects -->
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
|
||||||
|
<managedBuildRevision
|
||||||
|
fileVersion="3.0.0">
|
||||||
|
</managedBuildRevision>
|
||||||
|
|
||||||
|
<projectType
|
||||||
|
isAbstract="false"
|
||||||
|
isTest="false"
|
||||||
|
name="Test - Version 1.0"
|
||||||
|
id="test_1.0.0">
|
||||||
|
<configuration
|
||||||
|
name="Test Configuration"
|
||||||
|
id="test.config_1.0.0"
|
||||||
|
cleanCommand="rm -rf"
|
||||||
|
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
|
||||||
|
<toolChain
|
||||||
|
id="test.toolChain_1.0.0"
|
||||||
|
name="Test ToolChain Ver 1.0"
|
||||||
|
convertToId="test.toolChain_2.0.0"
|
||||||
|
archList="all">
|
||||||
|
<targetPlatform
|
||||||
|
id="test.target_1.0.0"
|
||||||
|
name="Test Target"
|
||||||
|
binaryParser="org.eclipse.cdt.core.ELF"
|
||||||
|
archList="all">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="test.builder_1.0.0"
|
||||||
|
name="Test Builder Version 1.0"
|
||||||
|
command="make"
|
||||||
|
arguments="-k"
|
||||||
|
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="test.tool1_1.0.0"
|
||||||
|
name="Test Tool 1 - - Version 1.0"
|
||||||
|
convertToId="test.tool1_2.0.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="test.tool2_1.0.0"
|
||||||
|
name="Test Tool 2 - Version 1.0"
|
||||||
|
convertToId="test.tool2_2.0.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
<projectType
|
||||||
|
isAbstract="false"
|
||||||
|
isTest="false"
|
||||||
|
name="Test - Version 2.0"
|
||||||
|
id="test_2.0.0">
|
||||||
|
<configuration
|
||||||
|
name="Test Configuration 2.0"
|
||||||
|
id="test.config_2.0.0"
|
||||||
|
cleanCommand="rm -rf"
|
||||||
|
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
|
||||||
|
<toolChain
|
||||||
|
id="test.toolChain_2.0.0"
|
||||||
|
name="Test ToolChain Ver 2.0"
|
||||||
|
archList="all">
|
||||||
|
<targetPlatform
|
||||||
|
id="test.target_2.0.0"
|
||||||
|
name="Test Target ver 2.0"
|
||||||
|
binaryParser="org.eclipse.cdt.core.ELF"
|
||||||
|
archList="all">
|
||||||
|
</targetPlatform>
|
||||||
|
<builder
|
||||||
|
id="test.builder_2.0.0"
|
||||||
|
name="Test Builder Version 2.0"
|
||||||
|
command="make"
|
||||||
|
arguments="-k"
|
||||||
|
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="test.tool1_2.0.0"
|
||||||
|
name="Test Tool 1 - - Version 2.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="test.tool2_2.0.0"
|
||||||
|
name="Test Tool 2 - Version 2.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
<projectType
|
||||||
|
isAbstract="false"
|
||||||
|
name="Test"
|
||||||
|
isTest="true"
|
||||||
|
superClass="cdt.managedbuild.target.gnu.exe"
|
||||||
|
id="test.target">
|
||||||
|
<configuration id="test.config" name="Test Configuration">
|
||||||
|
<toolChain
|
||||||
|
id="test.toolchain"
|
||||||
|
name="Test Toolchain"
|
||||||
|
convertToId="test.toolchain_1.2.0">
|
||||||
|
<builder
|
||||||
|
superClass="cdt.managedbuild.target.gnu.builder"
|
||||||
|
id="test.builder"
|
||||||
|
name=""
|
||||||
|
command="make"
|
||||||
|
arguments="-k">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="test.c.compiler"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="test.cpp.compiler"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
<projectType
|
||||||
|
isAbstract="false"
|
||||||
|
name="Test 1.2.0"
|
||||||
|
superClass="cdt.managedbuild.target.gnu.exe"
|
||||||
|
id="test.target_1.2.0">
|
||||||
|
<configuration id="test.config_1.2.0" name="Test Configuration">
|
||||||
|
<toolChain
|
||||||
|
id="test.toolchain_1.2.0"
|
||||||
|
name="Test Toolchain 1.2.0">
|
||||||
|
<builder
|
||||||
|
superClass="cdt.managedbuild.target.gnu.builder"
|
||||||
|
id="test.builder_1.2.0"
|
||||||
|
name=""
|
||||||
|
command="make"
|
||||||
|
arguments="-k">
|
||||||
|
</builder>
|
||||||
|
<tool
|
||||||
|
id="test.c.compiler_1.2.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.c.compiler">
|
||||||
|
</tool>
|
||||||
|
<tool
|
||||||
|
id="test.cpp.compiler_1.2.0"
|
||||||
|
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</configuration>
|
||||||
|
</projectType>
|
||||||
|
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.managedbuilder.core.projectConverter">
|
||||||
|
<converter
|
||||||
|
id="test.converter"
|
||||||
|
name="Test Project Converter"
|
||||||
|
class="org.eclipse.cdt.managedbuilder.core.tests.ProjectConverter20"
|
||||||
|
fromId="test.toolchain"
|
||||||
|
toId="test.toolchain_1.2.0"
|
||||||
|
mbsVersion="3.0.0">
|
||||||
|
</converter>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.managedbuilder.core.tests.ManagedCommandLineGeneratorTest
|
||||||
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests;
|
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests;
|
||||||
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject30MakefileTests;
|
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject30MakefileTests;
|
||||||
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProjectUpdateTests;
|
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProjectUpdateTests;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.tests.MultiVersionSupportTests;
|
||||||
import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests;
|
import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +56,7 @@ public class AllManagedBuildTests {
|
||||||
suite.addTest(ManagedBuildEnvironmentTests.suite());
|
suite.addTest(ManagedBuildEnvironmentTests.suite());
|
||||||
suite.addTest(ManagedBuildMacrosTests.suite());
|
suite.addTest(ManagedBuildMacrosTests.suite());
|
||||||
suite.addTest(ManagedBuildTCSupportedTest.suite());
|
suite.addTest(ManagedBuildTCSupportedTest.suite());
|
||||||
|
suite.addTest(MultiVersionSupportTests.suite());
|
||||||
//$JUnit-END$
|
//$JUnit-END$
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,377 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2005 Intel Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Intel Corporation - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceDescription;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
|
||||||
|
public class MultiVersionSupportTests extends TestCase {
|
||||||
|
static IProject proj = null;
|
||||||
|
static IManagedProject mproj = null;
|
||||||
|
|
||||||
|
IConfiguration[] cfgs = null;
|
||||||
|
private IWorkspace worksp;
|
||||||
|
private boolean windows;
|
||||||
|
|
||||||
|
public MultiVersionSupportTests() { super(); }
|
||||||
|
public MultiVersionSupportTests(String name) { super(name); }
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
TestSuite suite = new TestSuite(MultiVersionSupportTests.class.getName());
|
||||||
|
//$JUnit-BEGIN$
|
||||||
|
suite.addTest(new MultiVersionSupportTests("testProjectConverterConvenienceRoutines")); //$NON-NLS-1$
|
||||||
|
suite.addTest(new MultiVersionSupportTests("testConfigurationNameProvider")); //$NON-NLS-1$
|
||||||
|
suite.addTest(new MultiVersionSupportTests("testConfigurationDescription")); //$NON-NLS-1$
|
||||||
|
suite.addTest(new MultiVersionSupportTests("testVersionInfo")); //$NON-NLS-1$
|
||||||
|
suite.addTest(new MultiVersionSupportTests("testVersionsSupportedAttribute")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
//$JUnit-END$
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests the functionality of Project converter convenience routines
|
||||||
|
* defined in ManagedBuildManager class. These convenience routines are generic routines
|
||||||
|
* anyone can use them
|
||||||
|
* i) To find out whether any converters are available for a given Build Object,
|
||||||
|
* ii) To get a list of converters
|
||||||
|
* iii) To convert a Build Object
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testProjectConverterConvenienceRoutines() throws Exception {
|
||||||
|
String projectName = "TestProjectConverterConvenienceRoutines"; //$NON-NLS-1$
|
||||||
|
String projectTypeId = "testProjectConverterConvenienceRoutines.exe"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
doInit(projectName, projectTypeId);
|
||||||
|
|
||||||
|
// It should contain only one configuration.
|
||||||
|
assertEquals(cfgs.length, 1);
|
||||||
|
|
||||||
|
IToolChain toolChain = cfgs[0].getToolChain();
|
||||||
|
|
||||||
|
// Check whether this tool chain has converters using generic convenience routine.
|
||||||
|
boolean hasConverters = ManagedBuildManager.hasTargetConversionElements(toolChain);
|
||||||
|
|
||||||
|
// Expected value is 'true'
|
||||||
|
assertEquals(hasConverters, true);
|
||||||
|
|
||||||
|
// Get the list of available converters for ths tool chain using generic convenience routine
|
||||||
|
Map converters = ManagedBuildManager.getConversionElements(toolChain);
|
||||||
|
|
||||||
|
// Expected value for the number of converters available is '1'
|
||||||
|
assertEquals(converters.size(), 1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests the functionality of configuration name provider.
|
||||||
|
* Using this functionality, Tool Integrator can provide configuration names dynamically
|
||||||
|
* based on the OS, architecture.
|
||||||
|
*
|
||||||
|
* In plugin manifest file, there are 4 configurations defined for the project type
|
||||||
|
* "cdt.managedbuild.target.testMultipleVersions.exe". Two configurations are defined with "Debug"
|
||||||
|
* as their name and other two are defined with "Release" as their name. But user will see the
|
||||||
|
* configuration names as "Debug", "Release", "Debug_ia64" and "Release_ia64" while creating a project.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testConfigurationNameProvider()throws Exception {
|
||||||
|
String [] expectedConfigNames = { "Debug","Release","Debug_ia64","Release_ia64" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
String [] actualConfigNames = new String[4];
|
||||||
|
// create managed project
|
||||||
|
String projectName = "TestConfigurationNameProvider"; //$NON-NLS-1$
|
||||||
|
String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$
|
||||||
|
doInit(projectName, projectTypeId);
|
||||||
|
|
||||||
|
// Check the configuration names
|
||||||
|
cfgs = mproj.getConfigurations();
|
||||||
|
|
||||||
|
// Get the actual configuration names
|
||||||
|
for (int i = 0; i < cfgs.length; i++) {
|
||||||
|
actualConfigNames[i] = cfgs[i].getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare the expected and actual,
|
||||||
|
for (int i = 0; i < expectedConfigNames.length; i++) {
|
||||||
|
assertTrue( isArrayContains(actualConfigNames, expectedConfigNames[i]) );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests whether the newly added attribute 'description' is retrived from plugin
|
||||||
|
* manifest file correctly or not. There are 4 configurations defined with different description
|
||||||
|
* each configuration. This function checks the description of each configuration against
|
||||||
|
* expected description after creating a project.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testConfigurationDescription()throws Exception {
|
||||||
|
String [] expectedConfigDescriptions = { "debug configuration for IA32 windows","release configuration for IA32 windows","debug configuration for IA64 windows","release configuration for IA64 windows" }; //$NON-NLS-1$
|
||||||
|
String [] actualConfigDescriptions = new String[4];
|
||||||
|
// create managed project
|
||||||
|
String projectName = "TestConfigurationDescription"; //$NON-NLS-1$
|
||||||
|
String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
doInit(projectName, projectTypeId);
|
||||||
|
|
||||||
|
// Check the configuration descriptions
|
||||||
|
cfgs = mproj.getConfigurations();
|
||||||
|
|
||||||
|
// Get the actual configuration names
|
||||||
|
for (int i = 0; i < cfgs.length; i++) {
|
||||||
|
actualConfigDescriptions[i] = cfgs[i].getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare the expected and actual,
|
||||||
|
for (int i = 0; i < expectedConfigDescriptions.length; i++) {
|
||||||
|
assertTrue( isArrayContains(actualConfigDescriptions, expectedConfigDescriptions[i]) );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests whether the version information stored with in the 'id' of ToolChain/Tool/Builder
|
||||||
|
* is retrived from plugin manifest file correctly or not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testVersionInfo()throws Exception {
|
||||||
|
|
||||||
|
String projectName = "TestVersionInfo"; //$NON-NLS-1$
|
||||||
|
String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// create managed project
|
||||||
|
doInit(projectName, projectTypeId);
|
||||||
|
|
||||||
|
// Check the configuration descriptions
|
||||||
|
cfgs = mproj.getConfigurations();
|
||||||
|
|
||||||
|
// Check the version information of ToolChain/Tool/Builder defined under 'Release' Configuration.
|
||||||
|
|
||||||
|
// It should return the version as '0.0.4' as there is no version information defined
|
||||||
|
// for ToolChain/Tool/Builder. The version '0.0.4' is the default version for CDT3.0
|
||||||
|
|
||||||
|
// Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release.1"
|
||||||
|
IConfiguration releaseConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.release.1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// the toolchain version should be '0.0.4' as this is default value
|
||||||
|
assertEquals(releaseConfig.getToolChain().getVersion().toString(), "0.0.4"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the tools of this toolChain and verify the version of each tool
|
||||||
|
// Each tool version in release configuration should be "0.0.4"
|
||||||
|
ITool [] tools = releaseConfig.getToolChain().getTools();
|
||||||
|
for (int i = 0; i < tools.length; i++) {
|
||||||
|
ITool tool = tools[i];
|
||||||
|
assertEquals(tool.getVersion().toString(),"0.0.4"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the builder version
|
||||||
|
IBuilder builder = releaseConfig.getToolChain().getBuilder();
|
||||||
|
assertEquals(builder.getVersion().toString(),"0.0.4"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Check the versions of ToolChain/Tool/Builder in Debug Configuration
|
||||||
|
// Expected version: "1.1.0" for all ToolChain/Tool(s)/Builder.
|
||||||
|
|
||||||
|
// Get the 'Debug' Configuration
|
||||||
|
// Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0"
|
||||||
|
IConfiguration debugConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.debug.0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// the toolchain version should be '1.1.0' as that's what defined in plugin manifest file
|
||||||
|
assertEquals(debugConfig.getToolChain().getVersion().toString(), "1.1.0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the tools of this toolChain and verify the version of each tool
|
||||||
|
// Each tool version in debug configuration should be "1.1.0"
|
||||||
|
tools = debugConfig.getToolChain().getTools();
|
||||||
|
for (int i = 0; i < tools.length; i++) {
|
||||||
|
ITool tool = tools[i];
|
||||||
|
assertEquals(tool.getVersion().toString(),"1.1.0"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the builder version
|
||||||
|
builder = debugConfig.getToolChain().getBuilder();
|
||||||
|
assertEquals(builder.getVersion().toString(),"1.1.0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the 'Debug64' Configuration
|
||||||
|
// Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0"
|
||||||
|
IConfiguration debug64Config = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.debug64.2"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// the toolchain version should be '2.2.0' as that's what defined in plugin manifest file
|
||||||
|
assertEquals(debug64Config.getToolChain().getVersion().toString(), "2.2.0"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the tools of this toolChain and verify the version of each tool
|
||||||
|
// Each tool version in debug64 configuration should be "5.0.9" (defined in plugin manifest file)
|
||||||
|
tools = debug64Config.getToolChain().getTools();
|
||||||
|
for (int i = 0; i < tools.length; i++) {
|
||||||
|
ITool tool = tools[i];
|
||||||
|
assertEquals(tool.getVersion().toString(),"5.0.9"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the builder version , expected value : "3.2.1" defined in plugin manifest file
|
||||||
|
builder = debug64Config.getToolChain().getBuilder();
|
||||||
|
assertEquals(builder.getVersion().toString(),"3.2.1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests whether the attribute 'versionsSupported' of
|
||||||
|
* ToolChain/Tool/Builder elements is retrived from plugin manifest file correctly or not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void testVersionsSupportedAttribute() throws Exception {
|
||||||
|
// create managed project
|
||||||
|
String projectName = "TestVersionSupportAttribute"; //$NON-NLS-1$
|
||||||
|
String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
doInit(projectName, projectTypeId);
|
||||||
|
|
||||||
|
// Check the configuration descriptions
|
||||||
|
cfgs = mproj.getConfigurations();
|
||||||
|
|
||||||
|
// Check the version information of ToolChain/Tool/Builder defined under 'Release' Configuration.
|
||||||
|
|
||||||
|
// It should return the version as '0.0.4' as there is no version information defined
|
||||||
|
// for ToolChain/Tool/Builder. The version '0.0.4' is the default version for CDT3.0
|
||||||
|
|
||||||
|
// Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release64.3"
|
||||||
|
IConfiguration releaseConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.release64.3"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the tool chain
|
||||||
|
IToolChain toolChain = releaseConfig.getToolChain();
|
||||||
|
|
||||||
|
//Get the 'versionsSupported' attribute of toolChain
|
||||||
|
String toolChainVersionsSupported = toolChain.getVersionsSupported();
|
||||||
|
|
||||||
|
// Compare with the expected value "1.2.0,2.0.0,2.1.3"
|
||||||
|
assertEquals(toolChainVersionsSupported,"1.2.0,2.0.0,2.1.3"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// Get the builder
|
||||||
|
IBuilder builder = releaseConfig.getToolChain().getBuilder();
|
||||||
|
|
||||||
|
// Get the 'versionsSupported' attribute of builder
|
||||||
|
String versionsSupported = builder.getVersionsSupported();
|
||||||
|
|
||||||
|
// Compare with expected value "2.0.0,2.1.1,3.0.3"
|
||||||
|
assertEquals(versionsSupported,"2.0.0,2.1.1,3.0.3"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void createManagedProject(String name, String projectTypeId) {
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
proj = root.getProject(name);
|
||||||
|
|
||||||
|
if (proj.exists()) {
|
||||||
|
mproj = ManagedBuildManager.getBuildInfo(proj).getManagedProject();
|
||||||
|
} else {
|
||||||
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
IWorkspaceDescription workspaceDesc = workspace.getDescription();
|
||||||
|
workspaceDesc.setAutoBuilding(false);
|
||||||
|
try {
|
||||||
|
workspace.setDescription(workspaceDesc);
|
||||||
|
proj = CCorePlugin.getDefault().createCProject(workspace.newProjectDescription(proj.getName()),
|
||||||
|
proj, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
|
||||||
|
|
||||||
|
// add ManagedBuildNature
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(proj);
|
||||||
|
info.setValid(true);
|
||||||
|
ManagedCProjectNature.addManagedNature(proj, null);
|
||||||
|
ManagedCProjectNature.addManagedBuilder(proj, null);
|
||||||
|
|
||||||
|
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(proj, true);
|
||||||
|
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
|
||||||
|
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
|
||||||
|
desc.saveProjectData();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
fail("Cannot create project: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
// Call this function just to avoid init problems in getProjectType();
|
||||||
|
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
|
||||||
|
IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId);
|
||||||
|
assertNotNull(projType);
|
||||||
|
try {
|
||||||
|
mproj = ManagedBuildManager.createManagedProject(proj, projType);
|
||||||
|
} catch (BuildException e) {}
|
||||||
|
ManagedBuildManager.setNewProjectVersion(proj);
|
||||||
|
IConfiguration[] cfgs = projType.getConfigurations();
|
||||||
|
|
||||||
|
for (int i = 0; i < cfgs.length; i++) { // sic ! from 1
|
||||||
|
mproj.createConfiguration(cfgs[i], cfgs[i].getId() + "." + i); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if( cfgs.length > 0)
|
||||||
|
ManagedBuildManager.setDefaultConfiguration(proj, cfgs[0]);
|
||||||
|
else
|
||||||
|
ManagedBuildManager.setDefaultConfiguration(proj, null);
|
||||||
|
}
|
||||||
|
// open project w/o progress monitor; no action performed if it's opened
|
||||||
|
try {
|
||||||
|
proj.open(null);
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* isArrayContains()
|
||||||
|
*/
|
||||||
|
private boolean isArrayContains(String[] actualConfigNames, String name) {
|
||||||
|
if (actualConfigNames != null) {
|
||||||
|
for (int i = 0; i < actualConfigNames.length; i++) {
|
||||||
|
if ( ( actualConfigNames[i] != null) && (actualConfigNames[i].equals(name)) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doInit() - call it at the beginning of every test
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void doInit(String projectName, String projectTypeId) {
|
||||||
|
createManagedProject(projectName, projectTypeId);
|
||||||
|
assertNotNull(proj);
|
||||||
|
assertNotNull(mproj);
|
||||||
|
worksp = proj.getWorkspace();
|
||||||
|
assertNotNull(worksp);
|
||||||
|
cfgs = mproj.getConfigurations();
|
||||||
|
assertNotNull(cfgs);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject;
|
||||||
|
|
||||||
|
public class ProjectConverter implements IConvertManagedBuildObject {
|
||||||
|
|
||||||
|
public IBuildObject convert(IBuildObject buildObj, String fromId,
|
||||||
|
String toId, boolean isConfirmed) {
|
||||||
|
|
||||||
|
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||||
|
|
||||||
|
File outputFile = new File(tmpDir + "/converterOutput.txt");
|
||||||
|
try {
|
||||||
|
FileWriter out = new FileWriter(outputFile);
|
||||||
|
out.write("---------- Start-------");
|
||||||
|
out.write("Converter for the build object : '" + buildObj.getName() + "' is invoked.");
|
||||||
|
out.write("From Id : " + fromId );
|
||||||
|
out.write("To Id : " + toId);
|
||||||
|
out.write("---------- End-------");
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
System.out.println("Exception raised.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return buildObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestConfigurationNameProvider implements
|
||||||
|
IConfigurationNameProvider {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider#getNewConfigurationName(org.eclipse.cdt.managedbuilder.core.IConfiguration,
|
||||||
|
* java.lang.String[]) This function will generate a unique
|
||||||
|
* configuration name based on used names, current OS and current
|
||||||
|
* Architecture.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static int configNumber = 0;
|
||||||
|
|
||||||
|
public String getNewConfigurationName(IConfiguration configuration,
|
||||||
|
String[] usedConfigurationNames) {
|
||||||
|
|
||||||
|
String configName = configuration.getName();
|
||||||
|
|
||||||
|
// Get the current OS & architecture
|
||||||
|
String os = Platform.getOS();
|
||||||
|
String arch = Platform.getOSArch();
|
||||||
|
|
||||||
|
if (isArrayContains(usedConfigurationNames, configName) == false)
|
||||||
|
return configName;
|
||||||
|
else {
|
||||||
|
String[] supportedArchList = configuration.getToolChain()
|
||||||
|
.getArchList();
|
||||||
|
if (supportedArchList.length == 1) {
|
||||||
|
String newConfigName = configName + "_" + supportedArchList[0];
|
||||||
|
if (isArrayContains(usedConfigurationNames, newConfigName) == false) {
|
||||||
|
return newConfigName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] supportedOsList = configuration.getToolChain().getOSList();
|
||||||
|
if (supportedOsList.length == 1) {
|
||||||
|
String newConfigName = configName + "_" + supportedOsList[0];
|
||||||
|
if (isArrayContains(usedConfigurationNames, newConfigName) == false) {
|
||||||
|
return newConfigName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configNumber += 1;
|
||||||
|
return configName + "_" + configNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isArrayContains(String[] usedNames, String name) {
|
||||||
|
if (usedNames != null) {
|
||||||
|
for (int i = 0; i < usedNames.length; i++) {
|
||||||
|
if ( ( usedNames[i] != null) && (usedNames[i].equals(name)) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue