One of the reasons I wanted to go though osme of my AndCooper Android Build
tool refactorings so that I have a documented notes on tricks and etc..


I do not know if this is a bug..

However,  I am finding that you cannot use classpathref in taskef but
classpath works fine.. in the classpathref case it just does not acept it at
all..

Hold on let me show the full copy(build.gradle):

/**
 *  Android Project build script in gradle/groovy
 *  Copyright (C) 2009 Mobilebytes
 *  http://mobilebytes.wordpress.com
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
  * Initialization
  */
ant.property(file: 'build.properties')
ant.property(file: 'default.properties')
ant.property(file: 'local.properties')

configurations {
     /**
      *  bulid.properties settings converted to Groovy/Gradle vars
      */
      appPackage = ant.properties['application-package']
      srcFolder = ant.properties['source-folder']
      outFolder = ant.properties['out-folder']
      javadocWindowTitle = ant.properties['javadoc.windowtitle']
      javadocDocTitle = ant.properties['javadoc.doctitle']
      javadocHeader = ant.properties['javadoc.header']
      javadocFooter = ant.properties['javadoc.footer']
      javadocBottom = ant.properties['javadoc.bottom']

     /**
      *  default.properties
      */
      googleTargetTitle = ant.properties['target']

     /**
      *  local.properties
      */
      sdkFolder = ant.properties['sdk-location']
      sdkVersion = ant.properties['sdk-version']
      graphvizFolder = ant.properties['graphiz.location']
      keystoreAlias = ant.properties['keystore.alias']
      androidKeystore = ant.properties['android.keystore.location']
      storePass = ant.properties['storepass']
      jgrouseFolder = ant.properties['jGrouseHome.default']
      jgrouseFileMask = ant.properties['fileMask.default']
      jgrouseSkin = ant.properties['skin']
      jgrouseTheme = ant.properties['theme']
      jgrouseOutputFormat = ant.properties['outputFormat']
      jgrouseProjectDesc = ant.properties['projectDesc']
      jgrouseProjectName = ant.properties['projectName']
      jgrouseappVersion = ant.properties['appVersion']

      sdkLibFolder = sdkFolder + '/tools/lib'
      androidSdkAntTask

}

dependencies {
     androidSdkAntTask ([group: '', name: 'anttasks', ext: 'jar'],
                        [group: '', name: 'sdklib', ext: 'jar'],
                        [group: '', name: 'androidprefs', ext: 'jar'],
                        [group: '', name: 'apkbuilder', ext: 'jar'],
                        [group: '', name: 'jarutils', ext: 'jar'])

}

repositories {
    flatDir name: 'androidSdkAntTaskRepository', dirs: sdkLibFolder
    androidSdkAntTaskRepository {
        addArtifactPattern(file('lib').absolutePath + '/[name].[ext]')

    }
}


task initializeBuildSystem << {
    /**
     *  use classpath instead of classpathref?
     */
    ant.taskdef(name: 'setup', classname:'com.android.ant.SetupTask',
        classpath: configurations.androidSdkAntTask.asPath)
    ant.setup(import: 'false')
}


createTask('wrapper', type: org.gradle.api.tasks.wrapper.Wrapper).configure
{
    gradleVersion = '0.8-20090907042943-0500'
    urlRoot = 'file:/opt/j2ee/domains/
ci.codehaus.org/bamboo/webapps/atlassian-bamboo/data/atlassian-bamboo-2.3.1/xml-data/build-dir/GRADLE-CORETRUNK/build/distributions/
'
    zipBase = Wrapper.PathBase.PROJECT
    zipPath = 'wrapper'
    archiveBase = Wrapper.PathBase.PROJECT
    archivePath = 'wrapper'
    distributionBase = Wrapper.PathBase.PROJECT
    distributionPath = 'wrapper'
}

task hello(dependsOn: initializeBuildSystem) << {
    println 'hello'



}

The Android sdk setup ant task displays the text in the
ant.properties['target']  and so with classpath instead of classpathref it
does produce:

:initializeBuildSystem
Project Target: Google APIs
Vendor: Google Inc.
Platform Version: 1.5
API level: 3
:hello
hello

BUILD SUCCESSFUL

Total time: 7.193 secs

It also means that you can load ant task libraries from  anywhere..

Notice my loading this way to get the Ant task libraries in the project
reports..seemed liek a better solution than using ant.path although you
certinaly can use ant.path.

if its a bug, yes I can file bug report with both outputs, failure and
success..


Fred Grott
http://mobilebytes.wordpress.com

Reply via email to