Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
07af21e
Add the bootstrap task
deltatre-johann Apr 17, 2018
2d5d292
Replace the update task by the bootstrap one in the default process
deltatre-johann Apr 17, 2018
d23fd21
Add unit tests
deltatre-johann Apr 17, 2018
4342472
--wip-- [skip ci]
deltatre-johann Apr 18, 2018
5801d05
Adjusting the Xcode class to make it @CompileStatic and tweaks it's u…
deltatre-johann Apr 19, 2018
054cd3b
Make the task @CompileStatic
deltatre-johann Apr 19, 2018
c17e0ed
Adjustements in the unit tests
deltatre-johann Apr 19, 2018
7ff4e02
Fix unit tests
deltatre-johann Apr 19, 2018
dfb81ad
Fix unit tests
deltatre-johann Apr 19, 2018
8205174
--wip-- [skip ci]
deltatre-johann Apr 24, 2018
b611da8
--wip-- [skip ci]
deltatre-johann Apr 24, 2018
7e24156
Work in progress
deltatre-johann Apr 25, 2018
5bc4c0c
Revert indentation changes
deltatre-johann Apr 25, 2018
fbb12b7
Revert indentation changes
deltatre-johann Apr 25, 2018
3c213fb
Re-enable compilestatis
deltatre-johann Apr 25, 2018
e7aa7c8
--wip-- [skip ci]
deltatre-johann Apr 25, 2018
832d7a1
Continue working on the refactoring
deltatre-johann Apr 26, 2018
cdd8870
Add the packer
deltatre-johann Apr 27, 2018
6dbf080
More adjustements
deltatre-johann Apr 27, 2018
e21b2c1
Properly resolve the bundleidentifier depending of the DSL configuration
deltatre-johann Apr 30, 2018
0260467
Fix indentations
deltatre-johann Apr 30, 2018
97302f4
Adjustements
deltatre-johann Apr 30, 2018
368c83e
Continue to move the path resolution
deltatre-johann Apr 30, 2018
7f6f470
More path resolution changes
deltatre-johann Apr 30, 2018
b87d14d
Cleanin up
deltatre-johann Apr 30, 2018
6701374
Adjust the implementation
deltatre-johann Apr 30, 2018
55d8f1c
The entitlements were not injected properly
deltatre-johann May 1, 2018
8dc0c3f
Use the path reoslver
deltatre-johann May 1, 2018
2c0b95a
Use the pathhelper resolver in the test too
deltatre-johann May 1, 2018
8193aa9
Use the pathhelper resolver in the test too
deltatre-johann May 1, 2018
cb15f36
Use the path reoslver
deltatre-johann May 1, 2018
18ee99d
No more necessary
deltatre-johann May 1, 2018
4e42662
Inherit the legacy archiver, and make it run ifonly iOS or TvOS project
deltatre-johann May 1, 2018
d8ca4ac
Rename archive tasks
deltatre-johann May 1, 2018
8ebfe73
Use the path resolver
deltatre-johann May 1, 2018
d58519a
Same for packager'
deltatre-johann May 1, 2018
5d691f0
Fix the unit test
deltatre-johann May 1, 2018
674ce3f
Fix more unit tests
deltatre-johann May 1, 2018
920f4fe
Fix the unit tests
deltatre-johann May 1, 2018
3aef868
Move the archive tasks to a dedicated package
deltatre-johann May 1, 2018
eb7e01f
Adjustements
deltatre-johann May 1, 2018
96debe3
Adjustement in the rules around the bitcode setting
deltatre-johann May 2, 2018
c27778d
Remove duplication by adding a helper method
deltatre-johann May 3, 2018
325308f
Add functional unit test to the PrepareXcodeArchiving task
deltatre-johann May 4, 2018
28b4206
Remove the unused datas
deltatre-johann May 4, 2018
6a8c661
Adjust the unit tests
deltatre-johann May 4, 2018
3ea983c
Adjustements
deltatre-johann May 8, 2018
0b534af
Merge pull request #5 from massiveinteractive/feature/MASSDE-181-cart…
shoebox May 8, 2018
0aa60a5
--wip-- [skip ci]
deltatre-johann May 8, 2018
d5e1739
Convert the xcodeversion to a property
deltatre-johann May 9, 2018
309a69e
Properly instantiate the signing nested extension
deltatre-johann May 9, 2018
ad7750d
--wip-- [skip ci]
deltatre-johann May 10, 2018
710ba30
Refactoring of the keychain creation
deltatre-johann May 10, 2018
a6df690
Refactor and add unit and functional unit test of the keychain creati…
deltatre-johann May 10, 2018
551a922
--wip-- [skip ci]
deltatre-johann May 11, 2018
1e17389
--wip-- [skip ci]
deltatre-johann May 11, 2018
31c8b34
--wip-- [skip ci]
deltatre-johann May 11, 2018
16bacc1
--wip-- [skip ci]
deltatre-johann May 14, 2018
fb5d8fb
Tweak units test post changes
deltatre-johann May 14, 2018
d8aaf77
Start to convert the packaging task
deltatre-johann May 14, 2018
663b402
Add Xcode service add unit test to the XcodeBuildArchiveTaskIosAndTvO…
deltatre-johann May 15, 2018
08f7fe5
Add unit test around the xcode version specification
deltatre-johann May 15, 2018
83d6675
Work in progress
deltatre-johann May 15, 2018
5b347a5
Packaging task adjustements
deltatre-johann May 15, 2018
2af7cda
Clearning up
deltatre-johann May 15, 2018
49ec411
Start to put extension related classes to specific package
deltatre-johann May 15, 2018
f74ffd2
--wip-- [skip ci]
deltatre-johann May 16, 2018
8cedf31
Fix the infoplist unit test
deltatre-johann May 17, 2018
a0f1800
Fix the libxcode tests
deltatre-johann May 17, 2018
606a7ca
Fix the ProvisioningProfileReaderSpecification unit tests
deltatre-johann May 17, 2018
316ae17
Tweaks
deltatre-johann May 17, 2018
f80a961
Ajsutements in the signing spec
deltatre-johann May 17, 2018
88f5b33
fix unit tests
deltatre-johann May 17, 2018
885be49
Cleaning up no more necessary classes
deltatre-johann May 18, 2018
aa159ea
Cleaning up
deltatre-johann May 18, 2018
f1eaac9
Simplify declaration
deltatre-johann May 18, 2018
1a1cffc
Simplify declaration
deltatre-johann May 18, 2018
0b3c0ab
More adjustements
deltatre-johann May 18, 2018
89141a2
Adjust paths
deltatre-johann May 18, 2018
9c12828
Cleanup
deltatre-johann May 18, 2018
9b6460b
Fix the SimulatorInstallAppTaskSpecification
deltatre-johann May 18, 2018
8dacb1f
Fix unit tests
deltatre-johann May 18, 2018
e167ce0
--wip-- [skip ci]
deltatre-johann May 24, 2018
ec9a7d0
--wip-- [skip ci]
deltatre-johann May 24, 2018
be37cf2
Fixing unit tests and adjustements
deltatre-johann May 29, 2018
a603076
Remote the file
deltatre-johann May 29, 2018
f85f937
Upgrade verison
deltatre-johann May 29, 2018
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
23 changes: 22 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ allprojects {
apply plugin: 'java-gradle-plugin'
apply plugin: 'groovy'

def versionNumber = "0.2.8-SNAPSHOT"
def versionNumber = "0.16.0.a603076-SNAPSHOT"

if (project.hasProperty("versionNumber")) {
versionNumber = project.versionNumber
Expand Down Expand Up @@ -55,6 +55,27 @@ allprojects {
substitute module('ch.qos.logback:logback-classic') with module('org.slf4j:slf4j-api:1.7.+')
}
}

// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
def outputDir = file("$buildDir/$name")

inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir

doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text = project.files(project.rootProject.subprojects
.collect { it.sourceSets.main.runtimeClasspath }
.toList())
.files
.join("\n")
}
}

