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

Fix signing identity missing during manual signing #4

Open
wants to merge 1 commit into
base: moe-master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions src/main/java/org/moe/gradle/tasks/IpaBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class IpaBuild extends AbstractBaseTask {
private static final String CONVENTION_BUNDLE_IDENTIFIER = "bundleIdentifier";
private static final String CONVENTION_PROVISIONING_PROFILE_SPECIFIER = "provisioningProfileSpecifier";
private static final String CONVENTION_PROVISIONING_PROFILE = "provisioningProfile";
private static final String CONVENTION_SIGNING_IDENTITY = "signingIdentity";

public static final String BUNDLE_IDENTIFIER_KEY = "PRODUCT_BUNDLE_IDENTIFIER";

Expand Down Expand Up @@ -480,6 +481,21 @@ public void setProvisioningProfile(@Nullable String provisioningProfile) {
this.provisioningProfileSpecifier = provisioningProfile;
}

@Nullable
private String signingIdentity;

@Input
@Optional
@Nullable
public String getSigningIdentity() {
return nullableGetOrConvention(signingIdentity, CONVENTION_SIGNING_IDENTITY);
}

@IgnoreUnused
public void setSigningIdentity(@Nullable String signingIdentity) {
this.signingIdentity = signingIdentity;
}

@Nullable
private String target;

Expand Down Expand Up @@ -663,12 +679,9 @@ protected final void setupMoeTask() {
});
addConvention(CONVENTION_ADDITIONAL_PARAMETERS, () ->
new ArrayList<>(Arrays.asList("MOE_GRADLE_EXTERNAL_BUILD=YES", "ONLY_ACTIVE_ARCH=NO")));
addConvention(CONVENTION_PROVISIONING_PROFILE_SPECIFIER, () -> {
return ext.signing.getProvisioningProfileSpecifier();
});
addConvention(CONVENTION_PROVISIONING_PROFILE, () -> {
return ext.signing.getProvisioningProfile();
});
addConvention(CONVENTION_PROVISIONING_PROFILE_SPECIFIER, ext.signing::getProvisioningProfileSpecifier);
addConvention(CONVENTION_PROVISIONING_PROFILE, ext.signing::getProvisioningProfile);
addConvention(CONVENTION_SIGNING_IDENTITY, ext.signing::getSigningIdentity);
addConvention(CONVENTION_LOG_FILE, () -> resolvePathInBuildDir(out, "IpaBuild.log"));
}

Expand Down Expand Up @@ -750,6 +763,12 @@ private List<String> calculateArchiveArgs() {
if (provProf != null && !provProf.isEmpty()) {
args.add("PROVISIONING_PROFILE=" + provProf);
}

String signingId = getSigningIdentity();
if(signingId != null && !signingId.isEmpty()) {
args.add("CODE_SIGN_IDENTITY=" + signingId);
}

return args;
}

Expand Down Expand Up @@ -905,10 +924,15 @@ private void generateExportOptionsPlist() {
throw new GradleException("Bundle id is null");
}

if (bundleId != null && !bundleId.isEmpty() && provisioningProf != null && !provisioningProf.isEmpty()) {
if (provisioningProf != null && !provisioningProf.isEmpty()) {
manager.setProvisioningProfiles(bundleId, provisioningProf);
}

String signingId = getSigningIdentity();
if (signingId != null && !signingId.isEmpty()) {
manager.setSigningCertificate(signingId);
}

manager.save();

} catch (Throwable t) {
Expand Down