diff --git a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/PBXProjectTestUtils.java b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/PBXProjectTestUtils.java index 4822758be2..39d7daee20 100644 --- a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/PBXProjectTestUtils.java +++ b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/PBXProjectTestUtils.java @@ -298,4 +298,8 @@ public static BiFunction inputPaths(BiFunction, ? extends List> action) { return (self, buildPhase) -> buildPhase.toBuilder().inputPaths(action.apply(self, buildPhase.getInputPaths())).build(); } + + public static BiFunction productName(String value) { + return (self, target) -> target.toBuilder().productName(value).build(); + } } diff --git a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXAggregateTargetFunctionalTests.java b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXAggregateTargetFunctionalTests.java index af5727ed8b..011553e0be 100644 --- a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXAggregateTargetFunctionalTests.java +++ b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXAggregateTargetFunctionalTests.java @@ -26,6 +26,7 @@ import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.add; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.buildPhases; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.clear; +import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.productName; import static dev.nokee.internal.testing.GradleRunnerMatchers.outOfDate; import static org.hamcrest.MatcherAssert.assertThat; @@ -59,4 +60,11 @@ void outOfDateWhenBuildPhaseRemoved() { assertThat(targetUnderTestExecution(), outOfDate()); } } + + @Test + void outOfDateWhenProductNameChanged() { + xcodeproj(targetUnderTest(productName("NewApp"))); + + assertThat(targetUnderTestExecution(), outOfDate()); + } } diff --git a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXLegacyTargetFunctionalTests.java b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXLegacyTargetFunctionalTests.java index 22b4dffd95..1fbf9370b7 100644 --- a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXLegacyTargetFunctionalTests.java +++ b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXLegacyTargetFunctionalTests.java @@ -27,6 +27,7 @@ import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.asLegacyTarget; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.buildArgumentsString; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.buildToolPath; +import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.productName; import static dev.nokee.internal.testing.GradleRunnerMatchers.outOfDate; import static java.nio.file.attribute.PosixFilePermissions.fromString; import static org.hamcrest.MatcherAssert.assertThat; @@ -58,4 +59,11 @@ void outOfDateWhenBuildArgumentsChanged() { assertThat(targetUnderTestExecution(), outOfDate()); } + + @Test + void outOfDateWhenProductNameChanged() { + xcodeproj(targetUnderTest(productName("NewApp"))); + + assertThat(targetUnderTestExecution(), outOfDate()); + } } diff --git a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXNativeTargetFunctionalTests.java b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXNativeTargetFunctionalTests.java index 00c2c0db56..5484aca0a6 100644 --- a/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXNativeTargetFunctionalTests.java +++ b/subprojects/build-adapter-xcode/src/functionalTest/java/dev/nokee/buildadapter/xcode/uptodate/UpToDateCheckDetectsChangeToPBXNativeTargetFunctionalTests.java @@ -25,6 +25,7 @@ import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.add; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.buildPhases; +import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.productName; import static dev.nokee.buildadapter.xcode.PBXProjectTestUtils.removeLast; import static dev.nokee.internal.testing.GradleRunnerMatchers.outOfDate; import static org.hamcrest.MatcherAssert.assertThat; @@ -57,4 +58,11 @@ void outOfDateWhenBuildPhaseRemoved() { assertThat(targetUnderTestExecution(), outOfDate()); } } + + @Test + void outOfDateWhenProductNameChanged() { + xcodeproj(targetUnderTest(productName("NewApp"))); + + assertThat(targetUnderTestExecution(), outOfDate()); + } } diff --git a/subprojects/build-adapter-xcode/src/main/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCoders.java b/subprojects/build-adapter-xcode/src/main/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCoders.java index c093ac6240..24a8c4064a 100644 --- a/subprojects/build-adapter-xcode/src/main/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCoders.java +++ b/subprojects/build-adapter-xcode/src/main/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCoders.java @@ -69,7 +69,7 @@ public final class XCBuildSpecCodingKeyCoders implements CodingKeyCoders { // PBXAggregateTarget put(CodeablePBXAggregateTarget.CodingKeys.name, null); - put(CodeablePBXAggregateTarget.CodingKeys.productName, null); + put(CodeablePBXAggregateTarget.CodingKeys.productName, forKey("productName", atInput(ofString()))); put(CodeablePBXAggregateTarget.CodingKeys.productType, null); put(CodeablePBXAggregateTarget.CodingKeys.productReference, null); put(CodeablePBXAggregateTarget.CodingKeys.buildPhases, forKey("buildPhases", list(of(PBXBuildPhase.class)))); @@ -106,7 +106,7 @@ public final class XCBuildSpecCodingKeyCoders implements CodingKeyCoders { // PBXLegacyTarget put(CodeablePBXLegacyTarget.CodingKeys.name, null); - put(CodeablePBXLegacyTarget.CodingKeys.productName, null); + put(CodeablePBXLegacyTarget.CodingKeys.productName, forKey("productName", atInput(ofString()))); put(CodeablePBXLegacyTarget.CodingKeys.productType, null); put(CodeablePBXLegacyTarget.CodingKeys.productReference, null); put(CodeablePBXLegacyTarget.CodingKeys.dependencies, null); @@ -119,7 +119,7 @@ public final class XCBuildSpecCodingKeyCoders implements CodingKeyCoders { // PBXNativeTarget put(CodeablePBXNativeTarget.CodingKeys.name, null); - put(CodeablePBXNativeTarget.CodingKeys.productName, null); + put(CodeablePBXNativeTarget.CodingKeys.productName, forKey("productName", atInput(ofString()))); put(CodeablePBXNativeTarget.CodingKeys.productType, null); put(CodeablePBXNativeTarget.CodingKeys.productReference, null); put(CodeablePBXNativeTarget.CodingKeys.dependencies, null); diff --git a/subprojects/build-adapter-xcode/src/test/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCodersTests.java b/subprojects/build-adapter-xcode/src/test/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCodersTests.java index 395c67c692..2acfde2ed8 100644 --- a/subprojects/build-adapter-xcode/src/test/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCodersTests.java +++ b/subprojects/build-adapter-xcode/src/test/java/dev/nokee/buildadapter/xcode/internal/plugins/specs/XCBuildSpecCodingKeyCodersTests.java @@ -89,7 +89,7 @@ private static final class CodingKeysProvider implements ArgumentsProvider { add(arguments(KeyedCoders.ISA, keyOf("isa", inputOf(string())))); add(arguments(CodeablePBXAggregateTarget.CodingKeys.name, ignore())); - add(arguments(CodeablePBXAggregateTarget.CodingKeys.productName, ignore())); + add(arguments(CodeablePBXAggregateTarget.CodingKeys.productName, keyOf("productName", inputOf(string())))); add(arguments(CodeablePBXAggregateTarget.CodingKeys.productType, ignore())); add(arguments(CodeablePBXAggregateTarget.CodingKeys.productReference, ignore())); add(arguments(CodeablePBXAggregateTarget.CodingKeys.dependencies, ignore())); // not required (2) @@ -125,7 +125,7 @@ private static final class CodingKeysProvider implements ArgumentsProvider { add(arguments(CodeablePBXHeadersBuildPhase.CodingKeys.files, keyOf("files", listOf(object(/*PBXBuildFile*/))))); add(arguments(CodeablePBXLegacyTarget.CodingKeys.name, ignore())); - add(arguments(CodeablePBXLegacyTarget.CodingKeys.productName, ignore())); + add(arguments(CodeablePBXLegacyTarget.CodingKeys.productName, keyOf("productName", inputOf(string())))); add(arguments(CodeablePBXLegacyTarget.CodingKeys.productType, ignore())); add(arguments(CodeablePBXLegacyTarget.CodingKeys.productReference, ignore())); add(arguments(CodeablePBXLegacyTarget.CodingKeys.dependencies, ignore())); // not required (2) @@ -137,7 +137,7 @@ private static final class CodingKeysProvider implements ArgumentsProvider { add(arguments(CodeablePBXLegacyTarget.CodingKeys.passBuildSettingsInEnvironment, ignore())); add(arguments(CodeablePBXNativeTarget.CodingKeys.name, ignore())); - add(arguments(CodeablePBXNativeTarget.CodingKeys.productName, ignore())); + add(arguments(CodeablePBXNativeTarget.CodingKeys.productName, keyOf("productName", inputOf(string())))); add(arguments(CodeablePBXNativeTarget.CodingKeys.productType, ignore())); add(arguments(CodeablePBXNativeTarget.CodingKeys.productReference, ignore())); add(arguments(CodeablePBXNativeTarget.CodingKeys.dependencies, ignore())); // not required (2) diff --git a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXAggregateTarget.java b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXAggregateTarget.java index 3ca1cbb425..584db35b8c 100644 --- a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXAggregateTarget.java +++ b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXAggregateTarget.java @@ -72,6 +72,12 @@ public Builder name(String name) { return this; } + @Override + public PBXTarget.Builder productName(String productName) { + builder.put(CodeablePBXAggregateTarget.CodingKeys.productName, productName); + return this; + } + @Override public Builder buildConfigurations(XCConfigurationList buildConfigurations) { builder.put(CodeablePBXAggregateTarget.CodingKeys.buildConfigurationList, buildConfigurations); diff --git a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXLegacyTarget.java b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXLegacyTarget.java index 0b90b246a1..e1d1bc295f 100644 --- a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXLegacyTarget.java +++ b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXLegacyTarget.java @@ -97,6 +97,7 @@ public Builder dependencies(Iterable dependencies return this; } + @Override public Builder productName(String productName) { builder.put(CodeablePBXLegacyTarget.CodingKeys.productName, productName); return this; diff --git a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXNativeTarget.java b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXNativeTarget.java index 1ddb58bd1e..7b9b0de532 100644 --- a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXNativeTarget.java +++ b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXNativeTarget.java @@ -99,6 +99,7 @@ public Builder buildConfigurations(XCConfigurationList buildConfigurationList) { return this; } + @Override public Builder productName(String productName) { builder.put(CodeablePBXNativeTarget.CodingKeys.productName, productName); return this; diff --git a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXTarget.java b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXTarget.java index b159d32b44..c5ee1bc108 100644 --- a/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXTarget.java +++ b/subprojects/xcode-ide-kit/src/main/java/dev/nokee/xcode/objects/targets/PBXTarget.java @@ -44,6 +44,8 @@ public interface PBXTarget extends PBXProjectItem { Builder toBuilder(); interface Builder { + Builder productName(String productName); + PBXTarget build(); } }