edx-app-ios: No signature of method: java.io.File.plus() is applicable for argument types: (java.lang.String) values: [ not found. Skipping.]

When i run the app, it is running well. But when i try to archive it, i get these errors

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/ganeshkumark/Downloads/edx-ios/edx-app-ios/build.gradle’ line: 182

  • What went wrong: Execution failed for task ‘:applyConfig’.

No signature of method: java.io.File.plus() is applicable for argument types: (java.lang.String) values: [ not found. Skipping.] Possible solutions: list(), list(java.io.FilenameFilter), use([Ljava.lang.Object;), is(java.lang.Object), split(groovy.lang.Closure), wait()

What could be the problem? I have given the build.gradle file below…

import com.dd.plist.*
import org.edx.builder.TaskHelper

// Dependencies
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.googlecode.plist:dd-plist:1.16'
    }
}

apply plugin: 'edxapp'
edx {
    platform = IOS
}

// Configuration
def workspace = 'edX.xcworkspace'
def scheme = 'edX'

class IOSHelper {
    // Environment Variable Conveniences
    // Only valid when our task is invoked by an Xcode build

    def getInfoPlistPath() {
        def env = System.getenv()
        return env['INFOPLIST_PATH']
    }

    def getBuiltProductsPath() {
        def env = System.getenv()
        return env['BUILT_PRODUCTS_DIR']
    }

    def getWrapperName() {
        def env = System.getenv()
        return env['WRAPPER_NAME']
    }

    def getBuiltInfoPlistPath() {
        return builtProductsPath + '/' + infoPlistPath
    }

    def getBundleConfigPath() {
        return builtProductsPath + '/' + wrapperName + '/config.plist'
    }

    // Saves our loaded and processed config YAML
    // to a Plist in the app bundle
    def saveProcessedConfig(config, toPath) {
        def plist = [:]

        for(c in config) {
            plist[c.key] = c.value
        }
        // Save entire config
        PropertyListParser.saveAsXML(NSObject.wrap(plist), new File(toPath))
    }

    // Modify Info.plist for specific services

    def readInfoPlist() {
        // The configuration library doesn't know how to read
        // binary plists so make sure it's an xml one
        ['plutil', '-convert', 'xml1', builtInfoPlistPath].execute().waitFor()

        def plist = PropertyListParser.parse(new File(builtInfoPlistPath)).toJavaObject()
        return plist
    }

    def writeInfoPlist(plist) {
        PropertyListParser.saveAsXML(NSObject.wrap(plist), new File(builtInfoPlistPath))

        // Restore to binary for runtime performance
        ['plutil', '-convert', 'binary1', builtInfoPlistPath].execute().waitFor()
    }

    def addURLScheme(scheme, plist) {
        def body = [
            'CFBundleTypeRole' : 'Editor',
            'CFBundleURLSchemes' : [scheme]
        ]

        def existing = plist['CFBundleURLTypes']
        if(existing) {
            // make sure we don't add it more than once
            def found = false
            for(entry in existing){
                def schemes = entry['CFBundleURLSchemes']
                if(schemes && schemes.contains(scheme)){
                    found = true
                    break
                }
            }
            if(!found) {
                def types = new ArrayList((ArrayList)existing)
                types.add(body)
                plist['CFBundleURLTypes'] = types
            }
        }
        else {
            plist["CFBundleURLTypes"] = [body]
        }
    }

    def addFacebookConfig(config, plist) {
        def facebook = config['FACEBOOK'] ?: [:]
        def key = facebook['FACEBOOK_APP_ID']
        if(!key) {
            return
        }

        plist["FacebookAppID"] = key
        def scheme = "fb" + key
        addURLScheme(scheme, plist)
    }

    def addFabricConfig(config, plist) {
        def fabric = config['FABRIC'] ?: [:]
        
        def key = fabric['FABRIC_KEY']
        if(!key) {
            return
        }

        def body = [
            'APIKey' : key,
            'Kits' : [
                [
                    'KitInfo' : [],
                    'KitName' : 'Crashlytics'
                ]
            ]
        ]
        plist["Fabric"] = body
    }

    def addGoogleConfig(config, plist) {
        def google = config['GOOGLE'] ?: [:]

        def key = google['GOOGLE_PLUS_KEY']
        if(!key) {
            return
        }

        // Google login schemes are the reverse DNS of the api key
        def scheme = key.tokenize('.').reverse().join('.')
        addURLScheme(scheme, plist)
    }

}


// Tasks 
task printBuildEnvironment(type : Exec) {
    def arguments = [
        'xcodebuild',
        '-workspace', workspace,
        '-scheme', scheme,
        '-showBuildSettings'
    ]
    commandLine arguments
}

task uploadDebuggingSymbols << {
    def taskHelper = new TaskHelper()
    def config = taskHelper.loadConfig(project)
    def fabric = config['FABRIC'] ?: [:]
    def key = fabric['FABRIC_KEY']
    def secret = fabric['FABRIC_BUILD_SECRET']
    def srcroot = System.getenv()['SRCROOT']
    if(key && secret && srcroot) {
        [srcroot + "/Pods/Fabric/Fabric.framework/run", key, secret].execute().waitFor()
    }
}

task applyConfig << {
    def taskHelper = new TaskHelper()
    def config = taskHelper.loadConfig(project)
    def helper = new IOSHelper()

    // Save all keys to config.plist
    helper.saveProcessedConfig(config, helper.bundleConfigPath)

    // Save specific fields to Info.plist
    def plist = helper.readInfoPlist()
    helper.addFacebookConfig(config, plist)
    helper.addFabricConfig(config, plist)
    helper.addGoogleConfig(config, plist)
    helper.writeInfoPlist(plist)

    // double check that the config file actually got made
    def check = ["[", "-f", helper.bundleConfigPath, "]"].execute()
    check.waitFor()

    def result = check.exitValue()
    assert result == 0
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.2.1'
}

def testBuildArguments(workspace, scheme, OS, record) {
    def args = [
        'xcodebuild', '-workspace', workspace, '-scheme', scheme, '-sdk', 'iphonesimulator', '-destination', 'platform=iOS Simulator,name=iPhone 5s,OS=' + OS, 'test'
    ]
    if(record) {
        args += ["OTHER_SWIFT_FLAGS=\$(OTHER_SWIFT_FLAGS) -D RECORD_SNAPSHOTS"]
    }
    return args
}

def RTLSchemeForScheme(scheme) {
    return scheme + '-RTL'
}

def operatingSystems = ["currentOS": "10.0", "previousOS": "9.0"]
def directions = ["LTR": scheme, "RTL": RTLSchemeForScheme(scheme)]
def commands = ["test" : ["record" : false], "recordSnapshots": ["record" : true]] 

for(OS in operatingSystems) {
    for(direction in directions) {
        for(command in commands) {
            def record = command.value["record"]
            def task = project.task(type: Exec, command.key + direction.key.capitalize() + OS.key.capitalize()) {
                commandLine testBuildArguments(workspace, direction.value, OS.value, record)
            }
        }
    }
}


task test(dependsOn: tasks.findAll { task -> task.name.startsWith('test')}) {}
task recordSnapshots(dependsOn: tasks.findAll { task -> task.name.startsWith('recordSnapshots')}) {}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

I found out what was causing the problem. in my_config/edx.properties file i have given two config files i.e

edx.ios {
    configFiles = ['shared.yaml', 'ios.yaml']
}

But in that directory i created only one file i.e ios.yaml file. So the configuration gradle was looking for the file shared.yaml. So i removed that and the error is gone. phewww… thanks for your help @saeedbashir