dependencies {
testRuntime files(createClasspathManifest)
}
}


Expand Down
26 changes: 20 additions & 6 deletions libxcode/src/main/groovy/org/openbakery/CommandRunner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class CommandRunner {

}


void setOutputFile(File outputFile) {
if (outputFile.exists()) {

Expand Down Expand Up @@ -172,20 +171,35 @@ class CommandRunner {
}

String runWithResult(String... commandList) {
return runWithResult(Arrays.asList(commandList));
return runWithResult(Arrays.asList(commandList))
}

String runWithResult(Map<String, String> environmentValues,
String... commandList) {
return runWithResult(defaultBaseDirectory,
commandList.toList(),
environmentValues,
null)
}

String runWithResult(List<String> commandList) {
return runWithResult(defaultBaseDirectory, commandList)
}

String runWithResult(String directory, List<String> commandList) {
return runWithResult(directory, commandList, null, null)
String runWithResult(String directory,
List<String> commandList) {
return runWithResult(directory,
commandList,
null,
null)
}

String runWithResult(String directory, List<String> commandList, Map<String, String> environment, OutputAppender outputAppender) {
String runWithResult(String directory,
List<String> commandList,
Map<String, String> environment,
OutputAppender outputAppender) {
commandOutputBuffer = new ArrayList<>();
run(directory, commandList, environment, outputAppender);
run(directory, commandList, environment, outputAppender)
String result = commandOutputBuffer.join("\n")
commandOutputBuffer = null;
return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ class ProvisioningProfileReader {
checkExpired()
}

static File getProvisionFileForIdentifier(String bundleIdentifier, List<File> mobileProvisionFiles, CommandRunner commandRunner, PlistHelper plistHelper) {
static File getProvisionFileForIdentifier(String bundleIdentifier,
List<File> mobileProvisionFiles,
CommandRunner commandRunner,
PlistHelper plistHelper) {
def provisionFileMap = [:]

for (File mobileProvisionFile : mobileProvisionFiles) {
Expand Down Expand Up @@ -99,8 +102,8 @@ class ProvisioningProfileReader {
}
}

logger.info("No provisioning profile found for bundle identifier {}", bundleIdentifier)
logger.info("Available bundle identifier are {}" + provisionFileMap.keySet())
logger.warn("No provisioning profile found for bundle identifier {}", bundleIdentifier)
logger.warn("Available bundle identifier are {}" + provisionFileMap.keySet())

return null
}
Expand Down Expand Up @@ -142,7 +145,7 @@ class ProvisioningProfileReader {
Date expireDate = config.getProperty("ExpirationDate")
if (expireDate.before(new Date())) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.getDefault())
throw new IllegalArgumentException("The Provisioning Profile has expired on " + formatter.format(expireDate) )
throw new IllegalArgumentException("The Provisioning Profile has expired on " + formatter.format(expireDate))
}
}

Expand All @@ -159,6 +162,14 @@ class ProvisioningProfileReader {
return config.getString("TeamIdentifier")
}

String getTeamName() {
return config.getString("TeamName")
}

String getName() {
return config.getString("Name")
}

File getPlistFromProvisioningProfile() {
if (provisioningPlist == null) {
// unpack provisioning profile to plain plist
Expand All @@ -170,12 +181,12 @@ class ProvisioningProfileReader {

try {
commandRunner.run(["security",
"cms",
"-D",
"-i",
provisioningProfile.getCanonicalPath(),
"-o",
provisioningPlist.absolutePath
"cms",
"-D",
"-i",
provisioningProfile.getCanonicalPath(),
"-o",
provisioningPlist.absolutePath
])
} catch (CommandRunnerException ex) {
if (!provisioningPlist.exists()) {
Expand Down Expand Up @@ -204,15 +215,16 @@ class ProvisioningProfileReader {
}

/* xcent is the archive entitlements */

void extractEntitlements(File entitlementFile, String bundleIdentifier, List<String> keychainAccessGroups, Configuration configuration) {
logger.info("extractEntitlements for " + bundleIdentifier)
File plistFromProvisioningProfile = getPlistFromProvisioningProfile()
String entitlements = commandRunner.runWithResult([
"/usr/libexec/PlistBuddy",
"-x",
plistFromProvisioningProfile.absolutePath,
"-c",
"Print Entitlements"])
"/usr/libexec/PlistBuddy",
"-x",
plistFromProvisioningProfile.absolutePath,
"-c",
"Print Entitlements"])

if (StringUtils.isEmpty(entitlements)) {
logger.debug("No entitlements found in {}", plistFromProvisioningProfile)
Expand All @@ -228,7 +240,7 @@ class ProvisioningProfileReader {
String bundleIdentifierPrefix = ""
if (applicationIdentifier != null) {
String[] tokens = applicationIdentifier.split("\\.")
for (int i=1; i<tokens.length; i++) {
for (int i = 1; i < tokens.length; i++) {
if (tokens[i] == "*") {
break
}
Expand Down Expand Up @@ -269,14 +281,13 @@ class ProvisioningProfileReader {
plistHelper.deleteValueFromPlist(entitlementFile, "keychain-access-groups")
}


// copy the missing values that are in configuration (xcent or signing.entitlments) to the entitlements for signing
enumerateMissingEntitlements(entitlementFile, configuration) { key, value, action ->

if (value instanceof String) {
value = this.replaceVariables(value)
} else if (value instanceof List) {
value = this.replaceValuesInList((List)value)
value = this.replaceValuesInList((List) value)
}


Expand Down Expand Up @@ -308,7 +319,7 @@ class ProvisioningProfileReader {
def result = []
for (Object item : list) {
if (item instanceof String) {
result << replaceVariables((String)item)
result << replaceVariables((String) item)
} else {
result << item
}
Expand All @@ -330,7 +341,7 @@ class ProvisioningProfileReader {
}

Configuration entitlements = new ConfigurationFromPlist(entitlementFile)
Set<String>replaceKeys = configuration.getReplaceEntitlementsKeys()
Set<String> replaceKeys = configuration.getReplaceEntitlementsKeys()

for (String key in configuration.getKeys()) {
Object value = configuration.get(key) //plistHelper.getValueFromPlist(xcent, key)
Expand Down Expand Up @@ -366,7 +377,7 @@ class ProvisioningProfileReader {

} else {
if (currentValue.toString().endsWith('*')) {
plistHelper.setValueForPlist(entitlementFile, value, prefix + "." + bundleIdentifier)
plistHelper.setValueForPlist(entitlementFile, value, prefix + "." + bundleIdentifier)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.openbakery.codesign

import org.apache.commons.io.FileUtils
import org.apache.commons.io.FilenameUtils
import org.apache.commons.lang.StringUtils
import org.openbakery.CommandRunner
Expand All @@ -9,7 +8,6 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory

import java.security.cert.CertificateException
import java.text.ParseException

class Security {
private static Logger logger = LoggerFactory.getLogger(Security.class)
Expand Down Expand Up @@ -60,6 +58,7 @@ class Security {
for (File keychain in keychainList) {
commandList.add(keychain.absolutePath)
}

commandRunner.run(commandList)
}

Expand Down
26 changes: 26 additions & 0 deletions libxcode/src/main/groovy/org/openbakery/util/PathHelper.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.openbakery.util

import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.openbakery.xcode.Type

@CompileStatic
Expand All @@ -9,6 +10,10 @@ class PathHelper {
public static final String APPLE_TV_SIMULATOR = "appletvsimulator"
public static final String IPHONE_SIMULATOR = "iphonesimulator"
public static final String IPHONE_OS = "iphoneos"
public static final String FOLDER_ARCHIVE = "archive"
public static final String FOLDER_PACKAGE = "package"
public static final String GENERATED_XCARCHIVE_FILE_NAME = "archive.xcconfig"
public static final String EXTENSION_XCARCHIVE = ".xcarchive"

static File resolvePath(Type type,
boolean simulator,
Expand Down Expand Up @@ -70,4 +75,25 @@ class PathHelper {
return new File(symRoot,
"${configuration}-${destination}")
}

static File resolveArchiveFolder(Project project) {
return new File(project.getBuildDir(), FOLDER_ARCHIVE)
}

static File resolveArchiveFile(Project project,
String scheme) {
return new File(resolveArchiveFolder(project), scheme + EXTENSION_XCARCHIVE)
}

static File resolveArchivingLogFile(Project project) {
return new File(resolveArchiveFolder(project), "xcodebuild-archive-output.txt")
}

static File resolveXcConfigFile(Project project) {
return new File(resolveArchiveFolder(project), GENERATED_XCARCHIVE_FILE_NAME)
}

static File resolvePackageFolder(Project project) {
return new File(project.getBuildDir(), FOLDER_PACKAGE)
}
}
23 changes: 14 additions & 9 deletions libxcode/src/main/groovy/org/openbakery/util/PlistHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ class PlistHelper {
this.commandRunner = commandRunner
}


/**
* Reads the value for the given key from the given plist
*
* @param plist
* @param key
* @param commandRunner The commandRunner to execute commands (This is espacially needed for Unit Tests)
*
* @return returns the value for the given key
*/
* Reads the value for the given key from the given plist
*
* @param plist
* @param key
* @param commandRunner The commandRunner to execute commands (This is espacially needed for Unit Tests)
*
* @return returns the value for the given key
*/
def getValueFromPlist(File plist, String key) {

try {
Expand Down Expand Up @@ -75,6 +74,12 @@ class PlistHelper {
commandForPlist(plist, "Add :" + key + " string " + value)
}

void addDictForPlist(File plist, String key, Map<String, String> map) {
commandForPlist(plist, "Add :" + key + " dict")
map.keySet()
.each { it -> addValueForPlist(plist, ":$key:$it", map.get(it)) }
}

void addValueForPlist(File plist, String key, Number value) {
if (value instanceof Float || value instanceof Double || value instanceof BigDecimal) {
commandForPlist(plist, "Add :" + key + " real " + value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ class DestinationResolver {
def runtime = simulatorControl.getMostRecentRuntime(parameters.type)



if (isSimulatorFor(parameters)) {
// filter only on simulator builds

logger.debug("is a simulator build")
if (parameters.configuredDestinations != null) {

Expand Down
10 changes: 4 additions & 6 deletions libxcode/src/main/groovy/org/openbakery/xcode/Version.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.openbakery.xcode

class Version implements Comparable<Version> {
class Version implements Comparable<Version>, Serializable {

public int major = -1
public int minor = -1
Expand All @@ -11,7 +11,7 @@ class Version implements Comparable<Version> {
public Version() {
}

public Version(String version) {
public Version(String version) {
Scanner versionScanner = new Scanner(version);
versionScanner.useDelimiter("\\.");

Expand All @@ -30,8 +30,6 @@ class Version implements Comparable<Version> {
} catch (InputMismatchException ex) {
suffix = versionScanner.next()
}


}

@Override
Expand Down Expand Up @@ -71,13 +69,13 @@ class Version implements Comparable<Version> {
builder.append(minor)
}

if (this.maintenance>= 0) {
if (this.maintenance >= 0) {
builder.append(".")
builder.append(maintenance)
}

if (this.suffix != null) {
if (builder.length() > 0 ){
if (builder.length() > 0) {
builder.append(".")
}
builder.append(suffix)
Expand Down
Loading